arcgis.features module

The arcgis.features module contains types and functions for working with features and feature layers in the GIS.

Entities located in space with a geometrical representation (such as points, lines or polygons) and a set of properties can be represented as features. The arcgis.features module is used for working with feature data, feature layers and collections of feature layers in the GIS. It also contains the spatial analysis functions which operate against feature data.

In the GIS, entities located in space with a set of properties can be represented as features. Features are stored as feature classes, which represent a set of features located using a single spatial type (point, line, polygon) and a common set of properties. This is the geographic extension of the classic tabular or relational representation for entities - a set of entities is modelled as rows in a table. Tables represent entity classes with uniform properties. In addition to working with entities with location as features, the system can also work with non-spatial entities as rows in tables. The system can also model relationships between entities using properties which act as primary and foreign keys. A collection of feature classes and tables, with the associated relationships among the entities, is a feature layer collection. FeatureLayerCollections are one of the dataset types contained in a Datastore. Finally, features are not simply entities in a dataset. Features have a visual representation and user experience - on a map, in a 3D scene, as entities with a property sheet or popups.

Feature

class arcgis.features.Feature(geometry=None, attributes=None)

Entities located in space with a set of properties can be represented as features.

# Obtain a feature from a feature layer:

feat_set = feature_layer.query(where="OBJECTID=1")
feat = feat_set[0]
as_dict
Returns:the feature as a dictionary
as_row
Returns:the feature as a tuple containing two lists:
List of: Description
row values the specific attribute values and geometry for this feature
field names the name for each attribute field
attributes
Returns:a dictionary of feature attribute values with field names as the key
fields
Returns:attribute field names for the feature as a list of strings
classmethod from_dict(feature)
Returns:a feature from a dict
classmethod from_json(json_str)
Returns:a feature from a JSON string
geometry
Returns:the feature geometry
geometry_type
Returns:the geometry type of the feature as a string
get_value(field_name)

Retrieves the value for a specified field name

Argument   Description
field name  
Required String. The name of the field to get the value for.

feature.fields will return a list of all field names.
Returns:value for the specified attribute field of the feature.
set_value(field_name, value)

Sets an attribute value for a given field name

Argument Description
field_name Required String. The name of the field to update.
value Required. Value to update the field with.
Returns:boolean indicating whether field_name value was updated.

FeatureLayer

class arcgis.features.FeatureLayer(url, gis=None, container=None, dynamic_layer=None)

The feature layer is the primary concept for working with features in a GIS.

Users create, import, export, analyze, edit, and visualize features, i.e. entities in space as feature layers.

Feature layers can be added to and visualized using maps. They act as inputs to and outputs from feature analysis tools.

Feature layers are created by publishing feature data to a GIS, and are exposed as a broader resource (Item) in the GIS. Feature layer objects can be obtained through the layers attribute on feature layer Items in the GIS.

append(item_id=None, upload_format='featureCollection', source_table_name=None, field_mappings=None, edits=None, source_info=None, upsert=True, skip_updates=False, use_globalids=False, update_geometry=True, append_fields=None, rollback=False, skip_inserts=None, upsert_matching_field=None)

Only available in AGOL

Update an existing hosted feature layer using append.

Argument Description
source_table_name optional string. Required only when the source data contains more than one tables, e.g., for filegdb. Example: source_tabl_name= “Building”
item_id optional string. The ID for the Portal item that contains the source file. Used in conjunction with editsUploadFormat.
field_mappings

optional list. Used to map source data to a destination layer. Syntax: fieldMappings=[{“name” : <”targerName”>,

“sourceName” : < “sourceName”>}, …]
Examples: fieldMappings=[{“name” : “CountyID”,
“sourceName” : “GEOID10”}]
edits optional string. Only feature collection json is supported. Append supports all format through the upload_id or item_id.
source_info optional dictionary. This is only needed when appending data from excel or csv. The appendSourceInfo can be the publishing parameter returned from analyze the csv or excel file.
upsert optional boolean. Optional parameter specifying whether the edits needs to be applied as updates if the feature already exists. Default is false.
skip_updates Optional boolean. Parameter is used only when upsert is true.
use_globalids Optional boolean. Specifying whether upsert needs to use GlobalId when matching features.
update_geometry Optional boolean. The parameter is used only when upsert is true. Skip updating the geometry and update only the attributes for existing features if they match source features by objectId or globalId.(as specified by useGlobalIds parameter).
append_fields Optional list. The list of destination fields to append to. This is supported when upsert=true or false. Values: [“fieldName1”, “fieldName2”,….]
upload_format required string. The source append data format. The default is featureCollection format. Values: sqlite | shapefile | filegdb | featureCollection | geojson | csv | excel
rollback Optional boolean. Optional parameter specifying whether the upsert edits needs to be rolled back in case of failure. Default is false.
skip_inserts Used only when upsert is true. Used to skip inserts if the value is true. The default value is false.
upsert_matching_field Optional string. The layer field to be used when matching features with upsert. ObjectId, GlobalId, and any other field that has a unique index can be used with upsert. This parameter overrides use_globalids; e.g., specifying upsert_matching_field will be used even if you specify use_globalids = True. Example: upsert_matching_field=”MyfieldWithUniqueIndex”
Returns:boolean
calculate(where, calc_expression, sql_format='standard')

The calculate operation is performed on a feature layer resource. It updates the values of one or more fields in an existing feature service layer based on SQL expressions or scalar values. The calculate operation can only be used if the supportsCalculate property of the layer is true. Neither the Shape field nor system fields can be updated using calculate. System fields include ObjectId and GlobalId. See Calculate a field for more information on supported expressions

Inputs Description
where A where clause can be used to limit the updated records. Any legal SQL where clause operating on the fields in the layer is allowed.
calc_expression The array of field/value info objects that contain the field or fields to update and their scalar values or SQL expression. Allowed types are dictionary and list. List must be a list of dictionary objects. Calculation Format is as follows: {“field” : “<field name>”, “value” : “<value>”}
sql_format The SQL format for the calcExpression. It can be either standard SQL92 (standard) or native SQL (native). The default is standard. Values: standard, native
# Usage Example 1:

print(fl.calculate(where="OBJECTID < 2",
                   calc_expression={"field": "ZONE", "value" : "R1"}))
# Usage Example 2:

print(fl.calculate(where="OBJECTID < 2001",
                   calc_expression={"field": "A",  "sqlExpression" : "B*3"}))

Output: dictionary with format {‘updatedFeatureCount’: 1, ‘success’: True}

container

The feature layer collection to which this layer belongs.

delete_features(deletes=None, where=None, geometry_filter=None, gdb_version=None, rollback_on_failure=True)

This operation deletes features in a feature layer or table

Argument Description
deletes Optional string. A comma seperated string of OIDs to remove from the service.
where Optional string. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed. Features conforming to the specified where clause will be deleted.
geometry_filter Optional SpatialFilter. A spatial filter from arcgis.geometry.filters module to filter results by a spatial relationship with another geometry.
gdb_version Optional string. A Geodatabase version to apply the edits.
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:dict
edit_features(adds=None, updates=None, deletes=None, gdb_version=None, use_global_ids=False, rollback_on_failure=True)

This operation adds, updates, and deletes features to the associated feature layer or table in a single call.

Inputs Description
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.
gdb_version Optional boolean. Geodatabase version to apply the edits.
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.

Output: dictionary

classmethod fromitem(item, layer_id=0)

Creates a feature layer 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).

generate_renderer(definition, where=None)

This operation groups data using the supplied definition (classification definition) and an optional where clause. The result is a renderer object. Use baseSymbol and colorRamp to define the symbols assigned to each class. If the operation is performed on a table, the result is a renderer object containing the data classes and no symbols.

Argument Description
definition required dict. The definition using the renderer that is generated. Use either class breaks or unique value classificatoin definitions. See: https://resources.arcgis.com/en/help/rest/apiref/ms_classification.html
where optional string. A where clause for which the data needs to be classified. Any legal SQL where clause operating on the fields in the dynamic layer/table is allowed.
Returns:dictionary
get_html_popup(oid)

The htmlPopup resource provides details about the HTML pop-up authored by the user using ArcGIS for Desktop.

Argument Description
oid Optional string. Object id of the feature to get the HTML popup.
Returns:string
manager

Helper object to manage the feature layer, update it’s definition, etc

properties

The properties of this object

query(where='1=1', out_fields='*', time_filter=None, geometry_filter=None, return_geometry=True, return_count_only=False, return_ids_only=False, return_distinct_values=False, return_extent_only=False, group_by_fields_for_statistics=None, statistic_filter=None, result_offset=None, result_record_count=None, object_ids=None, distance=None, units=None, max_allowable_offset=None, out_sr=None, geometry_precision=None, gdb_version=None, order_by_fields=None, out_statistics=None, return_z=False, return_m=False, multipatch_option=None, quantization_parameters=None, return_centroid=False, return_all_records=True, result_type=None, historic_moment=None, sql_format=None, return_true_curves=False, return_exceeded_limit_features=None, **kwargs)

Queries a feature layer based on a sql statement

Argument Description
where Optional string. The default is 1=1. The selection sql statement.
out_fields Optional string. The attribute fields to return. The default is “*”.
object_ids Optional string. The object IDs of this layer or table to be queried. The object ID values are comma seperate string.
distance Optional integer. The buffer distance for the input geometries. The distance unit is specified by units. For example, if the distance is 100, the query geometry is a point, units is set to meters, and all points within 100 meters of the point are returned.
units

Optional string. The unit for calculating the buffer distance. If unit is not specified, the unit is derived from the geometry spatial reference. If the geometry spatial reference is not specified, the unit is derived from the feature service data spatial reference. This parameter only applies if supportsQueryWithDistance is true. Values: esriSRUnit_Meter | esriSRUnit_StatuteMile |

esriSRUnit_Foot | esriSRUnit_Kilometer | esriSRUnit_NauticalMile | esriSRUnit_USNauticalMile
time_filter

Optional list. The format is of [<startTime>, <endTime>] using datetime.date, datetime.datetime or timestamp in milliseconds. Syntax: time_filter=[<startTime>, <endTime>] ; specified as

datetime.date, datetime.datetime or timestamp in milliseconds
geometry_filter Optional from arcgis.geometry.filter. Allows for the information to be filtered on spatial relationship with another geometry.
max_allowable_offset Optional float. This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of out_sr. If out_sr is not specified, max_allowable_offset is assumed to be in the unit of the spatial reference of the layer.
out_sr Optional Integer. The WKID for the spatial reference of the returned geometry.
geometry_precision Optional Integer. This option can be used to specify the number of decimal places in the response geometries returned by the query operation. This applies to X and Y values only (not m or z-values).
gdb_version Optional string. The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer is true. If this is not specified, the query will apply to the published map’s version.
return_geometry Optional boolean. If true, geometry is returned with the query. Default is true.
return_distinct_values Optional boolean. If true, it returns distinct values based on the fields specified in out_fields. This parameter applies only if the supportsAdvancedQueries property of the layer is true.
return_ids_only Optional boolean. Default is False. If true, the response only includes an array of object IDs. Otherwise, the response is a feature set.
return_count_only Optional boolean. If true, the response only includes the count (number of features/records) that would be returned by a query. Otherwise, the response is a feature set. The default is false. This option supersedes the returnIdsOnly parameter. If returnCountOnly = true, the response will return both the count and the extent.
return_extent_only Optional boolean. If true, the response only includes the extent of the features that would be returned by the query. If returnCountOnly=true, the response will return both the count and the extent. The default is false. This parameter applies only if the supportsReturningQueryExtent property of the layer is true.
order_by_fields Optional string. One or more field names on which the features/records need to be ordered. Use ASC or DESC for ascending or descending, respectively, following every field to control the ordering. example: STATE_NAME ASC, RACE DESC, GENDER
group_by_fields_for_statistics Optional string. One or more field names on which the values need to be grouped for calculating the statistics. example: STATE_NAME, GENDER
out_statistics

Optional string. The definitions for one or more field-based statistics to be calculated.

Syntax:

[
{
“statisticType”: “<count | sum | min | max | avg | stddev | var>”, “onStatisticField”: “Field1”, “outStatisticFieldName”: “Out_Field_Name1”

}, {

“statisticType”: “<count | sum | min | max | avg | stddev | var>”, “onStatisticField”: “Field2”, “outStatisticFieldName”: “Out_Field_Name2”

}

]

return_z Optional boolean. If true, Z values are included in the results if the features have Z values. Otherwise, Z values are not returned. The default is False.
return_m Optional boolean. If true, M values are included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
multipatch_option Optional x/y footprint. This option dictates how the geometry of a multipatch feature will be returned.
result_offset Optional integer. This option can be used for fetching query results by skipping the specified number of records and starting from the next record (that is, resultOffset + 1th). This option is ignored if return_all_records is True (i.e. by default).
result_record_count Optional integer. This option can be used for fetching query results up to the result_record_count specified. When result_offset is specified but this parameter is not, the map service defaults it to max_record_count. The maximum value for this parameter is the value of the layer’s max_record_count property. This option is ignored if return_all_records is True (i.e. by default).
quantization_parameters Optional dict. Used to project the geometry onto a virtual grid, likely representing pixels on the screen.
return_centroid Optional boolean. Used to return the geometry centroid associated with each feature returned. If true, the result includes the geometry centroid. The default is false.
return_all_records Optional boolean. When True, the query operation will call the service until all records that satisfy the where_clause are returned. Note: result_offset and result_record_count will be ignored if return_all_records is True. Also, if return_count_only, return_ids_only, or return_extent_only are True, this parameter will be ignored.
result_type Optional string. The result_type parameter can be used to control the number of features returned by the query operation. Values: None | standard | tile
historic_moment

Optional integer. The historic moment to query. This parameter applies only if the layer is archiving enabled and the supportsQueryWithHistoricMoment property is set to true. This property is provided in the layer resource.

If historic_moment is not specified, the query will apply to the current features.

sql_format Optional string. The sql_format parameter can be either standard SQL92 standard or it can use the native SQL of the underlying datastore native. The default is none which means the sql_format depends on useStandardizedQuery parameter. Values: none | standard | native
return_true_curves Optional boolean. When set to true, returns true curves in output geometries. When set to false, curves are converted to densified polylines or polygons.
return_exceeded_limit_features

Optional boolean. Optional parameter which is true by default. When set to true, features are returned even when the results include ‘exceededTransferLimit’: True.

When set to false and querying with resultType = tile features are not returned when the results include ‘exceededTransferLimit’: True. This allows a client to find the resolution in which the transfer limit is no longer exceeded without making multiple calls.

kwargs Optional dict. Optional parameters that can be passed to the Query function. This will allow users to pass additional parameters not explicitly implemented on the function. A complete list of functions available is documented on the Query REST API.
Returns:A FeatureSet containing the features matching the query unless another return type is specified, such as count

The Query operation is performed on a feature service layer resource. The result of this operation are feature sets grouped by source layer/table object IDs. Each feature set contains Feature objects including the values for the fields requested by the user. For related layers, if you request geometry information, the geometry of each feature is also returned in the feature set. For related tables, the feature set does not include geometries.

Argument Description
object_ids Required string. The object IDs of the table/layer to be queried
relationship_id Required string. The ID of the relationship to be queried.
out_fields Required string. the list of fields from the related table/layer to be included in the returned feature set. This list is a comma delimited list of field names. If you specify the shape field in the list of return fields, it is ignored. To request geometry, set return_geometry to true. You can also specify the wildcard “*” as the value of this parameter. In this case, the results will include all the field values.
definition_expression Optional string. The definition expression to be applied to the related table/layer. From the list of objectIds, only those records that conform to this expression are queried for related records.
return_geometry Optional boolean. If true, the feature set includes the geometry associated with each feature. The default is true.
max_allowable_offset Optional float. This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of the outSR. If out_wkid is not specified, then max_allowable_offset is assumed to be in the unit of the spatial reference of the map.
geometry_precision Optional integer. This option can be used to specify the number of decimal places in the response geometries.
out_wkid Optional Integer. The spatial reference of the returned geometry.
gdb_version Optional string. The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer queried is true.
return_z Optional boolean. If true, Z values are included in the results if the features have Z values. Otherwise, Z values are not returned. The default is false.
return_m Optional boolean. If true, M values are included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
Returns:dict
validate_sql(sql, sql_type='where')

The validate_sql operation validates an SQL-92 expression or WHERE clause. The validate_sql operation ensures that an SQL-92 expression, such as one written by a user through a user interface, is correct before performing another operation that uses the expression. For example, validateSQL can be used to validate information that is subsequently passed in as part of the where parameter of the calculate operation. validate_sql also prevents SQL injection. In addition, all table and field names used in the SQL expression or WHERE clause are validated to ensure they are valid tables and fields.

Argument Description
sql Required String. The SQL expression of WHERE clause to validate. Example: “Population > 300000”
sql_type
Optional String. Three SQL types are supported in validate_sql
  • where (default) - Represents the custom WHERE clause the user can compose when querying a layer or using calculate.
  • expression - Represents an SQL-92 expression. Currently, expression is used as a default value expression when adding a new field or using the calculate API.
  • statement - Represents the full SQL-92 statement that can be passed directly to the database. No current ArcGIS REST API resource or operation supports using the full SQL-92 SELECT statement directly. It has been added to the validateSQL for completeness. Values: where | expression | statement
Returns:dict

Table

class arcgis.features.Table(url, gis=None, container=None, dynamic_layer=None)

Tables represent entity classes with uniform properties. In addition to working with “entities with location” as features, the GIS can also work with non-spatial entities as rows in tables.

Working with tables is similar to working with feature layers, except that the rows (Features) in a table do not have a geometry, and tables ignore any geometry related operation.

append(item_id=None, upload_format='featureCollection', source_table_name=None, field_mappings=None, edits=None, source_info=None, upsert=True, skip_updates=False, use_globalids=False, update_geometry=True, append_fields=None, rollback=False, skip_inserts=None, upsert_matching_field=None)

Only available in AGOL

Update an existing hosted feature layer using append.

Argument Description
source_table_name optional string. Required only when the source data contains more than one tables, e.g., for filegdb. Example: source_tabl_name= “Building”
item_id optional string. The ID for the Portal item that contains the source file. Used in conjunction with editsUploadFormat.
field_mappings

optional list. Used to map source data to a destination layer. Syntax: fieldMappings=[{“name” : <”targerName”>,

“sourceName” : < “sourceName”>}, …]
Examples: fieldMappings=[{“name” : “CountyID”,
“sourceName” : “GEOID10”}]
edits optional string. Only feature collection json is supported. Append supports all format through the upload_id or item_id.
source_info optional dictionary. This is only needed when appending data from excel or csv. The appendSourceInfo can be the publishing parameter returned from analyze the csv or excel file.
upsert optional boolean. Optional parameter specifying whether the edits needs to be applied as updates if the feature already exists. Default is false.
skip_updates Optional boolean. Parameter is used only when upsert is true.
use_globalids Optional boolean. Specifying whether upsert needs to use GlobalId when matching features.
update_geometry Optional boolean. The parameter is used only when upsert is true. Skip updating the geometry and update only the attributes for existing features if they match source features by objectId or globalId.(as specified by useGlobalIds parameter).
append_fields Optional list. The list of destination fields to append to. This is supported when upsert=true or false. Values: [“fieldName1”, “fieldName2”,….]
upload_format required string. The source append data format. The default is featureCollection format. Values: sqlite | shapefile | filegdb | featureCollection | geojson | csv | excel
rollback Optional boolean. Optional parameter specifying whether the upsert edits needs to be rolled back in case of failure. Default is false.
skip_inserts Used only when upsert is true. Used to skip inserts if the value is true. The default value is false.
upsert_matching_field Optional string. The layer field to be used when matching features with upsert. ObjectId, GlobalId, and any other field that has a unique index can be used with upsert. This parameter overrides use_globalids; e.g., specifying upsert_matching_field will be used even if you specify use_globalids = True. Example: upsert_matching_field=”MyfieldWithUniqueIndex”
Returns:boolean
calculate(where, calc_expression, sql_format='standard')

The calculate operation is performed on a feature layer resource. It updates the values of one or more fields in an existing feature service layer based on SQL expressions or scalar values. The calculate operation can only be used if the supportsCalculate property of the layer is true. Neither the Shape field nor system fields can be updated using calculate. System fields include ObjectId and GlobalId. See Calculate a field for more information on supported expressions

Inputs Description
where A where clause can be used to limit the updated records. Any legal SQL where clause operating on the fields in the layer is allowed.
calc_expression The array of field/value info objects that contain the field or fields to update and their scalar values or SQL expression. Allowed types are dictionary and list. List must be a list of dictionary objects. Calculation Format is as follows: {“field” : “<field name>”, “value” : “<value>”}
sql_format The SQL format for the calcExpression. It can be either standard SQL92 (standard) or native SQL (native). The default is standard. Values: standard, native
# Usage Example 1:

print(fl.calculate(where="OBJECTID < 2",
                   calc_expression={"field": "ZONE", "value" : "R1"}))
# Usage Example 2:

print(fl.calculate(where="OBJECTID < 2001",
                   calc_expression={"field": "A",  "sqlExpression" : "B*3"}))

Output: dictionary with format {‘updatedFeatureCount’: 1, ‘success’: True}

container

The feature layer collection to which this layer belongs.

delete_features(deletes=None, where=None, geometry_filter=None, gdb_version=None, rollback_on_failure=True)

This operation deletes features in a feature layer or table

Argument Description
deletes Optional string. A comma seperated string of OIDs to remove from the service.
where Optional string. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed. Features conforming to the specified where clause will be deleted.
geometry_filter Optional SpatialFilter. A spatial filter from arcgis.geometry.filters module to filter results by a spatial relationship with another geometry.
gdb_version Optional string. A Geodatabase version to apply the edits.
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:dict
edit_features(adds=None, updates=None, deletes=None, gdb_version=None, use_global_ids=False, rollback_on_failure=True)

This operation adds, updates, and deletes features to the associated feature layer or table in a single call.

Inputs Description
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.
gdb_version Optional boolean. Geodatabase version to apply the edits.
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.

Output: dictionary

fromitem(item, layer_id=0)

Creates a feature layer 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).

generate_renderer(definition, where=None)

This operation groups data using the supplied definition (classification definition) and an optional where clause. The result is a renderer object. Use baseSymbol and colorRamp to define the symbols assigned to each class. If the operation is performed on a table, the result is a renderer object containing the data classes and no symbols.

Argument Description
definition required dict. The definition using the renderer that is generated. Use either class breaks or unique value classificatoin definitions. See: https://resources.arcgis.com/en/help/rest/apiref/ms_classification.html
where optional string. A where clause for which the data needs to be classified. Any legal SQL where clause operating on the fields in the dynamic layer/table is allowed.
Returns:dictionary
get_html_popup(oid)

The htmlPopup resource provides details about the HTML pop-up authored by the user using ArcGIS for Desktop.

Argument Description
oid Optional string. Object id of the feature to get the HTML popup.
Returns:string
manager

Helper object to manage the feature layer, update it’s definition, etc

properties

The properties of this object

query(where='1=1', out_fields='*', time_filter=None, geometry_filter=None, return_geometry=True, return_count_only=False, return_ids_only=False, return_distinct_values=False, return_extent_only=False, group_by_fields_for_statistics=None, statistic_filter=None, result_offset=None, result_record_count=None, object_ids=None, distance=None, units=None, max_allowable_offset=None, out_sr=None, geometry_precision=None, gdb_version=None, order_by_fields=None, out_statistics=None, return_z=False, return_m=False, multipatch_option=None, quantization_parameters=None, return_centroid=False, return_all_records=True, result_type=None, historic_moment=None, sql_format=None, return_true_curves=False, return_exceeded_limit_features=None, **kwargs)

Queries a feature layer based on a sql statement

Argument Description
where Optional string. The default is 1=1. The selection sql statement.
out_fields Optional string. The attribute fields to return. The default is “*”.
object_ids Optional string. The object IDs of this layer or table to be queried. The object ID values are comma seperate string.
distance Optional integer. The buffer distance for the input geometries. The distance unit is specified by units. For example, if the distance is 100, the query geometry is a point, units is set to meters, and all points within 100 meters of the point are returned.
units

Optional string. The unit for calculating the buffer distance. If unit is not specified, the unit is derived from the geometry spatial reference. If the geometry spatial reference is not specified, the unit is derived from the feature service data spatial reference. This parameter only applies if supportsQueryWithDistance is true. Values: esriSRUnit_Meter | esriSRUnit_StatuteMile |

esriSRUnit_Foot | esriSRUnit_Kilometer | esriSRUnit_NauticalMile | esriSRUnit_USNauticalMile
time_filter

Optional list. The format is of [<startTime>, <endTime>] using datetime.date, datetime.datetime or timestamp in milliseconds. Syntax: time_filter=[<startTime>, <endTime>] ; specified as

datetime.date, datetime.datetime or timestamp in milliseconds
geometry_filter Optional from arcgis.geometry.filter. Allows for the information to be filtered on spatial relationship with another geometry.
max_allowable_offset Optional float. This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of out_sr. If out_sr is not specified, max_allowable_offset is assumed to be in the unit of the spatial reference of the layer.
out_sr Optional Integer. The WKID for the spatial reference of the returned geometry.
geometry_precision Optional Integer. This option can be used to specify the number of decimal places in the response geometries returned by the query operation. This applies to X and Y values only (not m or z-values).
gdb_version Optional string. The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer is true. If this is not specified, the query will apply to the published map’s version.
return_geometry Optional boolean. If true, geometry is returned with the query. Default is true.
return_distinct_values Optional boolean. If true, it returns distinct values based on the fields specified in out_fields. This parameter applies only if the supportsAdvancedQueries property of the layer is true.
return_ids_only Optional boolean. Default is False. If true, the response only includes an array of object IDs. Otherwise, the response is a feature set.
return_count_only Optional boolean. If true, the response only includes the count (number of features/records) that would be returned by a query. Otherwise, the response is a feature set. The default is false. This option supersedes the returnIdsOnly parameter. If returnCountOnly = true, the response will return both the count and the extent.
return_extent_only Optional boolean. If true, the response only includes the extent of the features that would be returned by the query. If returnCountOnly=true, the response will return both the count and the extent. The default is false. This parameter applies only if the supportsReturningQueryExtent property of the layer is true.
order_by_fields Optional string. One or more field names on which the features/records need to be ordered. Use ASC or DESC for ascending or descending, respectively, following every field to control the ordering. example: STATE_NAME ASC, RACE DESC, GENDER
group_by_fields_for_statistics Optional string. One or more field names on which the values need to be grouped for calculating the statistics. example: STATE_NAME, GENDER
out_statistics

Optional string. The definitions for one or more field-based statistics to be calculated.

Syntax:

[
{
“statisticType”: “<count | sum | min | max | avg | stddev | var>”, “onStatisticField”: “Field1”, “outStatisticFieldName”: “Out_Field_Name1”

}, {

“statisticType”: “<count | sum | min | max | avg | stddev | var>”, “onStatisticField”: “Field2”, “outStatisticFieldName”: “Out_Field_Name2”

}

]

return_z Optional boolean. If true, Z values are included in the results if the features have Z values. Otherwise, Z values are not returned. The default is False.
return_m Optional boolean. If true, M values are included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
multipatch_option Optional x/y footprint. This option dictates how the geometry of a multipatch feature will be returned.
result_offset Optional integer. This option can be used for fetching query results by skipping the specified number of records and starting from the next record (that is, resultOffset + 1th). This option is ignored if return_all_records is True (i.e. by default).
result_record_count Optional integer. This option can be used for fetching query results up to the result_record_count specified. When result_offset is specified but this parameter is not, the map service defaults it to max_record_count. The maximum value for this parameter is the value of the layer’s max_record_count property. This option is ignored if return_all_records is True (i.e. by default).
quantization_parameters Optional dict. Used to project the geometry onto a virtual grid, likely representing pixels on the screen.
return_centroid Optional boolean. Used to return the geometry centroid associated with each feature returned. If true, the result includes the geometry centroid. The default is false.
return_all_records Optional boolean. When True, the query operation will call the service until all records that satisfy the where_clause are returned. Note: result_offset and result_record_count will be ignored if return_all_records is True. Also, if return_count_only, return_ids_only, or return_extent_only are True, this parameter will be ignored.
result_type Optional string. The result_type parameter can be used to control the number of features returned by the query operation. Values: None | standard | tile
historic_moment

Optional integer. The historic moment to query. This parameter applies only if the layer is archiving enabled and the supportsQueryWithHistoricMoment property is set to true. This property is provided in the layer resource.

If historic_moment is not specified, the query will apply to the current features.

sql_format Optional string. The sql_format parameter can be either standard SQL92 standard or it can use the native SQL of the underlying datastore native. The default is none which means the sql_format depends on useStandardizedQuery parameter. Values: none | standard | native
return_true_curves Optional boolean. When set to true, returns true curves in output geometries. When set to false, curves are converted to densified polylines or polygons.
return_exceeded_limit_features

Optional boolean. Optional parameter which is true by default. When set to true, features are returned even when the results include ‘exceededTransferLimit’: True.

When set to false and querying with resultType = tile features are not returned when the results include ‘exceededTransferLimit’: True. This allows a client to find the resolution in which the transfer limit is no longer exceeded without making multiple calls.

kwargs Optional dict. Optional parameters that can be passed to the Query function. This will allow users to pass additional parameters not explicitly implemented on the function. A complete list of functions available is documented on the Query REST API.
Returns:A FeatureSet containing the features matching the query unless another return type is specified, such as count

The Query operation is performed on a feature service layer resource. The result of this operation are feature sets grouped by source layer/table object IDs. Each feature set contains Feature objects including the values for the fields requested by the user. For related layers, if you request geometry information, the geometry of each feature is also returned in the feature set. For related tables, the feature set does not include geometries.

Argument Description
object_ids Required string. The object IDs of the table/layer to be queried
relationship_id Required string. The ID of the relationship to be queried.
out_fields Required string. the list of fields from the related table/layer to be included in the returned feature set. This list is a comma delimited list of field names. If you specify the shape field in the list of return fields, it is ignored. To request geometry, set return_geometry to true. You can also specify the wildcard “*” as the value of this parameter. In this case, the results will include all the field values.
definition_expression Optional string. The definition expression to be applied to the related table/layer. From the list of objectIds, only those records that conform to this expression are queried for related records.
return_geometry Optional boolean. If true, the feature set includes the geometry associated with each feature. The default is true.
max_allowable_offset Optional float. This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of the outSR. If out_wkid is not specified, then max_allowable_offset is assumed to be in the unit of the spatial reference of the map.
geometry_precision Optional integer. This option can be used to specify the number of decimal places in the response geometries.
out_wkid Optional Integer. The spatial reference of the returned geometry.
gdb_version Optional string. The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer queried is true.
return_z Optional boolean. If true, Z values are included in the results if the features have Z values. Otherwise, Z values are not returned. The default is false.
return_m Optional boolean. If true, M values are included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
Returns:dict
validate_sql(sql, sql_type='where')

The validate_sql operation validates an SQL-92 expression or WHERE clause. The validate_sql operation ensures that an SQL-92 expression, such as one written by a user through a user interface, is correct before performing another operation that uses the expression. For example, validateSQL can be used to validate information that is subsequently passed in as part of the where parameter of the calculate operation. validate_sql also prevents SQL injection. In addition, all table and field names used in the SQL expression or WHERE clause are validated to ensure they are valid tables and fields.

Argument Description
sql Required String. The SQL expression of WHERE clause to validate. Example: “Population > 300000”
sql_type
Optional String. Three SQL types are supported in validate_sql
  • where (default) - Represents the custom WHERE clause the user can compose when querying a layer or using calculate.
  • expression - Represents an SQL-92 expression. Currently, expression is used as a default value expression when adding a new field or using the calculate API.
  • statement - Represents the full SQL-92 statement that can be passed directly to the database. No current ArcGIS REST API resource or operation supports using the full SQL-92 SELECT statement directly. It has been added to the validateSQL for completeness. Values: where | expression | statement
Returns:dict

FeatureLayerCollection

class arcgis.features.FeatureLayerCollection(url, gis=None)

A FeatureLayerCollection is a collection of feature layers and tables, with the associated relationships among the entities.

In a web GIS, a feature layer collection is exposed as a feature service with multiple feature layers.

Instances of FeatureDatasets can be obtained from feature service Items in the GIS using FeatureLayerCollection.fromitem(item), from feature service endpoints using the constructor, or by accessing the dataset attribute of feature layer objects.

FeatureDatasets can be configured and managed using their manager helper object.

If the dataset supports the sync operation, the replicas helper object allows management and synchronization of replicas for disconnected editing of the feature layer collection.

Note: You can use the layers and tables property to get to the individual layers and tables in this feature layer collection.

fromitem(item)
manager

helper object to manage the feature layer collection, update it’s definition, etc

properties

The properties of this object

query(layer_defs_filter=None, geometry_filter=None, time_filter=None, return_geometry=True, return_ids_only=False, return_count_only=False, return_z=False, return_m=False, out_sr=None)

queries the feature layer collection

The Query operation is performed on a feature service layer resource. The result of this operation are feature sets grouped by source layer/table object IDs. Each feature set contains Feature objects including the values for the fields requested by the user. For related layers, if you request geometry information, the geometry of each feature is also returned in the feature set. For related tables, the feature set does not include geometries.

Argument Description
object_ids Optional string. the object IDs of the table/layer to be queried.
relationship_id Optional string. The ID of the relationship to be queried.
out_fields Optional string.the list of fields from the related table/layer to be included in the returned feature set. This list is a comma delimited list of field names. If you specify the shape field in the list of return fields, it is ignored. To request geometry, set return_geometry to true. You can also specify the wildcard “*” as the value of this parameter. In this case, the results will include all the field values.
definition_expression Optional string. The definition expression to be applied to the related table/layer. From the list of objectIds, only those records that conform to this expression are queried for related records.
return_geometry Optional boolean. If true, the feature set includes the geometry associated with each feature. The default is true.
max_allowable_offset Optional float. This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of the outSR. If outSR is not specified, then max_allowable_offset is assumed to be in the unit of the spatial reference of the map.
geometry_precision Optional integer. This option can be used to specify the number of decimal places in the response geometries.
out_wkid Optional integer. The spatial reference of the returned geometry.
gdb_version Optional string. The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer queried is true.
return_z Optional boolean. If true, Z values are included in the results if the features have Z values. Otherwise, Z values are not returned. The default is false.
return_m Optional boolean. If true, M values are included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
Returns:dict
upload(path, description=None)

Uploads a new item to the server. Once the operation is completed successfully, the JSON structure of the uploaded item is returned.

Argument Description
path Optional string. Filepath of the file to upload.
description Optional string. Descriptive text for the uploaded item.
Returns:boolean

FeatureSet

class arcgis.features.FeatureSet(features, fields=None, has_z=False, has_m=False, geometry_type=None, spatial_reference=None, display_field_name=None, object_id_field_name=None, global_id_field_name=None)

A set of features with information about their fields, field aliases, geometry type, spatial reference etc.

FeatureSets are commonly used as input/output with several Geoprocessing Tools, and can be the obtained through the query() methods of feature layers. A FeatureSet can be combined with a layer definition to compose a FeatureCollection.

FeatureSet contains Feature objects, including the values for the fields requested by the user. For layers, if you request geometry information, the geometry of each feature is also returned in the FeatureSet. For tables, the FeatureSet does not include geometries.

If a Spatial Reference is not specified at the FeatureSet level, the FeatureSet will assume the SpatialReference of its first feature. If the SpatialReference of the first feature is also not specified, the spatial reference will be UnknownCoordinateSystem.

df

deprecated in v1.5.0 please use `sdf`

converts the FeatureSet to a Pandas dataframe. Requires pandas

display_field_name

gets/sets the displayFieldName

features

gets the features in the FeatureSet

fields

gets the fields in the FeatureSet

static from_dataframe(df)

returns a featureset from a Pandas’ Data or Spatial DataFrame

static from_dict(featureset_dict)

returns a featureset from a dict

static from_geojson(geojson)

Converts a GeoJSON Feature Collection into a FeatureSet

static from_json(json_str)

returns a featureset from a JSON string

geometry_type

gets/sets the geometry Type

global_id_field_name

gets/sets the globalIdFieldName

has_m

gets/set the M-property

has_z

gets/sets the Z-property

object_id_field_name

gets/sets the object id field

save(save_location, out_name, encoding=None)

Saves a featureset object to a feature class

Argument Description
save_location Required string. Path to export the FeatureSet to.
out_name Required string. Name of the saved table.
encoding Optional string. character encoding is used to represent a repertoire of characters by some kind of encoding system. The default is None.
Returns:string
sdf

Converts the FeatureSet to a Spatially Enabled Pandas dataframe

spatial_reference

gets the featureset’s spatial reference

to_dict()

converts the object to Python dictionary

to_geojson

converts the object to GeoJSON

to_json

converts the object to JSON

value

returns object as dictionary

FeatureCollection

class arcgis.features.FeatureCollection(dictdata)

FeatureCollection is an object with a layer definition and a feature set.

It is an in-memory collection of features with rendering information.

Feature Collections can be stored as Items in the GIS, added as layers to a map or scene, passed as inputs to feature analysis tools, and returned as results from feature analysis tools if an output name for a feature layer is not specified when calling the tool.

static from_featureset(fset, symbol=None)

Create a FeatureCollection object from a FeatureSet object.

Returns:A FeatureCollection object.
query()

Returns the data in this feature collection as a FeatureSet. Filtering by where clause is not supported for feature collections

arcgis.features.GeoAccessor

class arcgis.features.GeoAccessor(obj)

The DataFrame Accessor is a namespace that performs dataset operations. This includes visualization, spatial indexing, IO and dataset level properties.

area

Returns the total area of the dataframe

Returns:float
>>> df.spatial.area
143.23427
bbox

Returns the total length of the dataframe

Returns:Polygon
>>> df.spatial.bbox
{'rings' : [[[1,2], [2,3], [3,3],....]], 'spatialReference' {'wkid': 4326}}
centroid

Returns the centroid of the dataframe

Returns:Geometry
>>> df.spatial.centroid
(-14.23427, 39)
static from_df(df, address_column='address', geocoder=None, sr=None)

Returns a SpatialDataFrame from a dataframe with an address column.

Argument Description
df Required Pandas DataFrame. Source dataset
address_column Optional String. The default is “address”. This is the name of a column in the specified dataframe that contains addresses (as strings). The addresses are batch geocoded using the GIS’s first configured geocoder and their locations used as the geometry of the spatial dataframe. Ignored if the ‘geometry’ parameter is also specified.
geocoder Optional Geocoder. The geocoder to be used. If not specified, the active GIS’s first geocoder is used.
sr Optional integer. The WKID of the spatial reference.
Returns:DataFrame

NOTE: Credits will be consumed for batch_geocoding, from the GIS to which the geocoder belongs.

static from_featureclass(location)

import a geo enabled dataframe to a feature class.

static from_layer(layer)

imports a FeatureLayer to a Spatially Enabled DataFrame

static from_xy(df, x_column, y_column, sr=4326)

Converts a Pandas DataFrame into a Spatial DataFrame by providing the X/Y columns.

Argument Description
df Required Pandas DataFrame. Source dataset
x_column Required string. The name of the X-coordinate series
y_column Required string. The name of the Y-coordinate series
sr Optional int. The wkid number of the spatial reference. 4326 is the default value.
Returns:DataFrame
full_extent

Returns the extent of the dataframe

Returns:tuple
>>> df.spatial.full_extent
(-118, 32, -97, 33)
geometry_type

Returns a list Geometry Types for the DataFrame

join(right_df, how='inner', op='intersects', left_tag='left', right_tag='right')

Joins the current DataFrame to another spatially enabled dataframes based on spatial location based.

Note

requires the SEDF to be in the same coordinate system

Argument Description
right_df Required pd.DataFrame. Spatially enabled dataframe to join.
how

Required string. The type of join:

  • left - use keys from current dataframe and retains only current geometry column
  • right - use keys from right_df; retain only right_df geometry column
  • inner - use intersection of keys from both dfs and retain only current geometry column
op

Required string. The operation to use to perform the join. The default is intersects.

supported perations: intersects, within, and contains

left_tag Optional String. If the same column is in the left and right dataframe, this will append that string value to the field.
right_tag Optional String. If the same column is in the left and right dataframe, this will append that string value to the field.
Returns:Spatially enabled Pandas’ DataFrame
length

Returns the total length of the dataframe

Returns:float
>>> df.spatial.length
1.23427
name

returns the name of the geometry column

plot(map_widget=None, **kwargs)

Plot draws the data on a web map. The user can describe in simple terms how to renderer spatial data using symbol. To make the process simplier a pallette for which colors are drawn from can be used instead of explicit colors.

Explicit Argument Description
map_widget optional WebMap object. This is the map to display the data on.
palette optional string/dict. Color mapping. For simple renderer, just provide a string. For more robust renderers like unique renderer, a dictionary can be given.
renderer_type

optional string. Determines the type of renderer to use for the provided dataset. The default is ‘s’ which is for simple renderers.

Allowed values:

  • ‘s’ - is a simple renderer that uses one symbol only.
  • ‘u’ - unique renderer symbolizes features based on one
    or more matching string attributes.
  • ‘c’ - A class breaks renderer symbolizes based on the
    value of some numeric attribute.
  • ‘h’ - heatmap renders point data into a raster
    visualization that emphasizes areas of higher density or weighted values.
symbol_type optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Allowed symbol types based on geometries:

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
col optional string/list. Field or fields used for heatmap, class breaks, or unique renderers.
pallette optional string. The color map to draw from in order to visualize the data. The default pallette is ‘jet’. To get a visual representation of the allowed color maps, use the display_colormaps method.
alpha optional float. This is a value between 0 and 1 with 1 being the default value. The alpha sets the transparancy of the renderer when applicable.

** Render Syntax **

The render syntax allows for users to fully customize symbolizing the data.

** Simple Renderer**

A simple renderer is a renderer that uses one symbol only.

Optional Argument Description
symbol_type optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
description Description of the renderer.
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets.
rotation_type

String value which controls the origin and direction of rotation on point features. If the rotationType is defined as arithmetic, the symbol is rotated from East in a counter-clockwise direction where East is the 0 degree axis. If the rotationType is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis.

Must be one of the following values:

  • arithmetic
  • geographic
visual_variables An array of objects used to set rendering properties.

Heatmap Renderer

The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values.

Optional Argument Description
blur_radius The radius (in pixels) of the circle over which the majority of each point’s value is spread.
field This is optional as this renderer can be created if no field is specified. Each feature gets the same value/importance/weight or with a field where each feature is weighted by the field’s value.
max_intensity The pixel intensity value which is assigned the final color in the color ramp.
min_intensity The pixel intensity value which is assigned the initial color in the color ramp.
ratio A number between 0-1. Describes what portion along the gradient the colorStop is added.

Unique Renderer

This renderer symbolizes features based on one or more matching string attributes.

Optional Argument Description
background_fill_symbol A symbol used for polygon features as a background if the renderer uses point symbols, e.g. for bivariate types & size rendering. Only applicable to polygon layers. PictureFillSymbols can also be used outside of the Map Viewer for Size and Predominance and Size renderers.
default_label Default label for the default symbol used to draw unspecified values.
default_symbol Symbol used when a value cannot be matched.
field1, field2, field3 Attribute field renderer uses to match values.
field_delimiter String inserted between the values if multiple attribute fields are specified.
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets. Rotation is set using a visual variable of type rotation info with a specified field or value expression property.
rotation_type

String property which controls the origin and direction of rotation. If the rotation type is defined as arithmetic the symbol is rotated from East in a counter-clockwise direction where East is the 0 degree axis. If the rotation type is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis. Must be one of the following values:

  • arithmetic
  • geographic
arcade_expression An Arcade expression evaluating to either a string or a number.
arcade_title The title identifying and describing the associated Arcade expression as defined in the valueExpression property.
visual_variables An array of objects used to set rendering properties.

Class Breaks Renderer

A class breaks renderer symbolizes based on the value of some numeric attribute.

Optional Argument Description
background_fill_symbol A symbol used for polygon features as a background if the renderer uses point symbols, e.g. for bivariate types & size rendering. Only applicable to polygon layers. PictureFillSymbols can also be used outside of the Map Viewer for Size and Predominance and Size renderers.
default_label Default label for the default symbol used to draw unspecified values.
default_symbol Symbol used when a value cannot be matched.
method

Determines the classification method that was used to generate class breaks.

Must be one of the following values:

  • esriClassifyDefinedInterval
  • esriClassifyEqualInterval
  • esriClassifyGeometricalInterval
  • esriClassifyNaturalBreaks
  • esriClassifyQuantile
  • esriClassifyStandardDeviation
  • esriClassifyManual
field Attribute field used for renderer.
min_value The minimum numeric data value needed to begin class breaks.
normalization_field Used when normalizationType is field. The string value indicating the attribute field by which the data value is normalized.
normalization_total Used when normalizationType is percent-of-total, this number property contains the total of all data values.
normalization_type

Determine how the data was normalized.

Must be one of the following values:

  • esriNormalizeByField
  • esriNormalizeByLog
  • esriNormalizeByPercentOfTotal
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets.
rotation_type

A string property which controls the origin and direction of rotation. If the rotation_type is defined as arithmetic, the symbol is rotated from East in a couter-clockwise direction where East is the 0 degree axis. If the rotationType is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis.

Must be one of the following values:

  • arithmetic
  • geographic
arcade_expression An Arcade expression evaluating to a number.
arcade_title The title identifying and describing the associated Arcade expression as defined in the arcade_expression property.
visual_variables An object used to set rendering options.

** Symbol Syntax **

Optional Argument Description
symbol_type optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
cmap optional string or list. This is the color scheme a user can provide if the exact color is not needed, or a user can provide a list with the color defined as: [red, green blue, alpha]. The values red, green, blue are from 0-255 and alpha is a float value from 0 - 1. The default value is ‘jet’ color scheme.
cstep optional integer. If provided, its the color location on the color scheme.

Simple Symbols

This is a list of optional parameters that can be given for point, line or polygon geometries.

Argument Description
marker_size optional float. Numeric size of the symbol given in points.
marker_angle optional float. Numeric value used to rotate the symbol. The symbol is rotated counter-clockwise. For example, The following, angle=-30, in will create a symbol rotated -30 degrees counter-clockwise; that is, 30 degrees clockwise.
marker_xoffset Numeric value indicating the offset on the x-axis in points.
marker_yoffset Numeric value indicating the offset on the y-axis in points.
line_width optional float. Numeric value indicating the width of the line in points
outline_style

Optional string. For polygon point, and line geometries , a customized outline type can be provided.

Allowed Styles:

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.

Picture Symbol

This type of symbol only applies to Points, MultiPoints and Polygons.

Argument Description
marker_angle Numeric value that defines the number of degrees ranging from 0-360, that a marker symbol is rotated. The rotation is from East in a counter-clockwise direction where East is the 0 axis.
marker_xoffset Numeric value indicating the offset on the x-axis in points.
marker_yoffset Numeric value indicating the offset on the y-axis in points.
height Numeric value used if needing to resize the symbol. Specify a value in points. If images are to be displayed in their original size, leave this blank.
width Numeric value used if needing to resize the symbol. Specify a value in points. If images are to be displayed in their original size, leave this blank.
url String value indicating the URL of the image. The URL should be relative if working with static layers. A full URL should be used for map service dynamic layers. A relative URL can be dereferenced by accessing the map layer image resource or the feature layer image resource.
image_data String value indicating the base64 encoded data.
xscale Numeric value indicating the scale factor in x direction.
yscale Numeric value indicating the scale factor in y direction.
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.
outline_style

Optional string. For polygon point, and line geometries , a customized outline type can be provided.

Allowed Styles:

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.
line_width optional float. Numeric value indicating the width of the line in points

Text Symbol

This type of symbol only applies to Points, MultiPoints and Polygons.

Argument Description
font_decoration The text decoration. Must be one of the following values: - line-through - underline - none
font_family Optional string. The font family.
font_size Optional float. The font size in points.
font_style Optional string. The text style. - italic - normal - oblique
font_weight Optional string. The text weight. Must be one of the following values: - bold - bolder - lighter - normal
background_color optional string/list. Background color is represented as a four-element array or string of a color map.
halo_color Optional string/list. Color of the halo around the text. The default is None.
halo_size Optional integer/float. The point size of a halo around the text symbol.
horizontal_alignment optional string. One of the following string values representing the horizontal alignment of the text. Must be one of the following values: - left - right - center - justify
kerning optional boolean. Boolean value indicating whether to adjust the spacing between characters in the text string.
line_color optional string/list. Outline color is represented as a four-element array or string of a color map.
line_width optional integer/float. Outline size.
marker_angle optional int. A numeric value that defines the number of degrees (0 to 360) that a text symbol is rotated. The rotation is from East in a counter-clockwise direction where East is the 0 axis.
marker_xoffset optional int/float.Numeric value indicating the offset on the x-axis in points.
marker_yoffset optional int/float.Numeric value indicating the offset on the x-axis in points.
right_to_left optional boolean. Set to true if using Hebrew or Arabic fonts.
rotated optional boolean. Boolean value indicating whether every character in the text string is rotated.
text Required string. Text Value to display next to geometry.
vertical_alignment Optional string. One of the following string values representing the vertical alignment of the text. Must be one of the following values: - top - bottom - middle - baseline

Cartographic Symbol

This type of symbol only applies to line geometries.

Argument Description
line_width optional float. Numeric value indicating the width of the line in points
cap Optional string. The cap style.
join Optional string. The join style.
miter_limit Optional string. Size threshold for showing mitered line joins.

The kwargs parameter accepts all parameters of the create_symbol method and the create_renderer method.

project(spatial_reference, transformation_name=None)

Reprojects the who dataset into a new spatial reference. This is an inplace operation meaning that it will update the defined geometry column from the set_geometry.

Argument Description
spatial_reference Required SpatialReference. The new spatial reference. This can be a SpatialReference object or the coordinate system name.
transformation_name Required String. The geotransformation name.
Returns:boolean
set_geometry(col)

Assigns the Geometry Column by Name or by List

sindex(stype, reset=False, **kwargs)

Creates a spatial index for the given dataset.

By default the spatial index is a QuadTree spatial index.

If r-tree indexes should be used for large datasets. This will allow users to create very large out of memory indexes. To use r-tree indexes, the r-tree library must be installed. To do so, install via conda using the following command: conda install -c conda-forge rtree

sr

gets/sets the spatial reference of the dataframe

to_feature_collection(name=None, drawing_info=None, extent=None, global_id_field=None)

Converts a spatially enabled pd.DataFrame to a Feature Collection

optional argument Description
name optional string. Name of the Feature Collection
drawing_info Optional dictionary. This is the rendering information for a Feature Collection. Rendering information is a dictionary with the symbology, labelling and other properties defined. See: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Renderer_objects/02r30000019t000000/
extent Optional dictionary. If desired, a custom extent can be provided to set where the map starts up when showing the data. The default is the full extent of the dataset in the Spatial DataFrame.
global_id_field Optional string. The Global ID field of the dataset.
Returns:FeatureCollection object
to_featureclass(location, overwrite=True)

exports a geo enabled dataframe to a feature class.

to_featurelayer(title, gis=None, tags=None)

publishes a spatial dataframe to a new feature layer

Argument Description
title Required string. The name of the service
gis Optional GIS. The GIS connection object
tags Optional list of strings. A comma seperated list of descriptive words for the service.
Returns:FeatureLayer
to_featureset()

Converts a spatial dataframe to a feature set object

true_centroid

Returns the true centroid of the dataframe

Returns:Geometry
>>> df.spatial.true_centroid
(1.23427, 34)
validate(strict=False)

Determines if the Geo Accessor is Valid with Geometries in all values

arcgis.features.GeoSeriesAccessor

class arcgis.features.GeoSeriesAccessor(obj)
JSON
WKB
WKT
angle_distance_to(second_geometry, method='GEODESIC')

Returns a tuple of angle and distance to another point using a measurement type.

Argument Description
second_geometry Required Geometry. A arcgis.Geometry object.
method Optional String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
Returns:a tuple of angle and distance to another point using a measurement type.
area
as_arcpy
as_shapely
boundary()

Constructs the boundary of the geometry.

Returns:arcgis.geometry.Polyline
buffer(distance)

Constructs a polygon at a specified distance from the geometry.

Argument Description
distance Required float. The buffer distance. The buffer distance is in the same units as the geometry that is being buffered. A negative distance can only be specified against a polygon geometry.
Returns:arcgis.geometry.Polygon
centroid
clip(envelope)

Constructs the intersection of the geometry and the specified extent.

Argument Description
envelope required tuple. The tuple must have (XMin, YMin, XMax, YMax) each value represents the lower left bound and upper right bound of the extent.
Returns:output geometry clipped to extent
contains(second_geometry, relation=None)

Indicates if the base geometry contains the comparison geometry.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
relation

Optional string. The spatial relationship type.

  • BOUNDARY - Relationship has no restrictions for interiors or boundaries.
  • CLEMENTINI - Interiors of geometries must intersect. Specifying CLEMENTINI is equivalent to specifying None. This is the default.
  • PROPER - Boundaries of geometries must not intersect.
Returns:boolean
convex_hull()

Constructs the geometry that is the minimal bounding polygon such that all outer angles are convex.

crosses(second_geometry)

Indicates if the two geometries intersect in a geometry of a lesser shape type.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:boolean
cut(cutter)

Splits this geometry into a part left of the cutting polyline, and a part right of it.

Argument Description
cutter Required Polyline. The cuttin polyline geometry
Returns:a list of two geometries
densify(method, distance, deviation)

Creates a new geometry with added vertices

Argument Description
method Required String. The type of densification, DISTANCE, ANGLE, or GEODESIC
distance Required float. The maximum distance between vertices. The actual distance between vertices will usually be less than the maximum distance as new vertices will be evenly distributed along the original segment. If using a type of DISTANCE or ANGLE, the distance is measured in the units of the geometry’s spatial reference. If using a type of GEODESIC, the distance is measured in meters.
deviation Required float. Densify uses straight lines to approximate curves. You use deviation to control the accuracy of this approximation. The deviation is the maximum distance between the new segment and the original curve. The smaller its value, the more segments will be required to approximate the curve.
Returns:arcgis.geometry.Geometry
difference(second_geometry)

Constructs the geometry that is composed only of the region unique to the base geometry but not part of the other geometry. The following illustration shows the results when the red polygon is the source geometry.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:arcgis.geometry.Geometry
disjoint(second_geometry)

Indicates if the base and comparison geometries share no points in common.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:boolean
distance_to(second_geometry)

Returns the minimum distance between two geometries. If the geometries intersect, the minimum distance is 0. Both geometries must have the same projection.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:float
equals(second_geometry)

Indicates if the base and comparison geometries are of the same shape type and define the same set of points in the plane. This is a 2D comparison only; M and Z values are ignored.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:boolean
extent
first_point
generalize(max_offset)

Creates a new simplified geometry using a specified maximum offset tolerance.

Argument Description
max_offset Required float. The maximum offset tolerance.
Returns:arcgis.geometry.Geometry
geoextent
geometry_type
get_area(method, units=None)

Returns the area of the feature using a measurement type.

Argument Description
method Required String. LANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
units Optional String. Areal unit of measure keywords: ACRES | ARES | HECTARES | SQUARECENTIMETERS | SQUAREDECIMETERS | SQUAREINCHES | SQUAREFEET | SQUAREKILOMETERS | SQUAREMETERS | SQUAREMILES | SQUAREMILLIMETERS | SQUAREYARDS
Returns:float
get_length(method, units)

Returns the length of the feature using a measurement type.

Argument Description
method Required String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
units Required String. Linear unit of measure keywords: CENTIMETERS | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICALMILES | YARDS
Returns:float
get_part(index=None)

Returns an array of point objects for a particular part of geometry or an array containing a number of arrays, one for each part.

requires arcpy

Argument Description
index Required Integer. The index position of the geometry.
Returns:arcpy.Array
hull_rectangle
intersect(second_geometry, dimension=1)

Constructs a geometry that is the geometric intersection of the two input geometries. Different dimension values can be used to create different shape types. The intersection of two geometries of the same shape type is a geometry containing only the regions of overlap between the original geometries.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
dimension

Required Integer. The topological dimension (shape type) of the resulting geometry.

  • 1 -A zero-dimensional geometry (point or multipoint).
  • 2 -A one-dimensional geometry (polyline).
  • 4 -A two-dimensional geometry (polygon).
Returns:boolean
is_empty
is_multipart
is_valid
label_point
last_point
length
length3D
measure_on_line(second_geometry, as_percentage=False)

Returns a measure from the start point of this line to the in_point.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
as_percentage Optional Boolean. If False, the measure will be returned as a distance; if True, the measure will be returned as a percentage.
Returns:float
overlaps(second_geometry)

Indicates if the intersection of the two geometries has the same shape type as one of the input geometries and is not equivalent to either of the input geometries.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:boolean
part_count
point_count
point_from_angle_and_distance(angle, distance, method='GEODESCIC')

Returns a point at a given angle and distance in degrees and meters using the specified measurement type.

Argument Description
angle Required Float. The angle in degrees to the returned point.
distance Required Float. The distance in meters to the returned point.
method Optional String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
Returns:arcgis.geometry.Geometry
position_along_line(value, use_percentage=False)

Returns a point on a line at a specified distance from the beginning of the line.

Argument Description
value Required Float. The distance along the line.
use_percentage Optional Boolean. The distance may be specified as a fixed unit of measure or a ratio of the length of the line. If True, value is used as a percentage; if False, value is used as a distance. For percentages, the value should be expressed as a double from 0.0 (0%) to 1.0 (100%).
Returns:arcgis.gis.Geometry
project_as(spatial_reference, transformation_name=None)

Projects a geometry and optionally applies a geotransformation.

Argument Description
spatial_reference Required SpatialReference. The new spatial reference. This can be a SpatialReference object or the coordinate system name.
transformation_name Required String. The geotransformation name.
Returns:arcgis.geometry.Geometry
query_point_and_distance(second_geometry, use_percentage=False)

Finds the point on the polyline nearest to the in_point and the distance between those points. Also returns information about the side of the line the in_point is on as well as the distance along the line where the nearest point occurs.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
as_percentage Optional boolean - if False, the measure will be returned as distance, True, measure will be a percentage
Returns:tuple
segment_along_line(start_measure, end_measure, use_percentage=False)

Returns a Polyline between start and end measures. Similar to Polyline.positionAlongLine but will return a polyline segment between two points on the polyline instead of a single point.

Argument Description
start_measure Required Float. The starting distance from the beginning of the line.
end_measure Required Float. The ending distance from the beginning of the line.
use_percentage Optional Boolean. The start and end measures may be specified as fixed units or as a ratio. If True, start_measure and end_measure are used as a percentage; if False, start_measure and end_measure are used as a distance. For percentages, the measures should be expressed as a double from 0.0 (0 percent) to 1.0 (100 percent).
Returns:Geometry
snap_to_line(second_geometry)

Returns a new point based on in_point snapped to this geometry.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:arcgis.gis.Geometry
spatial_reference
symmetric_difference(second_geometry)

Constructs the geometry that is the union of two geometries minus the instersection of those geometries.

The two input geometries must be the same shape type.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:arcgis.gis.Geometry
touches(second_geometry)

Indicates if the boundaries of the geometries intersect.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:boolean
true_centroid
union(second_geometry)

Constructs the geometry that is the set-theoretic union of the input geometries.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
Returns:arcgis.gis.Geometry
within(second_geometry, relation=None)

Indicates if the base geometry is within the comparison geometry.

Argument Description
second_geometry Required arcgis.geometry.Geometry. A second geometry
relation

Optional String. The spatial relationship type.

  • BOUNDARY - Relationship has no restrictions for interiors or boundaries.
  • CLEMENTINI - Interiors of geometries must intersect. Specifying CLEMENTINI is equivalent to specifying None. This is the default.
  • PROPER - Boundaries of geometries must not intersect.
Returns:boolean

SpatialDataFrame

class arcgis.features.SpatialDataFrame(*args, **kwargs)

A Spatial Dataframe is an object to manipulate, manage and translate data into new forms of information for users.

Functionality of the Spatial DataFrame is determined by the Geometry Engine available to the object at creation. It will first leverage the arcpy geometry engine, then shapely, then it will create the geometry objects without any engine.

Scenerios

Engine Type Functionality
ArcPy Users will have the full functionality provided by the API.
Shapely

Users get a sub-set of operations, and all properties.

Valid Properties:
 
  • JSON
  • WKT
  • WKB
  • area
  • centroid
  • extent
  • first_point
  • hull_rectangle
  • is_multipart
  • label_point
  • last_point
  • length
  • length3D
  • part_count
  • point_count
  • true_centroid
Valid Functions:
 
  • boundary
  • buffer
  • contains
  • convex_hull
  • crosses
  • difference
  • disjoint
  • distance_to
  • equals
  • generalize
  • intersect
  • overlaps
  • symmetric_difference
  • touches
  • union
  • within

Everything else will return None

No Engine Values will return None by default
Required Parameters:
None
Optional:
param data:panda’s dataframe containing attribute information
param geometry:list/array/geoseries of arcgis.geometry objects
param sr:spatial reference of the dataframe. This can be the factory code, WKT string, arcpy.SpatialReference object, or arcgis.SpatailReference object.
param gis:passing a gis.GIS object set to Pro will ensure arcpy is installed and a full swatch of functionality is available to the end user.
copy(deep=True)

Make a copy of this SpatialDataFrame object Parameters:

Deep:boolean, default True Make a deep copy, i.e. also copy data
Returns:
copy:of SpatialDataFrame
erase(other, inplace=False)

Erases

Argument Description
other Required Geometry. A geometry object to erase from other geometries.
inplace Optional boolean. Default False. Modify the SpatialDataFrame in place (do not create a new object)
Returns:SpatialDataFrame
static from_df(df, address_column='address', geocoder=None)

Returns a SpatialDataFrame from a dataframe with an address column.

Argument Description
df Required Pandas DataFrame. Source dataset
address_column Optional String. The default is “address”. This is the name of a column in the specified dataframe that contains addresses (as strings). The addresses are batch geocoded using the GIS’s first configured geocoder and their locations used as the geometry of the spatial dataframe. Ignored if the ‘geometry’ parameter is also specified.
geocoder Optional Geocoder. The geocoder to be used. If not specified, the active GIS’s first geocoder is used.
Returns:SpatialDataFrame

NOTE: Credits will be consumed for batch_geocoding, from the GIS to which the geocoder belongs.

static from_featureclass(filename, **kwargs)

Returns a SpatialDataFrame from a feature class.

Argument Description
filename Required string. The full path to the feature class
sql_clause Optional string. The sql clause to parse data down
where_clause Optional string. A where statement
sr Optional SpatialReference. A spatial reference object
Returns:SpatialDataFrame
static from_hdf(path_or_buf, key=None, **kwargs)

read from the store, close it if we opened it

Retrieve pandas object stored in file, optionally based on where criteria

path_or_buf : path (string), buffer, or path object (pathlib.Path or

py._path.local.LocalPath) to read from

New in version 0.19.0: support for pathlib, py.path.

key : group identifier in the store. Can be omitted if the HDF file
contains a single pandas object.

where : list of Term (or convertable) objects, optional start : optional, integer (defaults to None), row number to start

selection
stop : optional, integer (defaults to None), row number to stop
selection
columns : optional, a list of columns that if not None, will limit the
return columns

iterator : optional, boolean, return an iterator, default False chunksize : optional, nrows to include in iteration, return an iterator

The selected object

static from_layer(layer, **kwargs)

Returns a SpatialDataFrame/Pandas’ Dataframe from a FeatureLayer or Table object.

Arguments Description
layer required FeatureLayer/Table. This is the service endpoint object.
Returns:SpatialDataFrame for feature layers with geometry and Panda’s Dataframe for tables
static from_xy(df, x_column, y_column, sr=4326)

Converts a Pandas DataFrame into a Spatial DataFrame by providing the X/Y columns.

Argument Description
df Required Pandas DataFrame. Source dataset
x_column Required string. The name of the X-coordinate series
y_column Required string. The name of the Y-coordinate series
sr Optional int. The wkid number of the spatial reference.
Returns:SpatialDataFrame
geoextent

returns the extent of the spatial dataframe

geometry

Get/Set the geometry data for SpatialDataFrame

info(verbose=None, buf=None, max_cols=None, memory_usage=None, null_counts=None)

Concise summary of a DataFrame.

verbose : {None, True, False}, optional
Whether to print the full summary. None follows the display.max_info_columns setting. True or False overrides the display.max_info_columns setting.

buf : writable buffer, defaults to sys.stdout max_cols : int, default None

Determines whether full summary or short summary is printed. None follows the display.max_info_columns setting.
memory_usage : boolean/string, default None
Specifies whether total memory usage of the DataFrame elements (including index) should be displayed. None follows the display.memory_usage setting. True or False overrides the display.memory_usage setting. A value of ‘deep’ is equivalent of True, with deep introspection. Memory usage is shown in human-readable units (base-2 representation).
null_counts : boolean, default None

Whether to show the non-null counts

  • If None, then only show if the frame is smaller than max_info_rows and max_info_columns.
  • If True, always show counts.
  • If False, never show counts.
merge_datasets(other)

This operation combines two dataframes into one new DataFrame. If the operation is combining two SpatialDataFrames, the geometry_type must match.

Argument Description
other Required SpatialDataFrame. Another SpatialDataFrame to combine.
Returns:SpatialDataFrame
plot(*args, **kwargs)

Plot draws the data on a web map. The user can describe in simple terms how to renderer spatial data using symbol. To make the process simpler a palette for which colors are drawn from can be used instead of explicit colors.

Explicit Argument Description
df required SpatialDataFrame or GeoSeries. This is the data to map.
map_widget optional WebMap object. This is the map to display the data on.
palette optional string/dict. Color mapping. For simple renderer, just provide a string. For more robust renderers like unique renderer, a dictionary can be given.
renderer_type

optional string. Determines the type of renderer to use for the provided dataset. The default is ‘s’ which is for simple renderers.

Allowed values:

  • ‘s’ - is a simple renderer that uses one symbol only.
  • ‘u’ - unique renderer symbolizes features based on one
    or more matching string attributes.
  • ‘c’ - A class breaks renderer symbolizes based on the
    value of some numeric attribute.
  • ‘h’ - heatmap renders point data into a raster
    visualization that emphasizes areas of higher density or weighted values.
symbol_style optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Allowed symbol types based on geometries:

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
col optional string/list. Field or fields used for heatmap, class breaks, or unique renderers.
palette optional string. The color map to draw from in order to visualize the data. The default palette is ‘jet’. To get a visual representation of the allowed color maps, use the display_colormaps method.
alpha optional float. This is a value between 0 and 1 with 1 being the default value. The alpha sets the transparancy of the renderer when applicable.

Render Syntax

The render syntax allows for users to fully customize symbolizing the data.

Simple Renderer

A simple renderer is a renderer that uses one symbol only.

Optional Argument Description
symbol_style optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
description Description of the renderer.
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets.
rotation_type

String value which controls the origin and direction of rotation on point features. If the rotationType is defined as arithmetic, the symbol is rotated from East in a counter-clockwise direction where East is the 0 degree axis. If the rotationType is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis.

Must be one of the following values:

  • arithmetic
  • geographic
visual_variables An array of objects used to set rendering properties.

Heatmap Renderer

The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values.

Optional Argument Description
blur_radius The radius (in pixels) of the circle over which the majority of each point’s value is spread.
field This is optional as this renderer can be created if no field is specified. Each feature gets the same value/importance/weight or with a field where each feature is weighted by the field’s value.
max_intensity The pixel intensity value which is assigned the final color in the color ramp.
min_intensity The pixel intensity value which is assigned the initial color in the color ramp.
ratio A number between 0-1. Describes what portion along the gradient the colorStop is added.

Unique Renderer

This renderer symbolizes features based on one or more matching string attributes.

Optional Argument Description
background_fill_symbol A symbol used for polygon features as a background if the renderer uses point symbols, e.g. for bivariate types & size rendering. Only applicable to polygon layers. PictureFillSymbols can also be used outside of the Map Viewer for Size and Predominance and Size renderers.
default_label Default label for the default symbol used to draw unspecified values.
default_symbol Symbol used when a value cannot be matched.
col String or List of Strings. Attribute field(s) the renderer uses to match values.
field_delimiter String inserted between the values if multiple attribute fields are specified.
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets. Rotation is set using a visual variable of type rotation info with a specified field or value expression property.
rotation_type

String property which controls the origin and direction of rotation. If the rotation type is defined as arithmetic the symbol is rotated from East in a counter-clockwise direction where East is the 0 degree axis. If the rotation type is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis. Must be one of the following values:

  • arithmetic
  • geographic
arcade_expression An Arcade expression evaluating to either a string or a number.
arcade_title The title identifying and describing the associated Arcade expression as defined in the valueExpression property.
visual_variables An array of objects used to set rendering properties.

Class Breaks Renderer

A class breaks renderer symbolizes based on the value of some numeric attribute.

Optional Argument Description
background_fill_symbol A symbol used for polygon features as a background if the renderer uses point symbols, e.g. for bivariate types & size rendering. Only applicable to polygon layers. PictureFillSymbols can also be used outside of the Map Viewer for Size and Predominance and Size renderers.
default_label Default label for the default symbol used to draw unspecified values.
default_symbol Symbol used when a value cannot be matched.
method

Determines the classification method that was used to generate class breaks.

Must be one of the following values:

  • esriClassifyDefinedInterval
  • esriClassifyEqualInterval
  • esriClassifyGeometricalInterval
  • esriClassifyNaturalBreaks
  • esriClassifyQuantile
  • esriClassifyStandardDeviation
  • esriClassifyManual
field Attribute field used for renderer.
min_value The minimum numeric data value needed to begin class breaks.
normalization_field Used when normalizationType is field. The string value indicating the attribute field by which the data value is normalized.
normalization_total Used when normalizationType is percent-of-total, this number property contains the total of all data values.
normalization_type

Determine how the data was normalized.

Must be one of the following values:

  • esriNormalizeByField
  • esriNormalizeByLog
  • esriNormalizeByPercentOfTotal
rotation_expression A constant value or an expression that derives the angle of rotation based on a feature attribute value. When an attribute name is specified, it’s enclosed in square brackets.
rotation_type

A string property which controls the origin and direction of rotation. If the rotation_type is defined as arithmetic, the symbol is rotated from East in a couter-clockwise direction where East is the 0 degree axis. If the rotationType is defined as geographic, the symbol is rotated from North in a clockwise direction where North is the 0 degree axis.

Must be one of the following values:

  • arithmetic
  • geographic
arcade_expression An Arcade expression evaluating to a number.
arcade_title The title identifying and describing the associated Arcade expression as defined in the arcade_expression property.
visual_variables An object used to set rendering options.

Symbol Syntax

Optional Argument Description
symbol_style optional string. This is the type of symbol the user needs to create. Valid inputs are: simple, picture, text, or carto. The default is simple.
symbol_type

optional string. This is the symbology used by the geometry. For example ‘s’ for a Line geometry is a solid line. And ‘-‘ is a dash line.

Point Symbols

  • ‘o’ - Circle (default)
  • ‘+’ - Cross
  • ‘D’ - Diamond
  • ‘s’ - Square
  • ‘x’ - X

Polyline Symbols

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot

Polygon Symbols

  • ‘s’ - Solid Fill (default)
  • ‘’ - Backward Diagonal
  • ‘/’ - Forward Diagonal
  • ‘|’ - Vertical Bar
  • ‘-‘ - Horizontal Bar
  • ‘x’ - Diagonal Cross
  • ‘+’ - Cross
cmap optional string or list. This is the color scheme a user can provide if the exact color is not needed, or a user can provide a list with the color defined as: [red, green blue, alpha]. The values red, green, blue are from 0-255 and alpha is a float value from 0 - 1. The default value is ‘jet’ color scheme.
cstep optional integer. If provided, its the color location on the color scheme.

Simple Symbols

This is a list of optional parameters that can be given for point, line or polygon geometries.

Argument Description
marker_size optional float. Numeric size of the symbol given in points.
marker_angle optional float. Numeric value used to rotate the symbol. The symbol is rotated counter-clockwise. For example, The following, angle=-30, in will create a symbol rotated -30 degrees counter-clockwise; that is, 30 degrees clockwise.
marker_xoffset Numeric value indicating the offset on the x-axis in points.
marker_yoffset Numeric value indicating the offset on the y-axis in points.
line_width optional float. Numeric value indicating the width of the line in points
outline_style

Optional string. For polygon point, and line geometries , a customized outline type can be provided.

Allowed Styles:

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.

Picture Symbol

This type of symbol only applies to Points, MultiPoints and Polygons.

Argument Description
marker_angle Numeric value that defines the number of degrees ranging from 0-360, that a marker symbol is rotated. The rotation is from East in a counter-clockwise direction where East is the 0 axis.
marker_xoffset Numeric value indicating the offset on the x-axis in points.
marker_yoffset Numeric value indicating the offset on the y-axis in points.
height Numeric value used if needing to resize the symbol. Specify a value in points. If images are to be displayed in their original size, leave this blank.
width Numeric value used if needing to resize the symbol. Specify a value in points. If images are to be displayed in their original size, leave this blank.
url String value indicating the URL of the image. The URL should be relative if working with static layers. A full URL should be used for map service dynamic layers. A relative URL can be dereferenced by accessing the map layer image resource or the feature layer image resource.
image_data String value indicating the base64 encoded data.
xscale Numeric value indicating the scale factor in x direction.
yscale Numeric value indicating the scale factor in y direction.
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.
outline_style

Optional string. For polygon point, and line geometries , a customized outline type can be provided.

Allowed Styles:

  • ‘s’ - Solid (default)
  • ‘-‘ - Dash
  • ‘-.’ - Dash Dot
  • ‘-..’ - Dash Dot Dot
  • ‘.’ - Dot
  • ‘–’ - Long Dash
  • ‘–.’ - Long Dash Dot
  • ‘n’ - Null
  • ‘s-‘ - Short Dash
  • ‘s-.’ - Short Dash Dot
  • ‘s-..’ - Short Dash Dot Dot
  • ‘s.’ - Short Dot
outline_color optional string or list. This is the same color as the cmap property, but specifically applies to the outline_color.
line_width optional float. Numeric value indicating the width of the line in points

Text Symbol

This type of symbol only applies to Points, MultiPoints and Polygons.

Argument Description
font_decoration The text decoration. Must be one of the following values: - line-through - underline - none
font_family Optional string. The font family.
font_size Optional float. The font size in points.
font_style Optional string. The text style. - italic - normal - oblique
font_weight Optional string. The text weight. Must be one of the following values: - bold - bolder - lighter - normal
background_color optional string/list. Background color is represented as a four-element array or string of a color map.
halo_color Optional string/list. Color of the halo around the text. The default is None.
halo_size Optional integer/float. The point size of a halo around the text symbol.
horizontal_alignment optional string. One of the following string values representing the horizontal alignment of the text. Must be one of the following values: - left - right - center - justify
kerning optional boolean. Boolean value indicating whether to adjust the spacing between characters in the text string.
line_color optional string/list. Outline color is represented as a four-element array or string of a color map.
line_width optional integer/float. Outline size.
marker_angle optional int. A numeric value that defines the number of degrees (0 to 360) that a text symbol is rotated. The rotation is from East in a counter-clockwise direction where East is the 0 axis.
marker_xoffset optional int/float.Numeric value indicating the offset on the x-axis in points.
marker_yoffset optional int/float.Numeric value indicating the offset on the x-axis in points.
right_to_left optional boolean. Set to true if using Hebrew or Arabic fonts.
rotated optional boolean. Boolean value indicating whether every character in the text string is rotated.
text Required string. Text Value to display next to geometry.
vertical_alignment Optional string. One of the following string values representing the vertical alignment of the text. Must be one of the following values: - top - bottom - middle - baseline

Cartographic Symbol

This type of symbol only applies to line geometries.

Argument Description
line_width optional float. Numeric value indicating the width of the line in points
cap Optional string. The cap style.
join Optional string. The join style.
miter_limit Optional string. Size threshold for showing mitered line joins.

The kwargs parameter accepts all parameters of the create_symbol method and the create_renderer method.

reproject(spatial_reference, transformation=None, inplace=False)

Reprojects a given dataframe into a new coordinate system.

Argument Description
spatial_reference Required Integer/SpatialReference. The spatial reference the data should be reprojected into.
transformation Optional string. The optional transformation string.
inplace Optional boolean. Default False. Modify the SpatialDataFrame in place (do not create a new object)
Returns:SpatialDataFrame
select_by_location(other, matches_only=True)

Selects all rows in a given SpatialDataFrame based on a given geometry

Argument Description
other Required Geometry. A geometry object to check for intersection.
matches_only Optional boolean. if true, only matched records will be returned, else a field called ‘select_by_location’ will be added to the dataframe with the results of the select by location.
Returns:SpatialDataFrame
set_geometry(col, drop=False, inplace=False, sr=None)

Set the SpatialDataFrame geometry using either an existing column or the specified input. By default yields a new object.

The original geometry column is replaced with the input.

Argument Description
col Required string/np.array. column label or array
drop Optional boolean. Default True. Delete column to be used as the new geometry
inplace Optional boolean. Default False. Modify the SpatialDataFrame in place (do not create a new object)
sr Optional SpatialReference/Integer. The wkid value Coordinate system to use. If passed, overrides both DataFrame and col’s sr. Otherwise, tries to get sr from passed col values or DataFrame.
Returns:SpatialDataFrame
to_feature_collection(name=None, drawing_info=None, extent=None, global_id_field=None)

converts a Spatial DataFrame to a Feature Collection

optional argument Description
name optional string. Name of the Feature Collection
drawing_info Optional dictionary. This is the rendering information for a Feature Collection. Rendering information is a dictionary with the symbology, labelling and other properties defined. See: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Renderer_objects/02r30000019t000000/
extent Optional dictionary. If desired, a custom extent can be provided to set where the map starts up when showing the data. The default is the full extent of the dataset in the Spatial DataFrame.
global_id_field Optional string. The Global ID field of the dataset.
Returns:FeatureCollection object
to_featureclass(out_location, out_name, overwrite=True, skip_invalid=True)

converts a SpatialDataFrame to a feature class

Argument Description
out_location Required string. A save location workspace
out_name Required string. The name of the feature class to save as
overwrite Optional boolean. True means to erase and replace value, false means to append
skip_invalids Optional boolean. If True, any bad rows will be ignored.
Returns:string
to_featurelayer(title, gis=None, tags=None)

publishes a spatial dataframe to a new feature layer

Argument Description
title Required string. The name of the service
gis Optional GIS. The GIS connection object
tags Optional string. A comma seperated list of descriptive words for the service
Returns:FeatureLayer
to_featureset()

Converts a spatial dataframe to a feature set object

to_hdf(path_or_buf, key, **kwargs)

Write the contained data to an HDF5 file using HDFStore.

path_or_buf : the path (string) or HDFStore object key : string

indentifier for the group in the store

mode : optional, {‘a’, ‘w’, ‘r+’}, default ‘a’

'w'
Write; a new file is created (an existing file with the same name would be deleted).
'a'
Append; an existing file is opened for reading and writing, and if the file does not exist it is created.
'r+'
It is similar to 'a', but the file must already exist.
format : ‘fixed(f)|table(t)’, default is ‘fixed’
fixed(f) : Fixed format
Fast writing/reading. Not-appendable, nor searchable
table(t) : Table format
Write as a PyTables Table structure which may perform worse but allow more flexible operations like searching / selecting subsets of the data
append : boolean, default False
For Table formats, append the input data to the existing
data_columns : list of columns, or True, default None

List of columns to create as indexed data columns for on-disk queries, or True to use all columns. By default only the axes of the object are indexed. See here.

Applicable only to format=’table’.

complevel : int, 1-9, default 0
If a complib is specified compression will be applied where possible
complib : {‘zlib’, ‘bzip2’, ‘lzo’, ‘blosc’, None}, default None
If complevel is > 0 apply compression to objects written in the store wherever possible
fletcher32 : bool, default False
If applying compression use the fletcher32 checksum
dropna : boolean, default False.
If true, ALL nan rows will not be written to store.