arcgis.features.managers module¶
Helper classes for managing feature layers and datasets. These class are not created by users directly. Instances of this class, are available as a properties of feature layers and make it easier to manage them.
AttachmentManager¶
-
class
arcgis.features.managers.
AttachmentManager
(layer)¶ Manager class for manipulating feature layer attachments. This class is not created by users directly. An instance of this class, called ‘attachments’, is available as a property of the FeatureLayer object, if the layer supports attachments. Users call methods on this ‘attachments’ object to manipulate (create, get, list, delete) attachments.
-
add
(oid, file_path)¶ Adds an attachment to a feature layer Input:
oid - string - OBJECTID value to add attachment to file_path - string - path to file
- Output:
JSON Repsonse
-
delete
(oid, attachment_id)¶ removes an attachment from a feature Input:
oid - integer or string - id of feature attachment_id - integer - id of attachment to erase
- Output:
JSON response
-
download
(oid=None, attachment_id=None, save_path=None)¶ downloads attachment and returns it’s path on disk.
The download tool works as follows:
- 1). if nothing is given, all attachments will be downloaded
example: download()
2). If a single oid and attachment_id are given, the single file will download 3). If a list of oid values are given, all the attachments for those object ids will be saved locally.
Arguement
Description
oid
optional list/string. A list of object Ids or a single value to download data from.
attachment_id
optional string. Id of the attachment to download. This is only honored if return_all is False.
save_folder
optional string. Path to save data to.
- Returns
list of downloaded files
-
get_list
(oid)¶ returns the list of attachements for a given OBJECT ID
-
search
(where='1=1', object_ids=None, global_ids=None, attachment_types=None, size=None, keywords=None, show_images=False, as_df=False)¶ The search method allows querying the layer for its attachments and returns the results as a Pandas DataFrame or dict
Arguement
Description
where
required string. The definition expression to be applied to the related layer/table. From the list of records that are related to the specified object Ids, only those records that conform to this expression will be returned.
Example: where=”STATE_NAME = ‘Alaska’”. The query results will return all attachments in Alaska.
object_ids
optional list/string. The object IDs of this layer/table to be queried.
Syntax: objectIds=<objectId1>,<objectId2>
Example: objectIds=2. The query results will return attachments only for the specified object id.
global_ids
optional list/string. The global IDs of this layer/table to be
queried.
Syntax: globalIds=<globalIds1>,<globalIds2>
Example: globalIds=6s430c5a-kb75-4d52-a0db-b30bg060f0b9,35f0d027-8fc0-4905-a2f6-373c9600d017
The query results will return attachments only for specified global id.
attachment_types
optional list/string. The file format that is supported by query attachment.
Supported attachment types: bmp, ecw, emf, eps, ps, gif, img, jp2, jpc, j2k, jpf, jpg, jpeg, jpe, png, psd, raw, sid, tif, tiff, wmf, wps, avi, mpg, mpe, mpeg, mov, wmv, aif, mid, rmi, mp2, mp3, mp4, pma, mpv2, qt, ra, ram, wav, wma, doc, docx, dot, xls, xlsx, xlt, pdf, ppt, pptx, txt, zip, 7z, gz, gtar, tar, tgz, vrml, gml, json, xml, mdb, geodatabase
Example: attachment_types=’image/jpeg’
size
optional tuple/list. The file size of the attachment is specified in bytes. You can enter a file size range (1000,15000) to query for attachments with the specified range.
Example: size=1000,15000. The query results will return all attachments within the specified file size range (1000 - 15000) bytes.
keywords
optional string. When attachments are uploaded, keywords can be assigned to the uploaded file. By passing a keyword value, the values will be searched.
Example: keywords=’airplanes’
show_images
optional bool. The default is False, when the value is True, the results will be displayed as a HTML table. If the as_df is set to False, this parameter will be ignored.
as_df
optional bool. Default is False, if True, the results will be a Pandas’ DataFrame. If False, the values will be a list of dictionary values.
- Returns
list of downloaded files
-
update
(oid, attachment_id, file_path)¶ updates an existing attachment with a new file Inputs:
oid - string/integer - Unique record ID attachment_id - integer - Unique attachment identifier file_path - string - path to new attachment
- Output:
JSON response
-
SyncManager¶
-
class
arcgis.features.managers.
SyncManager
(featsvc)¶ Manager class for manipulating replicas for syncing disconnected editing of feature layers. This class is not created by users directly. An instance of this class, called ‘replicas’, is available as a property of the FeatureLayerCollection object, if the layer is sync enabled / supports disconnected editing. Users call methods on this ‘replicas’ object to manipulate (create, synchronize, unregister) replicas.
-
cleanup_change_tracking
(layers, retention_period, period_unit='days', min_server_gen=None, replica_id=None, future=False)¶ Change tracking information stored in each feature service layer (enabled for Change Tracking) might grow very large. The change tracking info used by the feature service to determine the change generation number and the features that have changed for a particular generation. Clients can purge the change tracking content if the changes are already synced-up to all clients and the changes are no longer needed.
Only the owner or the organization administrator can cleanup change tracking information.
Argument
Description
layers
Required list. A list of layers and tables to include in the replica.
retention_period
Optional Integer. The retention period to use when cleaning up the change tracking information. Change tracking information will be cleaned up if they are older than the retention period.
period_unit
Optional String. The units of the retention period.
Values: days, seconds, minutes, or hours
min_server_gen
Optional String. In addition to the retention period, the change tracking can be cleaned by its generation numbers. Older tracking information that has older generation number than the min_server_gen will be cleaned.
replica_id
Optional String. The change tracking can also be cleaned by the replica_id in addition to the retention_period and the min_server_gen.
future
Optional Boolean. Support options for asynchronous processing. The default format is false.
- Returns
Boolean when future is False and Future object when future is True
-
create
(replica_name, layers, layer_queries=None, geometry_filter=None, replica_sr=None, transport_type='esriTransportTypeUrl', return_attachments=False, return_attachments_databy_url=False, asynchronous=False, attachments_sync_direction='none', sync_model='none', data_format='json', replica_options=None, wait=False, out_path=None, sync_direction=None, target_type='client', transformations=None)¶ The create operation is performed on a feature layer collection resource. This operation creates the replica between the feature dataset and a client based on a client-supplied replica definition. It requires the Sync capability. See Sync overview for more information on sync. The response for create includes replicaID, replica generation number, and data similar to the response from the feature layer collection query operation. The create operation returns a response of type esriReplicaResponseTypeData, as the response has data for the layers in the replica. If the operation is called to register existing data by using replicaOptions, the response type will be esriReplicaResponseTypeInfo, and the response will not contain data for the layers in the replica.
Argument
Description
replica_name
Required string. Name of the replica.
layers
Required list. A list of layers and tables to include in the replica.
layer_queries
Optional dictionary. In addition to the layers and geometry parameters, the layer_queries parameter can be used to further define what is replicated. This parameter allows you to set properties on a per layer or per table basis. Only the properties for the layers and tables that you want changed from the default are required. Example: layer_queries = {“0”:{“queryOption”: “useFilter”, “useGeometry”: true, “where”: “requires_inspection = Yes”}}
geometry_filter
Optional {} object. spatial filter from arcgis.geometry.filters module to filter results by a spatial relationship with another geometry.
replica_sr
Optional WKID or a spatial reference JSON object. the spatial reference of the replica geometry.
transport_type
The transport_type represents the response format. If the transport_type is esriTransportTypeUrl, the JSON response is contained in a file, and the URL link to the file is returned. Otherwise, the JSON object is returned directly. The default is esriTransportTypeUrl. If async is true, the results will always be returned as if transport_type is esriTransportTypeUrl. If dataFormat is sqlite, the transportFormat will always be esriTransportTypeUrl regardless of how the parameter is set. Values: esriTransportTypeUrl | esriTransportTypeEmbedded.
return_attachments
If True, attachments are added to the replica and returned in the response. Otherwise, attachments are not included. The default is False. This parameter is only applicable if the feature service has attachments.
return_attachments
If True, a reference to a URL will be provided for each attachment
_databy_url
returned from create method. Otherwise, attachments are embedded in the response. The default is True. This parameter is only applicable if the feature service has attachments and if return_attachments is True.
asynchronous
If True, the request is processed as an asynchronous job, and a URL is returned that a client can visit to check the status of the job. See the topic on asynchronous usage for more information. The default is False.
Client can specify the attachmentsSyncDirection when creating a
direction
replica. AttachmentsSyncDirection is currently a createReplica property and cannot be overridden during sync. Values: none, upload, bidirectional
sync_model
This parameter is used to indicate that the replica is being created for per-layer sync or per-replica sync. To determine which model types are supported by a service, query the supportsPerReplicaSync, supportsPerLayerSync, and supportsSyncModelNone properties of the Feature Service. By default, a replica is created for per-replica sync. If syncModel is perReplica, the syncDirection specified during sync applies to all layers in the replica. If the syncModel is perLayer, the syncDirection is defined on a layer-by-layer basis.
If syncModel is perReplica, the response will have replicaServerGen. A perReplica syncModel requires the replicaServerGen on sync. The replicaServerGen tells the server the point in time from which to send back changes. If syncModel is perLayer, the response will include an array of server generation numbers for the layers in layerServerGens. A perLayer sync model requires the layerServerGens on sync. The layerServerGens tell the server the point in time from which to send back changes for a specific layer. sync_model=none can be used to export the data without creating a replica. Query the supportsSyncModelNone property of the feature service to see if this model type is supported.
See the RollbackOnFailure and Sync Models topic for more details. Values: perReplica | perLayer | none Example: syncModel=perLayer
data_format
The format of the replica geodatabase returned in the response. The default is json. Values: filegdb, json, sqlite, shapefile
replica_options
This parameter instructs the create operation to create a new replica based on an existing replica definition (refReplicaId). It can be used to specify parameters for registration of existing data for sync. The operation will create a replica but will not return data. The responseType returned in the create response will be esriReplicaResponseTypeInfo.
wait
if async, wait to pause the process until the async operation is completed.
out_path
out_path - folder path to save the file.
syncDirection
Defaults to bidirectional when the targetType is client and download when the targetType is server. If set, only bidirectional is supported when targetType is client. If set, only upload or download are supported when targetType is server. Values: download | upload | bidirectional Example: syncDirection=download
targetType
Can be set to either server or client. If not set, the default is client. This option was added at 10.5.1.
transformations
Optional List. Introduced at 10.8. This parameter applies a datum transformation on each layer when the spatial reference used in geometry is different than the layer’s spatial reference.
- Returns
Required. JSON response if POST request made successfully. Otherwise, return None.
-
create_replica_item
(replica_name, item, destination_gis, layers=None, extent=None)¶ creates a replicated service from a parent to another GIS
-
get
(replica_id)¶ returns replica metadata for a specific replica. Inputs:
- replica_id - The replicaID returned by the feature service
when the replica was created.
-
get_list
()¶ returns all the replicas for the feature layer collection
-
sync_replicated_items
(parent, child, replica_name)¶ synchronizes two replicated items between portals
- Paramters:
- parent
arcgis.gis.Item class that points to a feature service who is the parent (source) dataset.
- child
arcgis.gis.Item class that points to the child replica
- replica_name
name of the replica to synchronize
- Output:
boolean value. True means service is up to date/synchronized, False means the synchronization failed.
-
synchronize
(replica_id, transport_type='esriTransportTypeUrl', replica_server_gen=None, return_ids_for_adds=False, edits=None, return_attachment_databy_url=False, asynchronous=False, sync_direction='snapshot', sync_layers='perReplica', edits_upload_id=None, edits_upload_format=None, data_format='json', rollback_on_failure=True)¶ synchronizes replica with feature layer collection http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000vv000000
-
unregister
(replica_id)¶ unregisters a replica from a feature layer collection Inputs:
- replica_id - The replicaID returned by the feature service
when the replica was created.
-
FeatureLayerCollectionManager¶
-
class
arcgis.features.managers.
FeatureLayerCollectionManager
(url, gis=None, fs=None)¶ Allows updating the definition (if access permits) of a feature layer collection. This class is not created by users directly. An instance of this class, called ‘manager’, is available as a property of the FeatureLayerCollection object.
Users call methods on this ‘manager’ object to manage the feature layer collection.
-
add_to_definition
(json_dict)¶ The add_to_definition operation supports adding a definition property to a hosted feature layer collection service. The result of this operation is a response indicating success or failure with error code and description.
This function will allow users to change or add additional values to an already published service.
- Input:
- json_dict - part to add to host service. The part format can
be derived from the properties property. For layer level modifications, run updates on each individual feature service layer object.
- Output:
JSON message as dictionary
-
create_view
(name, spatial_reference=None, extent=None, allow_schema_changes=True, updateable=True, capabilities='Query', view_layers=None, view_tables=None)¶ Creates a view of an existing feature service. You can create a view, if you need a different view of the data represented by a hosted feature layer, for example, you want to apply different editor settings, apply different styles or filters, define which features or fields are available, or share the data to different groups than the hosted feature layer create a hosted feature layer view of that hosted feature layer.
When you create a feature layer view, a new hosted feature layer item is added to Content. This new layer is a view of the data in the hosted feature layer, which means updates made to the data appear in the hosted feature layer and all of its hosted feature layer views. However, since the view is a separate layer, you can change properties and settings on this item separately from the hosted feature layer from which it is created.
For example, you can allow members of your organization to edit the hosted feature layer but share a read-only feature layer view with the public.
To learn more about views visit: https://doc.arcgis.com/en/arcgis-online/share-maps/create-hosted-views.htm
Argument
Description
name
Required string. Name of the new view item
spatial_reference
Optional dict. Specify the spatial reference of the view
extent
Optional dict. Specify the extent of the view
allow_schema_changes
Optional bool. Default is True. Determines if a view can alter a service’s schema.
updateable
Optional bool. Default is True. Determines if view can update values
capabilities
Optional string. Specify capabilities as a comma separated string. For example “Query, Update, Delete”. Default is ‘Query’.
view_layers
Optional list. Specify list of layers present in the FeatureLayerCollection that you want in the view.
view_tables
Optional list. Specify list of tables present in the FeatureLayerCollection that you want in the view.
- Returns
Returns the newly created item for the view.
-
delete_from_definition
(json_dict)¶ The delete_from_definition operation supports deleting a definition property from a hosted feature layer collection service. The result of this operation is a response indicating success or failure with error code and description. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Delete_From_Definition_Feature_Service/02r30000021w000000/ # noqa for additional information on this function. Input:
- json_dict - part to add to host service. The part format can
be derived from the properties property. For layer level modifications, run updates on each individual feature service layer object. Only include the items you want to remove from the FeatureService or layer.
- Output:
JSON Message as dictionary
-
classmethod
fromitem
(item)¶
-
overwrite
(data_file)¶ Overwrite all the features and layers in a hosted feature layer collection service. This operation removes all features but retains the properties (such as metadata, itemID) and capabilities configured on the service. There are some limits to using this operation:
Only hosted feature layer collection services can be overwritten
The original data used to publish this layer should be available on the portal
3. The data file used to overwrite should be of the same format and filename as the original that was used to publish the layer 4. The schema (column names, column data types) of the data_file should be the same as original. You can have additional or fewer rows (features).
In addition to overwriting the features, this operation also updates the data of the item used to published this layer.
- Parameters
data – path to data_file used to overwrite the hosted feature layer collection
- Returns
JSON message as dictionary such as {‘success’:True} or {‘error’:’error message’}
-
property
properties
¶ The properties of this object
-
refresh
()¶ refreshes a feature layer collection
-
update_definition
(json_dict)¶ The update_definition operation supports updating a definition property in a hosted feature layer collection service. The result of this operation is a response indicating success or failure with error code and description.
- Input:
- json_dict - part to add to host service. The part format can
be derived from the properties property. For layer level modifications, run updates on each individual feature service layer object.
- Output:
JSON Message as dictionary
-
FeatureLayerManager¶
-
class
arcgis.features.managers.
FeatureLayerManager
(url, gis=None)¶ Allows updating the definition (if access permits) of a feature layer. This class is not created by users directly. An instance of this class, called ‘manager’, is available as a property of the FeatureLayer object, if the layer can be managed by the user. Users call methods on this ‘manager’ object to manage the feature layer.
-
add_to_definition
(json_dict)¶ The addToDefinition operation supports adding a definition property to a hosted feature layer. The result of this operation is a response indicating success or failure with error code and description.
This function will allow users to change add additional values to an already published service.
- Input:
- json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For layer level modifications, run updates on each individual feature service layer object.
- Output:
JSON message as dictionary
-
delete_from_definition
(json_dict)¶ The deleteFromDefinition operation supports deleting a definition property from a hosted feature layer. The result of this operation is a response indicating success or failure with error code and description. See: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Delete_From_Definition_Feature_Service/02r30000021w000000/ # noqa for additional information on this function. Input:
- json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For layer level modifications, run updates on each individual feature service layer object. Only include the items you want to remove from the FeatureService or layer.
- Output:
JSON Message as dictionary
-
classmethod
fromitem
(item, layer_id=0)¶ Creates a FeatureLayerManager object from a GIS Item. The type of item should be a ‘Feature Service’ that represents a FeatureLayerCollection. The layer_id is the id of the layer in feature layer collection (feature service).
-
property
properties
¶ The properties of this object
-
refresh
()¶ refreshes a service
-
truncate
(attachment_only=False, asynchronous=False, wait=True)¶ The truncate operation supports deleting all features or attachments in a hosted feature service layer. The result of this operation is a response indicating success or failure with error code and description. See: http://resources.arcgis.com/en/help/arcgis-rest-api/#/Truncate_Feature_Layer/02r3000002v0000000/ # noqa for additional information on this function. Input:
- attachment_only - Deletes all the attachments for this layer.
None of the layer features will be deleted when attachmentOnly=true.
- asynchronous - Supports options for asynchronous processing. The
default format is false. It is recommended to set async=true for larger datasets.
- wait - if async, wait to pause the process until the async
operation is completed.
- Output:
JSON Message as dictionary
-
update_definition
(json_dict)¶ The updateDefinition operation supports updating a definition property in a hosted feature layer. The result of this operation is a response indicating success or failure with error code and description.
- Input:
- json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For layer level modifications, run updates on each individual feature service layer object.
- Output:
JSON Message as dictionary
-
VersionManager¶
-
class
arcgis.features._version.
VersionManager
(url, gis, flc=None)¶ VersionManager allows users to manage the branch versioning for FeatureLayerCollection services. The Version Management Service is responsible for exposing the management capabilities necessary to support feature services that work with branch versioned datasets.
See the following for more information: https://developers.arcgis.com/rest/services-reference/version-management-service.htm
Argument
Description
url
Required String. The URI to the web resource.
gis
Required GIS. The enterprise connection to the Portal site.
flc
Optional FeatureLayerCollection. This is the parent container that the branch versioning is enabled on.
-
property
all
¶ returns all visible versions on a service
-
create
(name, permission='public', description='')¶ Create the named version off of DEFAULT. The version is associated with the specified feature service. During creation, the description and access (default is public) may be optionally set.
Argument
Description
name
Required String. The name of the version
permission
Optional String. The access permissions of the new version. The default access permission is public.
Values: private, public, protected, or hidden
description
Optional String. The description of the new version
- Returns
Boolean
-
get
(version, mode=None)¶ Finds and Locations a Version by it’s name
Argument
Description
version
Required String. This is the name of the version to locate.
mode
Optional String. This allows users to get a version in a specific state of edit or read. If None is provided (default) the version is created without entering a mode.
Values:
edit - starts editting mode
read - starts reading mode
None - no mode is started. This is default.
-
property
locks
¶ For the specified feature service, return the versions which are locked.
- Returns
List of locked versions
-
property
properties
¶ returns the service properties
-
purge
(version, owner=None)¶ Removes a lock from a version
Argument
Description
version
Required String. The name of the version that is locked.
owner
Required String. The owner of the lock. (Deprecated)
- Returns
Boolean
-
search
(owner=None, show_hidden=False)¶ For the specified feature service, return the info of all versions that the client has access to. If the client is the service owner (the user that published the service), all versions are accessible and will be returned.
Argument
Description
owner
Optional String. A filter the versions by the owner.
show_hidden
Optional Boolean. If False (default) hidden versions will not be returned.
- Returns
dict
-
property
Version¶
-
class
arcgis.features._version.
Version
(url, flc, gis=None, session_guid=None, mode=None)¶ A Version represents a single branch in the version tree.
Argument
Description
url
Required String. The URI to the web resource.
gis
Required GIS. The enterprise connection to the Portal site.
flc
Optional FeatureLayerCollection. This is the parent container that the branch versioning is enabled on.
session_guid
Optional String. If a GUID is known for specific version, a user can specify it.
mode
Optional String. If a user wants to start either editing or reading on creation of the Version, it can be specified here. This is useful when a user is using the Version with a with statement.
Allowed Values:
edit - starts an edit session
read - starts a read session
-
alter
(owner=None, version=None, description=None, permission=None)¶ The
`alter`
operation changes the geodatabase version’s name, description, and access permissions.Argument
Description
owner
Optional String. The new name of the owner.
version
Optional String. The new name of the version.
permission
Optional String. The new access level of the version.
Values: private, public, protected, or hidden
description
Optional String. The description of the new version
- Returns
Boolean
-
conflicts
()¶ The
`conflicts`
operation allows you to view the conflicts by layer and type (update-update, update-delete, delete-update) that were identified during the last Reconcile operation. The features that are in conflicts will also be returned as they existed in the branch, ancestor, and default versions.
-
delete
()¶ Deletes the current version
- Returns
Boolean
-
delete_forward_edits
(moment)¶ If the input moment does not match a specific moment (a moment corresponding to an edit operation), the call will return an error. The client app must correctly manage the edit session’s edit operations moments (for example, the undo/redo stack) and not blindly pass in a timestamp that could mistakenly delete all the forward moments. Thus, the input moment must be equal to a moment in which an edit operation for the version was applied. The call will also fail if the session does not have a write lock on the version.
Argument
Description
moment
Required String. Moment representing the new tail of the version; all forward moments will be trimmed.
- Returns
Boolean
-
differences
(result_type)¶ The
`differences`
operation allows you to view differences between the current version and the default version. The two versions can be compared to check for the following conditions.Inserts - features that are present in the current version but not the default version
Updates - features that have different attributes or geometry in the current version than the default version
Deletions - features that are present in the default version but not in the current version
Both differences and conflicts will be returned. It is the clients responsibility to determine which are differences, and which are conflicts.
- Returns
dict
-
edit
(layer, adds=None, updates=None, deletes=None, use_global_ids=False, rollback_on_failure=True)¶ The edit operation allows users to apply changes to the current version. The edit session must be in the mode of edit or an exception will be raised.
Inputs
Description
layer
Required FeatureLayer. The layer to perform the edit on.
adds
Optional FeatureSet/List. The array of features to be added.
updates
Optional FeatureSet/List. The array of features to be updateded.
deletes
Optional FeatureSet/List. string of OIDs to remove from service
use_global_ids
Optional boolean. Instead of referencing the default Object ID field, the service will look at a GUID field to track changes. This means the GUIDs will be passed instead of OIDs for delete, update or add features.
rollback_on_failure
Optional boolean. Optional parameter to specify if the edits should be applied only if all submitted edits succeed. If false, the server will apply the edits that succeed even if some of the submitted edits fail. If true, the server will apply the edits only if all edits succeed. The default value is true.
- Returns
dictionary
-
inspect
(conflicts, inspect_all=False, set_inspected=False)¶ The
`inspect`
operation allows the client to annotate conflicts from the conflict set that was obtained during the last reconcile operation. Users can mark the conflicts as being inspected; additionally, a description or note can be associated with the conflict.Argument
Description
conflicts
Required List. The conflicts that are being inspected (removed) from the conflict set.
Parameter Format:
- [
- {
“layerId” : <layerId>, “features” : [
- {
“objectId” : <objectId>, “note” : string
}
]
}
]
The objectId key is required. The note parameter is optional.
inspect_all
Optional Boolean. This parameter, if true, will mark all conflicts as being inspected.
set_inspected
Optional Boolean. If True, the examined values will be set to inspected. If
`inspect_all`
is True, this parameter is ignored.- Returns
Boolean
-
property
layers
¶ returns the layers in the FeatureLayerCollection
-
property
mode
¶ The mode allows versoin editors to start and stop edit, read, or view mode.
Allowed Values:
edit - calls the start_editing method and creates a lock
read - calls the start_reading method and creates a lock
None - terminates all sessions and lets a user view the version information (default)
-
property
parcel_fabric
¶ Provides access to a parcel fabric manager
- Returns
ParcelFabricManager
-
post
()¶ The Post operation allows the client to post the changes in their branch to the default version. The client can only post changes if the branch version has not been modified since the last reconcile. If the default version has been modified in the interim, the client will have to reconcile again before posting.
- Returns
Boolean
-
property
properties
¶ returns the service properties
-
reconcile
(end_with_conflict=False, with_post=False)¶ Reconcile a version against the DEFAULT version. The reconcile operation requires that you are the only user currently editing the version and the only user able to edit the version throughout the reconcile process until you save or post. The reconcile operation requires that you have full permissions to all the feature classes that have been modified in the version being edited. The reconcile operation detects differences between the branch version and the default version and flags these differences as conflicts. If conflicts exist, they should be resolved.
Argument
Description
end_with_conflict
Optional Boolean. Specifies if the reconcile should abort when conflicts are found. The default is False
with_post
Optional Boolean. If True the with_post causes a post of the current version following the reconcile.
-
property
save_edits
¶ Get/Set the Property to Save the Changes.
When set to true, any edits performed on the version will be saved.
-
start_editing
()¶ Starts an edit session for the current user.
- Returns
boolean
-
start_reading
()¶ Start reading represents a long-term service session. When start_reading is enabled, it will prevent other users from editing or reconciling the version.
- Returns
Boolean
-
stop_editing
(save=None)¶ Starts an edit session for the current user.
Argument
Description
save
Optional Boolean. States if the values should be saved. If the value is set, the save_edits property will be overrided.
- Returns
boolean
-
stop_reading
()¶ Stops and releases a reading session.
- Returns
Boolean
-
property
utility
¶ provides access to the utility service manager
-
property
validation
¶ Provides access to a validation manager.
- Returns
ValidationManager
ParcelFabricManager¶
-
class
arcgis.features._parcel.
ParcelFabricManager
(url, gis, version, flc)¶ The Parcel Fabric Server is responsible for exposing parcel management capabilities to support a variety of workflows from different clients and systems.
Argument
Description
url
Required String. The URI to the service endpoint.
gis
Required GIS. The enterprise connection.
version
Required Version. This is the version object where the modification will occur.
flc
Required FeatureLayerCollection. This is the parent container for ParcelFabricManager.
-
assign_to_record
(features, record, write_attribute, moment=None)¶ Assigns the specified parcel features to the specified record. If parcel polygons are assigned, the record polygon will be updated to match the cumulative geometry of all the parcels associated to it. The Created By Record or Retired By Record attribute field of the parcel features is updated with the global ID of the assigned record.
Argument
Description
features
Required List. The parcel features to assign to the specified record. Can be parcels, parcel polygons, parcel points, and parcel lines.
Syntax: parcelFeatures=[{“id”:”<guid>”,”layerId”:”<layerID>”},{…}]
record
Required String. The record that will be assigned to the specified parcel features.
write_attribute
Required String. Represents the record field to update on the parcel features. Either the Created By Record or Retired By Record field is to be updated with the global ID of the assigned record.
Allowed Values: CreatedByRecord or RetiredByRecord
moment
Optional Integer. This should only be specified by the client when they do not want to use the current moment
- Returns
Boolean
-
build
(extent=None, moment=None, return_errors=False, record=None)¶ A build will fix known parcel fabric errors.
For example, if a parcel polygon exists without lines, then build will construct the missing lines. If lines are missing, the polygon row(s) are created. When constructing this objects, build will attribute the related keys as appropriate. Build also maintains lineage and record features. The parcel fabric must have sufficient information for build to work correctly. Ie, source reference document, and connected lines.
Build provides options to increase performance. The process can just work on specific parcels, geometry types or only respond to parcel point movement in the case of an adjustment.
Argument
Description
extent
Optional Envelope. The extent to build.
- Syntax: {“xmin”:X min,”ymin”: y min, “xmax”: x max, “ymax”: y max,
“spatialReference”: <wkt of spatial reference>}
moment
Optional String. This should only be specified by the client when they do not want to use the current moment
return_errors
Optional Boolean. If True, a verbose response will be given if errors occured. The default is False. Deprecated
record
Optional String. Represents the record identifier (guid). If a record guid is provided, only parcels associated to the record are built, regardless of the build extent.
- Returns
Boolean
-
change_type
(parcels, target_type, parcel_subtype=0, moment=None)¶ Changes a set of parcels to a new parcel type. It creates new polygons and lines and deletes them from the source type. This is used when a parcel was associated in the wrong parcel type subtype and/or when creating multiple parcels as part of a build process. Example: when lot parcels are created as part of a subdivision, the road parcel is moved to the encumbrance (easement) parcel type.
Argument
Description
parcels
Required List. Parcels list that will change type
target_type
Required String. The target parcel layer
target_subtype
Optional Integer. Target parcel subtype. The default is 0 meaning no subtype required.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
- Returns
Dictionary
-
clip
(parent_parcels, clip_record=None, clipping_parcels=None, geometry=None, moment=None, option=None, area_unit=None)¶ Clip cuts a new child parcel into existing parent parcels. Commonly it retires the parent parcel(s) it cuts into to generate a reminder child parcel. This type of split is often part of a parcel split metes and bounds record driven workflow.
Argument
Description
parent_parcels
parent parcels that will be clipped into. Syntax: parentParcels= <parcel (guid)+layer (name)…>
clip_record
Optional String. It is the GUID for the active legal record.
clipping_parcels
Optional List. A list of child parcels that will be used to clip into the parent parcels. Parcel lineage is created if the child ‘clipping_parcels’ and the parcels being clipped are of the same parcel type.
Syntax: clippingParcels= < id : parcel guid, layered: <layer id>…>
Example:
[{“id”:”{D01D3F47-5FE2-4E39-8C07-E356B46DBC78}”,”layerId”:”16”}]
Either clipping_parcels or geometry is required.
geometry
Optional Polygon. Allows for the clipping a parcel based on geometry instead of ‘clippingParcels’ geometry. No parcel lineage is created.
Either clipping_parcels or geometry is required.
moment
Optional String. This should only be specified by the client when they do not want to use the current moment
option
Optional String. Represents the type of clip to perform:
PreserveArea - Preserve the areas that intersect and discard the remainder areas. (default)
DiscardArea - Discard the areas that intersect and preserve the remainder areas.
PreserveBothAreasSplit - Preserve both the intersecting and remainder areas.
area_unit
Optional String. Area units to be used when calculating the stated areas of the clipped parcels. The stated area of the clipped parcels will be calculated if the stated areas exist on the parent parcels being clipped.
- Returns
Dictionary
-
copy_lines_to_parcel_type
(parent_parcels, record, target_type, moment=None, mark_historic=False, use_source_attributes=False, attribute_overrides=None, use_polygon_attributes=False, parcel_subtype=None)¶ Copy lines to parcel type is used when the construction of the child parcel is based on parent parcel geometry. It creates a copy of the parent parcels lines that the user can modify (insert, delete, update) before they build the child parcels. If the source parcel type and the target parcel type are identical (common) parcel lineage is created.
Argument
Description
parent_parcels
Required String. Parcel parcels from which lines are copied.
record
Required String. The unique identifier (guid) of the active legal record.
target_type
Required String. The target parcel layer to which the lines will be copied to.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
mark_historic
Optional Boolean. Mark the parent parcels historic. The default is False.
use_source_attributes
Optional Boolean. If the source and the target line schema match, attributes from the parent parcel lines will be copied to the new child parcel lines when it is set to True. The default is False.
use_polygon_attributes
Optional Boolean. Parameter representing whether to preserve and transfer attributes of the parent parcels to the generated seeds.
attribute_overrides
Optional Dictionary. To set fields on the child parcel lines with a specific value. Uses a key/value pair of FieldName/Value.
Example:
{‘type’ : “PropertySet”, “propertySetItems” : []}
parcel_subtype
Optional Integer. Represents the target parcel subtype.
- Returns
boolean
-
create_seeds
(record, moment=None, extent=None)¶ Create seeds creates parcel seeds for closed loops of lines that are associated with the specified record.
When building parcels from lines, parcel seeds are used. A parcel seed is the initial state or seed state of a parcel. A parcel seed indicates to the build process that a parcel can be built from the lines enclosing the seed.
A parcel seed is a minimized polygon feature and is stored in the parcel type polygon feature class.
Argument
Description
record
Required String. A GUID representing the record that will be assigned to the features set as current or historic.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
extent
Optional Dict/arcgis.Geometry.Envelope. The envelope of the extent in which to create seeds.
- Returns
Dictionary
-
delete
(parcels, moment=None)¶ Delete a set of parcels, removing associated or unused lines, and connected points.
Argument
Description
parcels
Required List. The parcels to erase.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
- Returns
Boolean
-
duplicate
(parcels, parcel_type, record, parcel_subtype=None, moment=None)¶ duplicate allows for the cloning of parcels from a specific record.
Parcels can be duplicated in the following ways:
Duplicate to a different parcel type.
Duplicate to a different subtype in the same parcel type.
Duplicate to a different subtype in a different parcel type.
Similarly, parcel seeds can be duplicated to subtypes and different parcel types.
Argument
Description
parcels
Required List. A list of parcels to duplicate.
- Syntax
`python [{"id":"<parcelguid>","layerId":"16"},{...}] `
parcel_type
Required Integer. The target parcel type.
record
Required String. A GUID representing the record that will be assigned to the features set as current or historic.
parcel_subtype
Optional Integer. The target parcel subtype. The default is 0.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
- Returns
Dictionary
-
property
layer
¶ returns the Parcel Layer for the service
-
merge
(parent_parcels, target_parcel_type, attribute_overrides=None, child_name=None, default_area_unit=None, merge_record=None, merge_into=None, moment=None)¶ Merge combines 2 or more parent parcels into onenew child parcel. Merge sums up legal areas of parent parcels to the new child parcel legal area (using default area units as dictated by client). The child parcel lines arecomposed from the outer boundaries of the parent parcels. Merge can create multipart parcels as well as proportion lines (partial overlap of parent parcels). Record footprint is updated to match the child parcel.
Argument
Description
parent_parcels
Required String. It is the parcel(guid)+layer(name) identifiers to merge.
target_parcel_type
Required String. Layer where parcel is merged to. History is created when parents and child are of the same parcel type
attribute_overrides
Optional List. A list of attributes to set on the child parcel, if they exist. Pairs of field name and value.
Syntax: attributeOverrides= [{ “type”:”PropertySet”,”propertySetItems”:[<field name>,<field value>]}]
to set subtype, include subtype value in this list.
child_name
Optional String. A descript of the child layer. DEPRECATED
default_area_unit
Optional String. The area units of the child parcel.
merge_record
Optional String. Record identifier (guid). If missing, no history is created.
merge_into
Optional String. A parcel identifier (guid). Invalid to have a record id.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
area_unit
Optional Integer. Represents the default area units to be used when calculating the stated area of the merged parcel. The stated area of the merged parcel will be calculated if the stated areas exist on the parcels being merged.
attribute_overrides
Optional Dict. Represents a list of attributes to set on the new merged parcel.
Syntax: attribute_overrides={“type”:”PropertySet”, “propertySetItems”:[“<FieldName>”,<value>,
“<FieldName>”,<value>,…..,”IsSeed”,0]}
- Returns
Dictionary
-
property
properties
¶ returns the properties of the service
-
update_history
(features, record, moment=None, set_as_historic=False)¶ Sets the specified parcel features to current or historic using the specified record. If setting current parcels as historic, the Retired By Record field of the features is updated with the Global ID of the specified record. If setting historic parcels as current, the Created By Record field of the features is updated with the Global ID of the specified record.
Argument
Description
features
Required List. The parcel features to be set as historic or current. Can be parcels, parcel polygons, parcel points, and parcel lines.
Syntax:
`features=[{"id":"<guid>","layerId":"<layerID>"},{...}]`
record
Required String. A GUID representing the record that will be assigned to the features set as current or historic.
moment
Optional String. This parameter represents the session moment (the default is the version current moment). This should only be specified by the client when they do not want to use the current moment.
set_as_historic
Optional Boolean. Boolean parameter representing whether to set the features as historic (true). If false, features will be set as current.
- Returns
Dictionary
-
UtilityNetworkManager¶
-
class
arcgis.features._utility.
UtilityNetworkManager
(url, version, gis=None)¶ The Utility Network Service exposes analytic capabilities (tracing) as well as validation of network topology and management of subnetworks (managing sources, updating subnetworks, exporting subnetworks, and so on). The Utility Network Service is conceptually similar to the Network Analysis Service for transportation networks.
Inputs
Description
url
Required String. The web endpoint to the utility service.
version
Required Version. The Version class where the branch version will take place.
gis
Optional GIS. The GIS connection object.
-
apply_overrides
(adds=None, deletes=None)¶ Network attributes support the ability to have their values overridden without having to edit features and validate the network topology (build the index). The utility network also supports the ability to place ephemeral connectivity (for example, jumpers in an electrical network) between two devices or junctions without having to edit features or connectivity associations and validate the network topology (build the index). When specified by the client, a trace operation may optionally incorporate the network attribute and connectivity override values when the trace is run on.
-
disable_subnetwork_controller
(network_source_id, global_id, terminal_id)¶ A subnetwork controller (or simply, a source or a sink) is the origin (or destination) of resource flow for a subpart of the network. Examples of subnetwork controllers are circuit breakers in electric networks, or town border stations in gas networks. Subnetwork controllers correspond to devices that have the Subnetwork Controller network capability set. A source is removed with disable_subnetwork_controller.
-
disable_topology
()¶ Disables the network topology for a utility network. When the topology is disabled, feature and association edits do not generate dirty areas. Analytics and diagram generation can’t be performed if the topology is not present.
When the topology is disabled, the following happens:
All current rows in the topology tables are deleted.
No dirty areas are generated from edits.
Remaining error features still exist and can be cleaned up without the overhead of dirty areas.
To perform certain network configuration tasks, the network topology must be disabled.
This operation must be executed by the portal utility network owner.
The topology can be disabled in the default version or in a named version.
- Returns
Dictionary
-
enable_subnetwork_controller
(network_source_id, global_id, terminal_id, subnetwork_controller_name, tier_name, subnetwork_name=None, description=None, notes=None)¶ A subnetwork controller is the origin (or destination) of resource flow for a subpart of the network (e.g., a circuit breaker in electric networks, or a town border station in gas networks). Controllers correspond to Devices that have the Subnetwork Controller network capability set.
-
enable_topology
(error_count=10000)¶ Enabling the network topology for a utility network is done on the DEFAULT version. Enabling is not supported in named versions. When the topology is enabled, all feature and association edits generate dirty areas, which are then consumed when the network topology is updated.
Argument
Description
error_count
Optional Integer. Sets the threshold when the enable_topology will stop if the maximum number of errors is met. The default value is 10,000.
- Returns
Dictionary
-
export_subnetwork
(domain_name, tier_name, subnetwork_name, trace_configuration=None, export_acknowlegement=False, fields=None, result_type=None, moment=None)¶ The export_subnetwork operation is used to export information about a subnetwork into a JSON file. That information can then be consumed by outside systems such as outage management and asset tracking. The exportSubnetwork operation allows you to delete corresponding rows in the Subnetwork Sources table as long as the IsDeleted attribute is set to True. This indicates a source feeding the subnetwork has been removed.
-
property
properties
¶ returns the properties for the service
-
query_network_moments
(moments_to_return='fullValidateTopology', moment=None)¶ The query_network_moments operation returns the moments related to the network topology and operations against the topology. This includes when the topology was initially enabled, when it was last validated, when the topology was last disabled (and later enabled), and when the definition of the utility network was last modified.
-
query_overrides
(attribute_ids=None, all_attributes=False, all_connectivity=False)¶ Network attributes support the ability to have their values overridden without having to edit features and validate the network topology (build the index). The utility network also supports the ability to place ephemeral connectivity (e.g., jumpers in an electrical network) between two devices or junctions without having to edit features or connectivity associations and validate the network topology (build the index). This operation allows the client to query all the overrides associated with the network attributes (by network attribute id). In addition, all connectivity overrides are returned.
-
synthesize_association_geometries
(attachment_associations=False, connectivity_associations=False, containment_associations=False, count=200, extent=False, out_sr=None, moment=None)¶ The synthesize_association_geometries operation is used to export geometries representing associations that are synthesized as line segments corresponding to the geometries of the devices at the endpoints. All features associated with an association must be in the specified extent in order for the geometry to be synthesized. If only zero or one of the devices/junctions intersects the extent, then no geometry will be synthesized.
-
trace
(locations, trace_type, fields=None, moment=None, configuration=None, result_type=None)¶ A trace refers to a pre-configured algorithm that systematically travels a network to return results. Generalized traces allow you to trace across multiple types of domain networks. For example, running a Connected trace from your electric network through to your gas network. An assortment of options is provided with trace to support various analytic work flows. All traces use the network topology to read cached information about network features. This can improve performance of complex traces on large networks. Trace results are not guaranteed to accurately represent a utility network when dirty areas are present. The network topology must be validated to ensure it reflects the most recent edits or updates made to the network.
-
update_is_connected
()¶ Utility network features have an attribute called IsConnected that lets you know if a feature is connected to a source or sink, and therefore it could potentially be part of an existing subnetwork. The update_is_connected operation updates this attribute on features in the specified utility network. This operation can only be executed on the default version by the portal utility network owner.
-
update_subnetwork
(domain_name, tier_name, subnetwork_name=None, all_subnetwork_tier=False, continue_on_failure=False, trace_configuration=None)¶ A subnetwork is updated by calling the update_subnetwork operation. With this operation, one or all of the subnetworks in a single tier can be updated. When a subnetwork is updated, four things can occur; the Subnetwork Name attribute is updated for all features in the subnetwork, the record representing the subnetwork inside the SubnetLine class is refreshed, the Subnetworks table is updated and finally diagrams are generated or updated for the subnetwork.
- Returns
Boolean
-
validate_topology
(envelope, run_async=False, return_edits=False)¶ Validating the network topology for a utility network maintains consistency between feature editing space and network topology space. Validating a network topology may include all or a subset of the dirty areas present in the network. Validation of network topology is supported synchronously and asynchronously.
- Returns
Dictionary
-
ValidationManager¶
-
class
arcgis.features._validation.
ValidationManager
(url, version=None, gis=None)¶ The Validation Server is responsible for exposing the management capabilities necessary to support evaluation of geodatabase rules.
-
evaluate
(evaluation, area=None, changes_in_version=False, selection=None, return_edits=False)¶ Runs the topology rules and returns new errors if they exist.
Argument
Description
evaluation
Required List of Strings. An array of evaluation types. Allowed Rule Types: validation, calculation and/or topology
area
Optional Envelope/Dict. Extent area to evaluate.
changes_in_version
Optional Boolean. representing whether to perform the evaluation on the features that have changed in the version (default is false). Does not apply to the DEFAULT version.
When set to true, the evaluationDate property for the version is updated. This is listed as a property for a version and can be accessed using the version resource and the version infos operation.
selection
Optional List. A set of features to evaluate. This is an array of layers and the global IDs or Object IDs of the features to examine.
If the evaluation_type is topology this parameter is ignored.
Syntax
``` [
- {
“id” : <layerId1>, “globalIds” : [ <globalId> ], “objectIds” : [ <objectId> ]
}, {
“id” : <layerId2>, “globalIds” : [ <globalId> ]. “objectIds” : [ <objectId> ]
}
return_edits
Optional Boolean. returns features edited due to feature evaluation. Results returned are organized in a layer by layer fashion. If return_edits is set to true, each layer may have edited features returned.
The default for this parameter is false. Always set to true when evaluating topology for a parcel fabric.
- Returns
dictionary
-
property
properties
¶ service properties
-
update_error
(error_features, version=None, **kwargs)¶ Updates errors on the validation tables.
Argument
Description
error_features
Required List. The error features to be updated.
Syntax
``` [
- {
- “errorType”“object” | “point” | “line” |
“polygon”,
- “features”[
- {
“globalId” : <guid>, “fields” : {
“name1” : <value1>, “name2” : <value2>
}
}
]
}
- Returns
dictionary
-