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 endpo
ints.¶
Parcel editing workflow¶
At a high level, a typical parcel editing workflow will look like:
- Create a branch version to isolate edits from the default version. (Version Management)
- Start an edit session (Version Management)
- Create a new parcel Record feature (Feature Access)
- Edit one or more parcels (merge, divide, copy lines, etc.) (Parcel Fabric)
- Reconcile the current branch version with the default version. (Version Management)
- Post changes from the current version to the default version. (Version Management)
- Stop the edit session. (Version Management)
- 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)
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
Get all versions¶
versions = vms.all
versions
Create a version¶
new_version_name = "fabric_editor_1"
vms.create(new_version_name)
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
[print(v.properties.versionName) for v in vms_from_flc.all]
Branch Versioning Edit Sessions¶
A branch versioning edit session is 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 write 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.generate_fabric_links", "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
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()
Feedback on this topic?