Part 2 - Branch Versioning with Parcel Fabric

Components of a Parcel Fabric Feature Service

A Parcel Fabric feature service consists of at least 5 endpoints (SOEs)

  • Mapping (.../MapServer)
  • Feature Access (.../FeatureServer)
  • Version Management (.../VersionManagementServer)
  • Validation (.../ValidationServer)
  • Parcel Fabric (../ParcelFabricServer)

Most Parcel Fabric editing operations will make use of the Feature Access, Version Management and Parcel Fabric endpoints.

Parcel editing workflow

At a high level, a typical parcel editing workflow will look like:

  1. Create a branch version to isolate edits from the default version. (Version Management)
  2. Start an edit session (Version Management)
  3. Create a new parcel Record feature (Feature Access)
  4. Edit one or more parcels (merge, divide, copy lines, etc.) (Parcel Fabric)
  5. Reconcile the current branch version with the default version. (Version Management)
  6. Post changes from the current version to the default version. (Version Management)
  7. Stop the edit session. (Version Management)
  8. Delete the version. (Version Management)

Based on this example, it is obvious that understanding versioned, multi-user editing is critical. The following notebooks will demonstrate how to list versions, create versions, start and stop edit sessions and reconcile and post edits.

from arcgis import GIS
from arcgis.features import _version
base_server_url = (
    "https://myserver.domain.com/web_adaptor/rest/services/WashingtonCountyLSA/"
)
gis = GIS(
    "https://myserver.domain.com/web_adaptor/",
    "username",
    "pass.word",
    verify_cert=False,
)
Setting `verify_cert` to False is a security risk, use at your own risk.

Access branch versions via Version Management Server

from arcgis.features._version import VersionManager

version_management_server_url = f"{base_server_url}/VersionManagementServer"
vms = VersionManager(version_management_server_url, gis)
vms.properties
{
  "name": "Version Management Server",
  "type": "Map Server Extension",
  "defaultVersionName": "sde.DEFAULT",
  "defaultVersionGuid": "{BD3F4817-9A00-41AC-B0CC-58F78DBAE0A1}",
  "capabilities": {
    "supportsConflictDetectionByAttribute": true,
    "supportsPartialPost": true,
    "supportsDifferencesFromMoment": true,
    "supportsDifferencesWithLayers": true,
    "supportsAsyncReconcile": true,
    "supportsAsyncPost": true,
    "supportsAsyncDifferences": true
  }
}

Get all versions

versions = vms.all
versions
[<Version sde.DEFAULT @ {BD3F4817-9A00-41AC-B0CC-58F78DBAE0A1}>,
 <Version ADMIN.subdivision_a155544 @ {E3A066CE-F4BA-4BE1-8C6E-83C0707EAEDD}>,
 <Version ADMIN.combine_plat_1555467 @ {0CCEE2A6-7AD0-4D2B-AC57-62C1CAFD53D0}>]

Create a version

new_version_name = "fabric_editor_1"
vms.create(new_version_name)
{'versionInfo': {'versionName': 'ADMIN.fabric_editor_1',
  'versionGuid': '{1277D15C-1957-4F0C-A73F-E4F4A3D46363}',
  'versionId': 12506,
  'description': '',
  'creationDate': 1665678713463,
  'modifiedDate': 1665678713463,
  'reconcileDate': None,
  'evaluationDate': None,
  'previousAncestorDate': None,
  'commonAncestorDate': 1665678713463,
  'access': 'public'},
 'success': True}

Access the Version Management Server through the Parcel Fabric FeatureLayerCollection object

The versions property in a parcel fabric FeatureLayerCollection (FLC) creates a VersionManager object to create, update and use versions.

The FeatureServer endpoint is used to create a FeatureLayerCollection.

from arcgis.features.layer import FeatureLayerCollection

parcel_fabric_feature_server_url = f"{base_server_url}/FeatureServer"
parcel_fabric_flc = FeatureLayerCollection(parcel_fabric_feature_server_url, gis)

# print the version names from the FLC's versions property:
vms_from_flc = parcel_fabric_flc.versions
[v.properties.versionName for v in vms_from_flc.all]
['sde.DEFAULT',
 'ADMIN.subdivision_a155544',
 'ADMIN.combine_plat_1555467',
 'ADMIN.fabric_editor_1']

Branch Versioning Edit Sessions

A branch versioning edit session is the act of obtaining shared and exclusive locks on the feature class to prevent corruption in the branch version. Calling version.startReading will set a shared lock on the version which prevents another session from obtaining an exclusive lock. Other sessions can still access the version as read-only. Calling version.startEditing will set the exclusive lock which will prevent read access and write access to the version.

Keeping track of where one is within the edit sessions is made simple with a built in context manager.

from arcgis.features import _parcel

parcel_fabric_manager_url = f"{base_server_url}/ParcelFabricServer"

# start a 'read' session to acquire a shared lock and
# get a branch version by its name
with vms.get("ADMIN.fabric_editor_1", "read") as version:
    parcel_fabric_manager = _parcel.ParcelFabricManager(
        parcel_fabric_manager_url, gis, version, parcel_fabric_flc
    )

    # do parcel fabric or other feature service editing within the version
    # i.e. parcel_fabric_manager.copy_lines_to_parcel_type(...)

parcel_fabric_manager.properties
{
  "name": "Parcel Fabric Server",
  "type": "Map Server Extension",
  "ParcelFabricLayers": 1
}

Recocile, Post and Delete the version

When editing is complete, the new features can be posted from the new branch version to the default version. In this workflow, Reconcile must occur first. Once posted, the version can optionally be deleted.

version = vms.get(f"admin.{new_version_name}")

# version.reconcile()
# version.post

version.delete()
True

API Ref Documentation

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.