The arcgis.layers module provides components for visualizing GIS data and analysis. This module also includes mapping layers like MapImageLayer, SceneLayer and VectorTileLayer.
ServiceBases: object
The Service class allows users to pass a url string or an Item
, along with an optional GIS
connection or specific Server
object to return an instance of the specific ArcGIS API for Python object the service represents.
Parameter
Description
url_or_item
Required String. Internet endpoint for the service to initialize as a Python object.
server
Optional Server
or GIS
object.
An object representing the service type of the input value.
# Usage Example: Directly from a url >>> from arcgis.gis import GIS >>> from arcgis.layers import Service >>> gis = GIS(profile="your_online_profile") >>> fs_url = "https://services7.arcgis.com/<org_id>/arcgis/rest/services/ancient_places/FeatureServer" >>> flc = Service( url_or_item=fs_url ) >>> flc <FeatureLayerCollection url:"https://services7.arcgis.com/<org_id>/arcgis/rest/services/ancient_places/FeatureServer"> >>> type(flc) arcgis.features.layer.FeatureLayerCollection # Usage Example #2: From an item >>> org_item = gis.content.get("_item_id_") >>> org_item.type Vector Tile Service >>> vts = Service( url_or_item=org_item ) >>> vts <VectorTileLayer url:"https://tiles.arcgis.com/tiles/<org_id>/arcgis/rest/services/Custom_Basemap_SXT/VectorTileServer">
Bases: object
The basemap styles service is a ready-to-use location service that serves vector and image tiles that represent geographic features around the world. It includes styles that represent topographic features, road networks, footpaths, building footprints, water features, administrative boundaries, and satellite imagery. The styles are returned as JSON based on the Mapbox Style Specification or the ArcGIS Web Map Specification. The service also supports displaying localized language place labels, places, and worldviews. Custom basemap styles can also be created from the the default styles.
When you are using a rendered Map instance, you can specify the basemap service to the basemap property to apply the style to the map.
Returns a list of supported languages for the basemap styles. To see which languages are supported by each service look at the documentation found here: https://developers.arcgis.com/rest/basemap-styles/
Returns a list of supported places for the basemap styles. To see which services support which places look at the documentation found here: https://developers.arcgis.com/rest/basemap-styles/
Returns a list of available basemap styles and their respective path.
Returns a list of supported worldviews for the basemap styles. To see which services support which worldviews look at the documentation found here: https://developers.arcgis.com/rest/basemap-styles/
Bases: object
Represents a basemap style service that is available for use in the basemap styles service.
Returns the style JSON for the specified style name or path.
Bases: Layer
The SceneLayer
class represents a Web scene layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features.
Note
Web scene layers can be used to represent 3D points, point clouds, 3D objects and integrated mesh layers.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.PointCloudLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
Bases: _GISResource
The SceneLayerManager
class allows administration (if access permits) of ArcGIS Online hosted scene layers. A SceneLayerManager
offers access to map and layer content.
The cancel_job
operation supports cancelling a job while update tiles is running from a hosted feature service. The result of this operation is a response indicating success or failure with error code and description.
Parameter
Description
job_id
Required String. The job id to cancel.
The edit
method edits from an Item
object.
Parameter
Description
item
Required ItemId or Item
object. The TPK fileâs item id. This TPK file contains to-be-extracted bundle files which are then merged into an existing cache service.
A dictionary
The import
method imports from an Item
object.
Parameter
Description
item
Required ItemId or Item
object. The TPK fileâs item id. This TPK file contains to-be-extracted bundle files which are then merged into an existing cache service.
A dictionary
Returns the job statistics for the given jobId
The tile service job summary (jobs) resource represents a summary of all jobs associated with a vector tile service. Each job contains a jobid that corresponds to the specific jobid run and redirects you to the Job Statistics page.
The rebuild_cache operation update the scene layer cache to reflect any changes made to the feature layer used to publish this scene layer. The results of the operation is a response indicating success, which redirects you to the Job Statistics page, or failure.
Parameter
Description
layers
Required int or list of int. Comma separated values indicating the id of the layers to rebuild in the cache.
Ex: [0,1,2]
The refresh
operation refreshes a service, which clears the web server cache for the service.
The rerun_job
operation supports re-running a canceled job from a hosted map service. The result of this operation is a response indicating success or failure with error code and description.
Parameter
Description
code
Required string, parameter used to re-run a given jobs with a specific error code: ALL | ERROR | CANCELED
job_id
Required string, job to reprocess
A boolean or dictionary
The swap operation replaces the current service cache with an existing one.
Note
The swap
operation is for ArcGIS Online only.
Parameter
Description
target_service_name
Required string. Name of service you want to swap with.
dictionary indicating success or error
The update
method starts update generation for ArcGIS Online. It updates the underlying source dataset for the service, essentially refreshing the underlying package data.
Dictionary.
Update atrribute is a âlight rebuildâ where attributes of the layers selected are updated and can be used for change tracking. The results of the operation is a response indicating success, which redirects you to the Job Statistics page, or failure.
Parameter
Description
layers
Required int or list of int. Comma separated values indicating the id of the layers to update in the cache.
Ex: [0,1,2]
Update Cache is a âlight rebuildâ where attributes and geometries of the layers selected are updated and can be used for change tracking on the feature layer to only update nodes with dirty tiles. The results of the operation is a response indicating success, which redirects you to the Job Statistics page, or failure.
Parameter
Description
layers
Required int or list of int. Comma separated values indicating the id of the layers to update in the cache.
Ex: [0,1,2]
Bases: _GISResource
The EnterpriseSceneLayerManager
class allows administration (if access permits) of ArcGIS Enterprise hosted scene layers. A SceneLayer
offers access to layer content.
Note
Url must be admin url such as: https://services.myserver.com/arcgis/rest/admin/services/serviceName/SceneServer/
Allows for the switching of the service provide and how it is hosted on the ArcGIS Server instance.
Values:
âArcObjectsâ means the service is running under the ArcMap runtime i.e. published from ArcMap
âArcObjects11â: means the service is running under the ArcGIS Pro runtime i.e. published from ArcGIS Pro
âDMapsâ: means the service is running in the shared instance pool (and thus running under the ArcGIS Pro provider runtime)
Boolean
deletes a service from arcgis server
To edit a service, you need to submit the complete JSON representation of the service, which includes the updates to the service properties. Editing a service causes the service to be restarted with updated properties.
boolean
The rebuild_cache operation update the scene layer cache to reflect any changes made to the feature layer used to publish this scene layer. The results of the operation is the url to the scene service once it is done rebuilding.
Parameter
Description
layer
Optional list of integers. The list of layers to cook.
extent
Optional dict. The updated extent to be used. If nothing is specified, the default extent is used.
area_of_interest
Optional dict representing a feature. Specify the updated area of interest.
âdisplayFieldNameâ: ââ, âgeometryTypeâ: âesriGeometryPolygonâ, âspatialReferenceâ: { âwkidâ: 54051, âlatestWkidâ: 54051 }, âfieldsâ: [ { ânameâ: âOIDâ, âtypeâ: âesriFieldTypeOIDâ, âaliasâ: âOIDâ }, { ânameâ: âupdateGeom_Lengthâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Lengthâ }, { ânameâ: âupdateGeom_Areaâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Areaâ } ], âfeaturesâ: [], âexceededTransferLimitâ: False
}
If successful, the url to the scene service
starts the specific service
stops the specific service
Update atrribute is a âlight rebuildâ where attributes of the layers selected are updated and can be used for change tracking. The results of the operation is the url to the scene service once it is done updating.
Parameter
Description
layer
Optional list of integers. The list of layers to cook.
extent
Optional dict. The updated extent to be used. If nothing is specified, the default extent is used.
area_of_interest
Optional dict representing a feature. Specify the updated area of interest.
âdisplayFieldNameâ: ââ, âgeometryTypeâ: âesriGeometryPolygonâ, âspatialReferenceâ: { âwkidâ: 54051, âlatestWkidâ: 54051 }, âfieldsâ: [ { ânameâ: âOIDâ, âtypeâ: âesriFieldTypeOIDâ, âaliasâ: âOIDâ }, { ânameâ: âupdateGeom_Lengthâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Lengthâ }, { ânameâ: âupdateGeom_Areaâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Areaâ } ], âfeaturesâ: [], âexceededTransferLimitâ: false
}
If successful, the url to the scene service
Update Cache is a âlight rebuildâ where attributes and geometries of the layers selected are updated and can be used for change tracking on the feature layer to only update nodes with dirty tiles,. The results of the operation is the url to the scene service once it is done updating.
Parameter
Description
layer
Optional list of integers. The list of layers to cook.
extent
Optional dict. The updated extent to be used. If nothing is specified, the default extent is used.
area_of_interest
Optional dict representing a feature. Specify the updated area of interest.
âdisplayFieldNameâ: ââ, âgeometryTypeâ: âesriGeometryPolygonâ, âspatialReferenceâ: { âwkidâ: 54051, âlatestWkidâ: 54051 }, âfieldsâ: [ { ânameâ: âOIDâ, âtypeâ: âesriFieldTypeOIDâ, âaliasâ: âOIDâ }, { ânameâ: âupdateGeom_Lengthâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Lengthâ }, { ânameâ: âupdateGeom_Areaâ, âtypeâ: âesriFieldTypeDoubleâ, âaliasâ: âupdateGeom_Areaâ } ], âfeaturesâ: [], âexceededTransferLimitâ: False
}
If successful, the url to the scene service
Bases: Layer
The BuildingLayer
class represents a Web building layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.BuildingLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The IntegratedMeshLayer
class represents a Web scene Integrated Mesh layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.Point3DLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The Tiles3DLayer
class represents a Web scene 3D Tile Service Layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /3DTilesServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
The manager
property returns an instance of Tiles3DLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The Object3DLayer
represents a Web scene 3D Object layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.Point3DLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The Point3DLayer
class represents a Web scene 3D Point layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.Point3DLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The PointCloudLayer
class represents a Web scene Point Cloud layer.
Note
Point Cloud layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.PointCloudLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The VoxelLayer
class represents a Web Scene Voxel layer.
Note
Web scene layers are cached web layers that are optimized for displaying a large amount of 2D and 3D features. See the SceneLayer
class for more information.
Parameter
Description
url
Required string, specify the url ending in /SceneServer/
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a SceneLayer object from arcgis.layers import SceneLayer s_layer = SceneLayer(url='https://your_portal.com/arcgis/rest/services/service_name/SceneServer/') type(s_layer) >> arcgis.layers.VoxelLayer print(s_layer.properties.layers[0].name) >> 'your layer name'
The manager
property returns an instance of SceneLayerManager
class or EnterpriseSceneLayerManager
class which provides methods and properties for administering this service.
Bases: Layer
The MapServiceLayer
class is a factory that generates the Map Service Layers.
Parameter
Description
url
Required string, specify the url ending in /MapServer/<index>
gis
Optional GIS
object. If not specified, the active GIS connection is used.
# USAGE EXAMPLE 1: Instantiating a Map Service Layer object from arcgis.layers import MapServiceLayer ms_layer = MapServiceLayer(url='https://your_portal.com/arcgis/rest/services/service_name/MapServer/0') type(ms_layer) >> arcgis.layers.MapTable print(ms_layer.properties.name) >> 'pipe_properties'
Bases: Layer
The MapFeatureLayer
class represents Map Feature Layers. Map Feature Layers can be added to and visualized using maps.
Map Feature Layers are created by publishing feature data to a GIS
, and are exposed as a broader resource (Item
) in the GIS
. MapFeatureLayer objects can be obtained through the layers attribute on map image service Items in the GIS
.
Deprecated since version 2.4.1: Use the attachments property instead.
Deprecated since version 2.4.1: Use the attachments property instead.
The attachments
property provides a manager to work with attachments if the MapFeatureLayer
supports this functionality.
The container
property represents the MapImageLayer
to which this layer belongs.
The export_attachments
method exports attachments from the map feature layer in Imagenet
format using the output_label_field
.
Parameter
Description
output_folder
Required String. Output folder path where the attachments will be stored.
label_field
Optional. Field which contains the label/category of each feature. If None, a default folder is created.
A path to the exported attachments
The fromitem
method creates a MapFeatureLayer
from a GIS Item
.
Parameter
Description
item
Required Item
object. The type of item should be a MapServiceLayer
object.
layer_id
Optional integer. The id of the layer in the Map Serviceâs Layer. The default is 0.
A MapFeatureLayer
object
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer, MapFeatureLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_feature_layer = MapFeatureLayer.fromitem(item = map_image_item, layer_id = 2) >>> print(f"{map_feature_layer.properties.name:30}{type(map_feature_layer)}") <State Boundaries <class 'arcgis.layers._msl.layer.MapFeatureLayer'>>
The generate_renderer
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.
Note
If the operation is performed on a table, the result is a renderer object containing the data classes and no symbols.
Parameter
Description
definition
Required dict. The definition using the renderer that is generated. Use either class breaks or unique value classification definitions. See the classification definitions page in the ArcGIS REST API documentation for more information.
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.
dictionary
The get_html_popup
resource provides details about the HTML pop-up authored by the user using ArcGIS Pro or ArcGIS Desktop.
Parameter
Description
oid
Optional string. Object id of the feature to get the HTML popup.
A string
The get_unique_values
method retrieves a list of unique values for a given attribute.
Parameter
Description
attribute
Required string. The map feature layer attribute to query.
query_string
Optional string. SQL Query that will be used to filter attributes before unique values are returned.
A List
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer, MapFeatureLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_feature_layer = MapFeatureLayer.fromitem(item = map_image_item, layer_id = 2) >>> unique_values = map_feature_layer.get_unique_values(attribute ="Name", query_string ="name_2 like '%K%'") >>> type(unique_values) <List>
The query
method queries a map feature layer based on a sql statement.
Parameter
Description
where
Optional string. The default is 1=1. The selection sql statement.
text
Optional String. A literal search text. If the layer has a display field associated with it, the server searches for this text in this field.
out_fields
Optional List of field names to return. Field names can be specified either as a List of field names or as a comma separated string. The default is â*â, which returns all the fields.
object_ids
Optional string. The object IDs of this layer or table to be queried. The object ID values should be a comma-separated 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.
esriSRUnit_Meter
| esriSRUnit_StatuteMile
| esriSRUnit_Foot
| esriSRUnit_Kilometer
| esriSRUnit_NauticalMile
| esriSRUnit_USNauticalMile
time_filter
Optional list of startTime and endTime values. :Syntax:
>>> time_filter=[<startTime>, <endTime>]
Note
Specified as _dt.datetime.date
, _dt.datetime._dt.datetime
or timestamp
in milliseconds
geometry_filter
Optional filter
object. 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 in the units of out_sr. If out_sr is not specified, the value is in units 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 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 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 FeatureSet
.
return_count_only
Optional boolean. If True, the response only includes the count of features/records satisfying the query. Otherwise, the response is a FeatureSet
. The default is False. This option supersedes the returns_ids_only 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 satisfying 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 by which to order the results. Use ASC
or DESC
for ascending or descending, respectively, following every field to be ordered:
>>> order_by_fields = "STATE_NAME ASC, RACE DESC, GENDER ASC"
group_by_fields_for_statistics
Optional string. One or more field names on which to group results for calculating the statistics.
>>> group_by_fields_for_statiscits = "STATE_NAME, GENDER"
out_statistics
Optional List. The definitions for one or more field-based statistics to be calculated.
>>> out_statistics = [ { "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 + ith value). This option is ignored if return_all_records is True (i.e. by default). This parameter cannot be specified if the service does not support pagination.
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 maxRecordCount property. This option is ignored if return_all_records is True (i.e. by default). This parameter cannot be specified if the service does not support pagination.
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 set to True. If return_count_only, return_ids_only, or return_extent_only are True, this parameter is ignored.
result_type
Optional string. Controls the number of features returned by the operation. Options: 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âs properties
resource. If not specified, the query will apply to the current features.
sql_format
Optional string. The sql_format parameter can be either standard SQL92 or it can use the native SQL of the underlying datastore. The default is None, which means it depends on the useStandardizedQuery layer property. 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 the exceededTransferLimit: True property.
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.
as_df
Optional boolean. If True, the results are returned as a DataFrame instead of a FeatureSet
.
datum_transformation
Optional Integer/Dictionary. This parameter applies a datum transformation while projecting geometries in the results when out_sr is different than the layerâs spatial reference. When specifying transformations, you need to think about which datum transformation best projects the layer (not the feature service) to the outSR and sourceSpatialReference property in the layer properties. For a list of valid datum transformation ID values ad well-known text strings, see Coordinate systems and transformations. For more information on datum transformations, please see the transformation parameter in the Project operation.
Example:
Inputs
Description
WKID
Integer.
>>> datum_transformation=4326
WKT
Dict.
>>> datum_transformation = {"wkt": "<WKT>"}
Composite
Dict.
>>> datum_transformation = {"geoTransforms" : [ {"wkid" : "<id>", "forward" : True | False}, {"wkt" : "WKT", "forward" : True: False} ] }
range_values
Optional List. Allows you to filter features from the layer that are within the specified range instant or extent.
>>> range_values = [ { "name": "range name" , # single value or a value-range "value": <value> or [ <value1>, <value2> ] }, { "name": "range name 2", "value": <value> or [ <value3>, <value4> ] } ]
Note
None is allowed in value-range case to indicate infinity
# all features with values <= 1500 >>> range_values = [ {"name" : "range name", "value" : [None, 1500]} ] # all features with values >= 1000 >>> range_values = [ {"name" : "range name", "value" : [1000, None]} ]
parameter_values
Optional Dict. Allows you to filter the layers by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.
When a parameterInfo allows multiple values, you must pass them in an array.
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 at Query (Feature Service/Layer).
A FeatureSet
containing the features matching the query unless another
return type is specified, such as count
.
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer, MapFeatureLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_feature_layer = MapFeatureLayer.fromitem(item = map_image_item, layer_id = 2) >>> query_count = map_feature_layer.query(where "1=1", text = "Hurricane Data", units = "esriSRUnit_Meter", return_count_only = True, out_statistics = [ { "statisticType": "count", "onStatisticField": "Field1", "outStatisticFieldName": "Out_Field_Name1" }, { "statisticType": "avg", "onStatisticField": "Field2", "outStatisticFieldName": "Out_Field_Name2" } ], range_values= [ { "name": "range name", "value": [None, 1500] }, { "name": "range name 2", "value":[1000, None] } } ] ) >>> query_count <149>
The query_related_records
operation is performed on a MapFeatureLayer
resource. The result of this operation are FeatureSet
objects grouped by source layer/table object IDs. Each FeatureSet
contains Feature
objects including the values for the fields requested by the user.
Note
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.
Note
See the query
method for more information.
Parameter
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.
historic_moment
Optional Integer/_dt.datetime. The historic moment to query. This parameter applies only if the supportsQueryWithHistoricMoment property of the layers being queried is set to true. This setting is provided in the layer resource.
If historic_moment is not specified, the query will apply to the current features.
historic_moment=<Epoch time in milliseconds>
return_true_curves
Optional boolean. Optional parameter that is false by default. When set to true, returns true curves in output geometries; otherwise, curves are converted to densified polylines or polygons.
dict
Get/Set the Renderer of the Map Feature Layer.
Note
The renderer
property overrides the default symbology when displaying it on a Map
.
A dict
object used to update and alter JSON
Starting at Enterprise 10.7.1+, instead of querying time-enabled map service layers or time-enabled feature service layers, a time filter can be set using the time_filter
property. Time can be filtered as Python _dt.datetime, objects or strings representing Unix epoch values in milliseconds. An extent can be specified by separating the start and stop values comma.
>>> import _dt.datetime as dt >>> map_feature_lyr.time_filter = [dt._dt.datetime(2021, 1, 1), dt._dt.datetime(2022, 1, 10)]
Bases: MapFeatureLayer
The MapRasterLayer
class represents a geo-referenced image hosted in a Map Service
.
Bases: Layer
The MapImageLayer
allows you to display and analyze data from sublayers defined in a map service, exporting images instead of features. Map service images are dynamically generated on the server based on a request, which includes an LOD (level of detail), a bounding box, dpi, spatial reference and other options. The exported image is of the entire map extent specified.
Note
MapImageLayer
does not display tiled images. To display tiled map service layers, see TileLayer
.
The create_dynamic_layer
method creates a dynamic layer. A dynamic layer / table represents a single layer / table of a map service published by ArcGIS Server or of a registered workspace. This resource is supported only when the map image layer supports dynamic layers, as indicated by supportsDynamicLayers
on the map image layer properties.
Parameter
Description
layer
Required dict. Dynamic layer/table source definition.
Syntax:
{
âidâ: <layerOrTableId>,
âsourceâ: <layer source>, //required
âdefinitionExpressionâ: â<definitionExpression>â,
âdrawingInfoâ:
{
ârendererâ: <renderer>,
âtransparencyâ: <transparency>,
âscaleSymbolsâ: <true,false>,
âshowLabelsâ: <true,false>,
âlabelingInfoâ: <labeling info>
},
âlayerTimeOptionsâ: //supported only for time enabled map layers
{
âuseTimeâ : <true,false>,
âtimeDataCumulativeâ : <true,false>,
âtimeOffsetâ : <timeOffset>,
âtimeOffsetUnitsâ : â<esriTimeUnitsCenturies,esriTimeUnitsDays,
esriTimeUnitsDecades,esriTimeUnitsHours,
esriTimeUnitsMilliseconds,esriTimeUnitsMinutes,
esriTimeUnitsMonths,esriTimeUnitsSeconds,
esriTimeUnitsWeeks,esriTimeUnitsYears |
esriTimeUnitsUnknown>â
}
}
FeatureLayer
or None (if not enabled)
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> layer_to_add ={ "id": <layerId>, "source": <layer source> "definitionExpression": "<definitionExpression>", "drawingInfo": { "renderer": <renderer>, "transparency": <transparency>, "scaleSymbols": <true>, "showLabels": <true>, "labelingInfo": <labeling info> }, "layerTimeOptions": { "useTime" : <true,false>, "timeDataCumulative" : <true>, "timeOffset" : <timeOffset>, "timeOffsetUnits" : "<esriTimeUnitsCenturies>" } } >>> new_layer = map_image_item.create_dynamic_layer(layer= layer_to_add) >>>type(new_layer) <arcgis.features.FeatureLayer>
The estimate_export_tiles_size
method is an asynchronous task that allows estimation of the size of the tile package or the cache data set that you download using the export_tiles
operation. This operation can also be used to estimate the tile count in a tile package and determine if it will exceed the maxExportTileCount
limit set by the administrator of the service. The result of this operation is MapServiceJob
. This job response contains reference to Map Service Result
resource that returns the total size of the cache to be exported (in bytes) and the number of tiles that will be exported.
Parameter
Description
export_by
Required string. The criteria that will be used to select the tile service levels to export. The values can be Level IDs, cache scales or the Resolution (in the case of image services). Values:
âlevelIdâ | âresolutionâ | âscaleâ
levels
Required string. Specify the tiled service levels for which you want to get the estimates. The values should correspond to Level IDs, cache scales or the Resolution as specified in export_by parameter. The values can be comma separated values or a range.
Example 1: 1,2,3,4,5,6,7,8,9 Example 2: 1-4,7-9
tile_package
Optional boolean. Allows estimating the size for either a tile package or a cache raster data set. Specify the value true for tile packages format and false for Cache Raster data set. The default value is False
export_extent
The extent (bounding box) of the tile package or the cache dataset to be exported. If extent does not include a spatial reference, the extent values are assumed to be in the spatial reference of the map. The default value is full extent of the tiled map service. Syntax: <xmin>, <ymin>, <xmax>, <ymax> Example: -104,35.6,-94.32,41
area_of_interest
Optional dictionary or Polygon. This allows exporting tiles within the specified polygon areas. This parameter supersedes extent parameter.
Example:
{ âfeaturesâ: [{âgeometryâ:{âringsâ:[[[-100,35],
[-100,45],[-90,45],[-90,35],[-100,35]]],
âspatialReferenceâ:{âwkidâ:4326}}}]}
asynchronous
Optional boolean. The estimate function is run asynchronously requiring the tool status to be checked manually to force it to run synchronously the tool will check the status until the estimation completes. The default is True, which means the status of the job and results need to be checked manually. If the value is set to False, the function will wait until the task completes.
dictionary
The export_map
operation is performed on a map service resource. The result of this operation is a map image resource. This resource provides information about the exported map image such as its URL, its width and height, extent and scale.
Parameter
Description
bbox
Required string. The extent (bounding box) of the exported image. Unless the bbox_sr parameter has been specified, the bbox is assumed to be in the spatial reference of the map.
bbox_sr
Optional integer, SpatialReference
. The spatial reference of the bbox.
size
Optional string. size - size of image in pixels
dpi
Optional integer. dots per inch
image_sr
Optional integer, SpatialReference
. The spatial reference of the output image.
image_format
Optional string. The format of the exported image. The default format is .png. Values:
png | png8 | png24 | jpg | pdf | bmp | gif | svg | svgz | emf | ps | png32
layer_defs
Optional dict. Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Definition expression for a layer that is published with the service will be always honored.
layers
Optional string. Determines which layers appear on the exported map. There are four ways to specify which layers are shown:
show
: Only the layers specified in this list will be exported.
hide
: All layers except those specified in this list will be exported.
include
: In addition to the layers exported by default, the layers specified in this list will be exported.
exclude
: The layers exported by default excluding those specified in this list will be exported.
transparent
Optional boolean. If true, the image will be exported with the background color of the map set as its transparent color. The default is false.
Note
Only the .png and .gif formats support transparency.
time_value
Optional list. The time instant or the time extent of the features to be identified.
time_options
Optional dict. The time options per layer. Users can indicate whether or not the layer should use the time extent specified by the time parameter or not, whether to draw the layer features cumulatively or not and the time offsets for the layer.
dynamic_layers
Optional dict. Use dynamicLayers property to reorder layers and change the layer data source. dynamicLayers can also be used to add new layer that was not defined in the map used to create the map service. The new layer should have its source pointing to one of the registered workspaces that was defined at the time the map service was created. The order of dynamicLayers array defines the layer drawing order. The first element of the dynamicLayers is stacked on top of all other layers. When defining a dynamic layer, source is required.
gdb_version
Optional string. Switch map layers to point to an alternate geodatabase version.
scale
Optional float. Use this parameter to export a map image at a specific map scale, with the map centered around the center of the specified bounding box (bbox)
rotation
Optional float. Use this parameter to export a map image rotated at a specific angle, with the map centered around the center of the specified bounding box (bbox). It could be positive or negative number.
transformations
Optional list. Use this parameter to apply one or more datum transformations to the map when sr is different than the map serviceâs spatial reference. It is an array of transformation elements.
map_range_values
Optional list. Allows you to filter features in the exported map from all layer that are within the specified range instant or extent.
layer_range_values
Optional dictionary. Allows you to filter features for each individual layer that are within the specified range instant or extent. Note: Check range infos at the layer resources for the available ranges.
layer_parameter
Optional list. Allows you to filter the features of individual layers in the exported map by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.
A string, image of the map.
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_image_item.export_map(bbox="-104,35.6,-94.32,41", bbox_sr = 4326, image_format ="png", layers = "include", transparent = True, scale = 40.0, rotation = -45.0 )
The export_Tiles
operation is performed as an asynchronous task and allows client applications to download map tiles from a server for offline use. This operation is performed on a Map Service
that allows clients to export cache tiles. The result of this operation is a Map Service Job
. This job response contains a reference to the Map Service Result
resource, which returns a URL to the resulting tile package (.tpk) or a cache raster dataset. export_Tiles
can be enabled in a service by using ArcGIS Desktop or the ArcGIS Server Administrator Directory. In ArcGIS Desktop make an admin or publisher connection to the server, go to service properties, and enable Allow Clients
to Export Cache Tiles
in the advanced caching page of the Service Editor
. You can also specify the maximum tiles clients will be allowed to download.
Note
The default maximum allowed tile count is 100,000. To enable this capability using the Administrator Directory, edit the service, and set the properties exportTilesAllowed
= True
and maxExportTilesCount
= 100000.
Note
In ArcGIS Server 10.2.2 and later versions, exportTiles is supported as an operation of the Map Server. The use of the http://Map_Service/exportTiles/submitJob
operation is deprecated. You can provide arguments to the exportTiles operation as defined in the following parameters table:
Parameter
Description
levels
Required string. Specifies the tiled service levels to export. The values should correspond to Level IDs, cache scales. or the resolution as specified in export_by parameter. The values can be comma separated values or a range. Make sure tiles are present at the levels where you attempt to export tiles. Example 1: 1,2,3,4,5,6,7,8,9 Example 2: 1-4,7-9
export_by
Required string. The criteria that will be used to select the tile service levels to export. The values can be Level IDs, cache scales. or the resolution. The default is âLevelIDâ. Values:
levelId | resolution | scale
tile_package
Optional boolean. Allows exporting either a tile package or a cache raster data set. If the value is true, output will be in tile package format, and if the value is false, a cache raster data set is returned. The default value is True.
export_extent
Optional dictionary or string. The extent (bounding box) of the tile package or the cache dataset to be exported. If extent does not include a spatial reference, the extent values are assumed to be in the spatial reference of the map. The default value is full extent of the tiled map service. Syntax:
<xmin>, <ymin>, <xmax>, <ymax>
Example 1: -104,35.6,-94.32,41 Example 2:
{âxminâ : -109.55, âyminâ : 25.76,
âxmaxâ : -86.39, âymaxâ : 49.94,
âspatialReferenceâ : {âwkidâ : 4326}}
optimize_for_size
Optional boolean. Use this parameter to enable compression of JPEG tiles and reduce the size of the downloaded tile package or the cache raster data set. Compressing tiles slightly compromises the quality of tiles but helps reduce the size of the download. Try sample compressions to determine the optimal compression before using this feature. The default value is True.
compression=75,
Optional integer. When optimize_for_size=true, you can specify a compression factor. The value must be between 0 and 100. The value cannot be greater than the default compression already set on the original tile. For example, if the default value is 75, the value of compressionQuality must be between 0 and 75. A value greater than 75 in this example will attempt to up sample an already compressed tile and will further degrade the quality of tiles.
area_of_interest
Optional dictionary, Polygon. The area_of_interest polygon allows exporting tiles within the specified polygon areas. This parameter supersedes the exportExtent parameter.
Example:
{ âfeaturesâ: [{âgeometryâ:{âringsâ:[[[-100,35],
[-100,45],[-90,45],[-90,35],[-100,35]]],
âspatialReferenceâ:{âwkidâ:4326}}}]}
asynchronous
Optional boolean. Default False, this value ensures the returns are returned to the user instead of the user having the check the job status manually.
storage_format
Optional string. Specifies the type of tile package that will be created.
tpk
- Tiles are stored using Compact storage format. It is supported across the ArcGIS platform.
tpkx
- Tiles are stored using CompactV2 storage format, which provides better performance on network shares and cloud store directories. This improved and simplified package structure type is supported by newer versions of ArcGIS products such as ArcGIS Online 7.1, ArcGIS Enterprise 10.7, and ArcGIS Runtime 100.5. This is the default.
A path to download file is asynchronous is False
. If True
, a dictionary is returned.
The find
method performs the map service find
operation.
Parameter
Description
search_text
Required string.The search string. This is the text that is searched across the layers and fields the user specifies.
layers
Optional string. The layers to perform the identify operation on. There are three ways to specify which layers to identify on:
top: Only the top-most layer at the specified location.
visible: All visible layers at the specified location.
all: All layers at the specified location.
contains
Optional boolean. If false, the operation searches for an exact match of the search_text string. An exact match is case sensitive. Otherwise, it searches for a value that contains the search_text provided. This search is not case sensitive. The default is true.
search_fields
Optional string. List of field names to look in.
sr
Optional dict, string, or SpatialReference. The well-known ID of the spatial reference of the input and output geometries as well as the map_extent. If sr is not specified, the geometry and the map_extent are assumed to be in the spatial reference of the map, and the output geometries are also in the spatial reference of the map.
layer_defs
Optional dict. Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Definition expression for a layer that is published with the service will be always honored.
return_geometry
Optional boolean. If true, the resultset will include the geometries associated with each result. The default is true.
max_offset
Optional integer. This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the identify operation.
precision
Optional integer. This option can be used to specify the number of decimal places in the response geometries returned by the identify operation. This applies to X and Y values only (not m or z-values).
dynamic_layers
Optional dict. Use dynamicLayers property to reorder layers and change the layer data source. dynamicLayers can also be used to add new layer that was not defined in the map used to create the map service. The new layer should have its source pointing to one of the registered workspaces that was defined at the time the map service was created. The order of dynamicLayers array defines the layer drawing order. The first element of the dynamicLayers is stacked on top of all other layers. When defining a dynamic layer, source is required.
return_z
Optional boolean. If true, Z values will be 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 will be included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
gdb_version
Optional string. Switch map layers to point to an alternate geodatabase version.
return_unformatted
Optional boolean. If true, the values in the result will not be formatted i.e. numbers will be returned as is and dates will be returned as epoch values.
return_field_name
Optional boolean. If true, field names will be returned instead of field aliases.
transformations
Optional list. Use this parameter to apply one or more datum transformations to the map when sr is different from the map serviceâs spatial reference. It is an array of transformation elements.
map_range_values
Optional list. Allows you to filter features in the exported map from all layer that are within the specified range instant or extent.
layer_range_values
Optional dictionary. Allows you to filter features for each individual layer that are within the specified range instant or extent. Note: Check range infos at the layer resources for the available ranges.
layer_parameters
Optional list. Allows you to filter the features of individual layers in the exported map by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.
A dictionary
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> search_results = map_image_item.find(search_text = "Hurricane Data", contains = True, layers = "top", return_geometry = False, max_offset = 100, return_z = True, return_m = False, ) >>> type(search_results) <Dictionary>
The fromitem
method returns the layer at the specified index from a layer Item
object.
Parameter
Description
item
Required Item. An item containing layers.
index
Optional int. The index of the layer amongst the itemâs layers
The layer at the specified index.
# Usage Example >>> layer.fromitem(item="9311d21a9a2047d19c0faaebd6f2cca6", index=3)
The generate_Kml
operation is performed on a map service resource. The result of this operation is a KML document wrapped in a KMZ file.
Note
The document contains a network link to the KML Service endpoint with properties and parameters you specify.
Parameter
Description
save_location
Required string. Save folder.
name
Required string. The name of the resulting KML document. This is the name that appears in the Places panel of Google Earth.
layers
Required string. the layers to perform the generateKML operation on. The layers are specified as a comma-separated list of layer ids.
options
Required string. The layer drawing options. Based on the option chosen, the layers are drawn as one composite image, as separate images, or as vectors. When the KML capability is enabled, the ArcGIS Server administrator has the option of setting the layer operations allowed. If vectors are not allowed, then the caller will not be able to get vectors. Instead, the caller receives a single composite image. values: composite, separateImage, nonComposite
A string to the file path
The identify
operation is performed on a map service resource to discover features at a geographic location. The result of this operation is an identify results resource.
Note
Each identified result includes its name
, layer ID
, layer name
, geometry
, geometry type
, and other attributes of that result as name-value pairs.
Parameter
Description
geometry
Required Geometry
or list. The geometry to identify on. The type of the geometry is specified by the geometryType parameter. The structure of the geometries is same as the structure of the JSON geometry objects returned by the API (See Geometry Objects). In addition to the JSON structures, for points and envelopes, you can specify the geometries with a simpler comma-separated syntax.
geometry_type
Required string.The type of geometry specified by the geometry parameter. The geometry type could be a point, line, polygon, or an envelope. Values:
âPointâ | âMultipointâ | âPolylineâ | âPolygonâ | âEnvelopeâ
map_extent
Required string. The extent or bounding box of the map currently being viewed.
sr
Optional dict, string, or SpatialReference. The well-known ID of the spatial reference of the input and output geometries as well as the map_extent. If sr is not specified, the geometry and the map_extent are assumed to be in the spatial reference of the map, and the output geometries are also in the spatial reference of the map.
layer_defs
Optional dict. Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Definition expression for a layer that is published with the service will be always honored.
time_value
Optional list. The time instant or the time extent of the features to be identified.
time_options
Optional dict. The time options per layer. Users can indicate whether or not the layer should use the time extent specified by the time parameter or not, whether to draw the layer features cumulatively or not and the time offsets for the layer.
layers
Optional string. The layers to perform the identify operation on. There are three ways to specify which layers to identify on:
top
: Only the top-most layer at the specified location.
visible
: All visible layers at the specified location.
all
: All layers at the specified location.
tolerance
Optional integer. The distance in screen pixels from the specified geometry within which the identify
operation should be performed. The value for the tolerance is an integer.
image_display
Optional string. The screen image display parameters (width, height, and DPI) of the map being currently viewed. The mapExtent and the image_display parameters are used by the server to determine the layers visible in the current extent. They are also used to calculate the distance on the map to search based on the tolerance in screen pixels.
Syntax:
<width>, <height>, <dpi>
return_geometry
Optional boolean. If true, the result set will include the geometries associated with each result. The default is true.
max_offset
Optional integer. This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the identify operation.
precision
Optional integer. This option can be used to specify the number of decimal places in the response geometries returned by the identify operation. This applies to X and Y values only (not m or z-values).
dynamic_layers
Optional dict. Use dynamicLayers property to reorder layers and change the layer data source. dynamicLayers can also be used to add new layer that was not defined in the map used to create the map service. The new layer should have its source pointing to one of the registered workspaces that was defined at the time the map service was created. The order of dynamicLayers array defines the layer drawing order. The first element of the dynamicLayers is stacked on top of all other layers. When defining a dynamic layer, source is required.
return_z
Optional boolean. If true, Z values will be 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 will be included in the results if the features have M values. Otherwise, M values are not returned. The default is false.
gdb_version
Optional string. Switch map layers to point to an alternate geodatabase version.
return_unformatted
Optional boolean. If true, the values in the result will not be formatted i.e. numbers will be returned as is and dates will be returned as epoch values. The default is False.
return_field_name
Optional boolean. Default is False. If true, field names will be returned instead of field aliases.
transformations
Optional list. Use this parameter to apply one or more datum transformations to the map when sr is different than the map serviceâs spatial reference. It is an array of transformation elements. Transformations specified here are used to project features from layers within a map service to sr.
map_range_values
Optional list of dictionary(ies). Allows for the filtering features in the exported map from all layer that are within the specified range instant or extent.
layer_range_values
Optional Dictionary. Allows for the filtering of features for each individual layer that are within the specified range instant or extent.
layer_parameters
Optional list of dictionary(ies). Allows for the filtering of the features of individual layers in the exported map by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.
A dictionary
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> identified = map_image_item.identify(geometry = geom1, geometry_type = "Multipoint", image_display = "width", return_geometry =True, return_z = True, return_m = True, return_field_name = True, ) >>> type(identified) <Dictionary>
The item_info
method retrieves the serviceâs itemâs information.
A dictionary
The kml
method retrieves the KML file for the layer.
A KML file
The legend
property represents a map serviceâs legend. It returns the legend information for all layers in the service. Each layerâs legend information includes the symbol images and labels for each symbol. Each symbol is an image of size 20 x 20 pixels at 96 DPI. Additional information for each layer such as the layer ID, name, and min and max scales are also included.
Note
The legend symbols include the base64 encoded imageData as well as a url that could be used to retrieve the image from the server.
Dictionary of legend information
The manager
property returns an instance of MapImageLayerManager
class for ArcGIS Online and EnterpriseMapImageLayerManager
class for ArcGIS Enterprise which provides methods and properties for administering this service.
The metadata
property retrieves the serviceâs XML metadata file
An XML metadata file
The thumbnail
method retrieves the thumbnail.
Note
If a thumbnail is present, this operation will download the image to local disk.
A path to the downloaded thumbnail, or None.
Bases: _GISResource
The MapImageLayerManager
class allows administration (if access permits) of ArcGIS Online Hosted Tile Layers or Cached Map Services. A MapImageLayer
offers access to the Map Server endpoints that allow you to edit the tile service, update tiles, refresh, and more.
To use this manager off of the MapImageLayer Class, pass in a url ending with /MapServer when instantiating that class.
Note
Map Image Layers are created from Enterprise Services and their manager can be accessed through the EnterpriseMapImageLayerManager.
The cancel_job
operation supports cancelling a job while update tiles is running from a hosted feature service. The result of this operation is a response indicating success or failure with error code and description.
Parameter
Description
job_id
Required String. The job id to cancel.
The delete_tiles
method deletes tiles from the current cache.
Parameter
Description
levels
Required string, The level to delete. Example, 0-5,10,11-20 or 1,2,3 or 0-5
extent
Optional dictionary, If specified, the tiles within this extent will be deleted or will be deleted based on the serviceâs full extent.
A dictionary
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_layer = MapImageLayer("<url>", gis) >>> mil_manager = map_image_layer.manager >>> deleted_tiles = mil_manager.delete_tiles(levels = "11-20", extent = {"xmin":6224324.092137296, "ymin":487347.5253569535, "xmax":11473407.698535524, "ymax":4239488.369818687, "spatialReference":{"wkid":102100} } ) >>> type(deleted_tiles) <Dictionary>
The edit_tile_service
operation updates a Tile Serviceâs properties.
Parameter
Description
service_definition
Required String. Updates a service definition.
min_scale
Required float. Sets the services minimum scale for caching.
max_scale
Required float. Sets the services maximum scale for caching.
source_item_id
Required String. The Source Item ID is the GeoWarehouse Item ID of the map service
export_tiles_allowed
Required boolean. exports_tiles_allowed
sets the value to let users export tiles
max_export_tile_count
Optional float. max_export_tile_count
sets the maximum amount of tiles to be exported from a single call.
Note
The default value is 100000.
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_layer = MapImageLayer("<url>", gis) >>> mil_manager = map_image_layer.manager >>> mil_manager.edit_tile_service(service_definition = "updated service definition", min_scale = 50, max_scale = 100, source_item_id = "geowarehouse_item_id", export_tiles_allowed = True, max_Export_Tile_Count = 10000 )
The import_tiles
method imports tiles from an Item
object.
Before executing this operation, you will need to make certain the following prerequisites are met:
Upload the TPK you wish to merge with the existing service, take note of its item ID.
Make certain that the uploaded TPK, TPKX itemâs tiling scheme matches with the service you wish to import into.
The source service LODâs should include all the LODâs that are part of the imported TPK item. For example, if the source service has tiles from levels 0 through 10, you can import tiles only within these levels and not above it.
A dictionary
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_layer = MapImageLayer("<url>", gis) >>> mil_manager = map_image_layer.manager >>> imported_tiles = mil_manager.import_tiles(item="<item-id>", levels = "11-20", extent = {"xmin":6224324.092137296, "ymin":487347.5253569535, "xmax":11473407.698535524, "ymax":4239488.369818687, "spatialReference":{"wkid":102100} }, merge = True, replace = True ) >>> type(imported_tiles) <Dictionary>
Returns the job statistics for the given jobId
The refresh
operation refreshes a service, which clears the web server cache for the service.
The rerun_job
operation supports re-running a canceled job from a hosted map service. The result of this operation is a response indicating success or failure with error code and description.
Parameter
Description
job_id
required string, job to reprocess
code
required string, parameter used to re-run a given jobs with a specific error code: ALL | ERROR | CANCELED
A boolean or dictionary
The update_tiles
method starts tile generation for ArcGIS Online. The levels of detail and the extent are needed to determine the area where tiles need to be rebuilt.
Note
The update_tiles
operation is for ArcGIS Online only.
Parameter
Description
levels
Optional String / List of integers, The level of details to update. Example: â1,2,10,20â or [1,2,10,20]
extent
Optional String / Dict. The area to update as Xmin, YMin, XMax, YMax Example:
â-100,-50,200,500â or {âxminâ:100, âyminâ:200, âxmaxâ:105, âymaxâ:205}
merge
Optional Boolean. Default is false and applicable to compact cache storage format. It controls whether the bundle files from the TPK file are merged with the one in the existing cached service. Otherwise, the bundle files are overwritten.
replace
Optional Boolean. Default is false, applicable to compact cache storage format and used when merge=true. It controls whether the new tiles will replace the existing ones when merging bundles.
Dictionary. If the product is not ArcGIS Online tile service, the result will be None.
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_layer = MapImageLayer("<url>", gis) >>> mil_manager = map_image_layer.manager >>> update_tiles = mil_manager.update_tiles(levels = "11-20", extent = {"xmin":6224324.092137296, "ymin":487347.5253569535, "xmax":11473407.698535524, "ymax":4239488.369818687, "spatialReference":{"wkid":102100} } ) >>> type(update_tiles) <Dictionary>
Bases: _GISResource
The EnterpriseMapImageLayerManager
class allows administration (if access permits) of ArcGIS Enterprise Map Image Layers and Tile Layers. A MapImageLayer
offers access to layer content.
Note
Url must be admin url such as: https://services.myserver.com/arcgis/rest/admin/services/serviceName/MapServer/
Allows for the switching of the service provide and how it is hosted on the ArcGIS Server instance.
Provider parameter options:
ArcObjects means the service is running under the ArcMap runtime i.e. published from ArcMap
ArcObjects11: means the service is running under the ArcGIS Pro runtime i.e. published from ArcGIS Pro
DMaps: means the service is running in the shared instance pool (and thus running under the ArcGIS Pro provider runtime)
Boolean
deletes a service from arcgis server
To edit a service, you need to submit the complete JSON representation of the service, which includes the updates to the service properties. Editing a service causes the service to be restarted with updated properties.
Parameter
Description
service_dictionary
Required dict. The service JSON as a dictionary.
boolean
starts the specific service
stops the specific service
Bases: MapFeatureLayer
The MapTable
class represents entity classes with uniform properties.
Note
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 a MapFeatureLayer
, except that the rows (Feature
) in a table do not have a geometry, and tables ignore any geometry related operation.
The fromitem
method creates a MapTable
from a GIS Item
.
Parameter
Description
item
Required Item
object. The type of item should be a MapImageService
object.
layer_id
Optional integer. The id of the layer in the Map Serviceâs Layer. The default is 0.
A MapTable
object
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer, MapTable >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_table = MapFeatureLayer.fromitem(item = map_image_item, layer_id = 2) >>> print(f"{map_table.properties.name:30}{type(map_table)}") <State Boundaries <class 'arcgis.layers.MapTable'>>
The query
method queries a Table Layer based on a set of criteria from a sql statement.
Parameter
Description
where
Optional string. The default is 1=1. The selection sql statement.
out_fields
Optional List of field names to return. Field names can be specified either as a List of field names or as a comma separated string. The default is â*â, which returns all the fields.
object_ids
Optional string. The object IDs of this layer or table to be queried. The object ID values should be a comma-separated string.
time_filter
Optional list. The format is of [<startTime>, <endTime>] using _dt.datetime.date, _dt.datetime._dt.datetime or timestamp in milliseconds.
>>> time_filter=[<startTime>, <endTime>]
Specified as _dt.datetime.date
, _dt.datetime._dt.datetime
or timestamp
in milliseconds.
>>> import _dt.datetime as dt >>> time_filter = [dt._dt.datetime(2022, 1, 1), dt.dateime(2022, 1, 12)]
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 FeatureSet
.
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 FeatureSet
. The default is False. This option supersedes the return_ids_only parameter. If return_count_only = True, the response will return both the count and the extent.
order_by_fields
Optional string. One or more field names by which to order the results. Use ASC
or DESC
for ascending or descending, respectively, following every field to be ordered:
>>> order_by_fields = "STATE_NAME ASC, RACE DESC, GENDER ASC"
group_by_fields_for_statistics
Optional string. One or more field names on which to group results for calculating the statistics.
>>> group_by_fields_for_statiscits = "STATE_NAME, GENDER"
out_statistics
Optional string. The definitions for one or more field-based statistics to be calculated.
>>> out_statistics = [ { "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" } ]
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, result_offset + ith). 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 maxRecordCount property. This option is ignored if return_all_records is True (i.e. by default).
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.
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 or it can use the native SQL of the underlying datastore. The default is none which means the sql_format depends on the useStandardizedQuery parameter. Values: none
| standard
| native
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 the exceededTransferLimit: true property.
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.
as_df
Optional boolean. If True, the results are returned as a DataFrame instead of a FeatureSet
.
range_values
Optional List. Allows you to filter features from the layer that are within the specified range instant or extent.
>>> range_values = [ { "name": "range name", "value": <value> or [ <value1>, <value2> ] }, { "name": "range name 2", "value": <value> or [ <value3>, <value4>] } } ]
Note
None is allowed in value-range case â that means infinity
# all features with values <= 1500 >>> range_values = {"name" : "range name", "value :[None, 1500]} # all features with values >= 1000 >>> range_values = {"name" : "range name", "value" : [1000, None]}
parameter_values
Optional Dict. Allows you to filter the features layers by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.
When parameterInfo allows multiple values, you must pass them in an array.
Note: Check parameterInfos at the layer properties
for the available parameterized filters, their default values and expected data type.
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 possible parameters is documented at Query (Map Service/Layer)
A FeatureSet
or Pandaâs DataFrame containing the Feature
objects matching the query, unless another return type is specified, such as count
# USAGE EXAMPLE >>> from arcgis.layers import MapImageLayer, MapFeatureLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061") >>> map_feature_layer = MapFeatureLayer.fromitem(item = map_image_item, layer_id = 2) >>> query_count = map_feature_layer.query(where "1=1", text = "Hurricane Data", units = "esriSRUnit_Meter", return_count_only = True, out_statistics = [ { "statisticType": "count", "onStatisticField": "Field1", "outStatisticFieldName": "Out_Field_Name1" }, { "statisticType": "avg", "onStatisticField": "Field2", "outStatisticFieldName": "Out_Field_Name2" } ], range_values= [ { "name": "range name", "value": [None, 1500] }, { "name": "range name 2", "value":[1000, None] } } ] ) >>> query_count <149>
Bases: Layer
A Vector Tile Layer is a type of data layer used to access and display tiled data and its corresponding styles. This is stored as an item in ArcGIS and is used to access a vector tile service. Layer data include its name, description, and any overriding style definition.
Export vector tile layer
Parameter
Description
levels
Optional string.Specifies the tiled service levels to export. The values should correspond to Level IDs. The values can be comma-separated values or a range of values. Ensure that the tiles are present at each specified level.
# Example: # Comma-separated values >>> levels=1,2,3,4,5,6,7,8,9 //Range values >>> levels=1-4, 7-9
export_extent
Optional dictionary of the extent (bounding box) of the vector tile package to be exported. The extent should be within the specified spatial reference. The default value is the full extent of the tiled map service.
# Example: >>> export_extent = { "xmin": -109.55, "ymin" : 25.76, "xmax": -86.39, "ymax" : 49.94, "spatialReference": {"wkid": 4326} }
polygon
Optional dictionary. Introduced at 10.7. A JSON representation of a polygon, containing an array of rings and a spatialReference.
# Example: polygon = { "rings": [ [[6453,16815],[10653,16423], [14549,5204],[-7003,6939], [6453,16815]],[[914,7992], [3140,11429],[1510,10525], [914,7992]] ], "spatialReference": {"wkid": 54004} }
create_item
Optional boolean. Indicated whether an item will be created from the export (True) or a path to a downloaded file (False). Default is False. ArcGIS Online Only.
A list of exported item dictionaries or a single path
The fromitem
method returns the layer at the specified index from a layer Item
object.
Parameter
Description
item
Required Item. An item containing layers.
index
Optional int. The index of the layer amongst the itemâs layers
The layer at the specified index.
# Usage Example >>> layer.fromitem(item="9311d21a9a2047d19c0faaebd6f2cca6", index=3)
The info
property retrieves the relative paths to a list of resource files.
A list of relative paths
The manager
property returns an instance of VectorTileLayerManager
class or EnterpriseVectorTileLayerManager
class which provides methods and properties for administering this service.
The styles property returns styles for vector tiles in Mapbox GL Style specification version 8. The response for this styles resource includes the sprite and glyphs properties, with a relative path to the Vector Tile Sprite and Vector Tile Font resources. It also includes the version property, which represents the version of the style specification.
The tile_fonts
method retrieves glyphs in protocol buffer format.
Parameter
Description
fontstack
Required string.
Note
The template url for this font resource is represented in the Vector Tile Style resource.
stack_range
Required string that depict a range. Ex: â0-255â
Glyphs in PBF format
The tile_map property describes a quadtree of tiles and can be used to avoid requesting tiles that donât exist in the server. Each node of the tree has an associated tile. The root node (lod 0) covers the entire extent of the data. Children are identified by their position with NW, NE, SW, and SE. Tiles are identified by lod/h/v, where h and v are indexes on a 2^lod by 2^lod grid . These values are derived from the position in the tree. The tree has a variable depth. A node doesnât have children if the complexity of the data in the associated tile is below a threshold. This threshold is based on a combination of number of features, attributes, and vertices.
The tile_sprite
resource retrieves sprite images and metadata.
Parameter
Description
out_format
Optional string. Default is âsprite.jsonâ.
Values: sprite.json
| sprite.png
| sprite@2x.png
Sprite image and metadata.
The vector_tile
method represents a single vector tile for the map.
Note
The bytes for the tile at the specified level, row and column are returned in PBF format. If a tile is not found, an error is returned.
Parameter
Description
level
Required string. A level number as a string.
row
Required string. Number of the row that the tile belongs to.
column
Required string. Number of the column that tile belongs to.
Bytes in PBF format
Bases: _GISResource
The VectorTileLayerManager
class allows administration (if access permits) of ArcGIS Online Hosted Vector Tile Layers. A Hosted Vector Tile Service is published through a Feature Layer and these methods can only be applied to such Vector Tile Services. A VectorTileLayer
offers access to layer content.
Note
Url must be admin url such as: https://services.myserver.com/arcgis/rest/admin/services/serviceName/VectorTileServer/
The cancel operation supports cancelling a job while update tiles is running from a hosted feature service. The result of this operation is a response indicating success or failure with error code and description.
This operation deletes the specified asynchronous job being run by the geoprocessing service. If the current status of the job is SUBMITTED or EXECUTING, it will cancel the job. Regardless of status, it will remove all information about the job from the system. To cancel a job in progress without removing information, use the Cancel Job operation.
The delete_tiles
method deletes tiles from the current cache.
Note
The delete_tiles
operation is for ArcGIS Online only and can only be used for a Vector Tile Layer published from a service directory.
A dictionary
# USAGE EXAMPLE >>> from arcgis.layers import VectorTileLayer >>> from arcgis.gis import GIS # connect to your GIS >>> gis = GIS(url, username, password) >>> vector_layer_item = gis.content.get('abcd_item-id') >>> vector_tile_layer = VectorTileLayer.fromitem(vector_layer_item) >>> vtl_manager = vector_tile_layer.manager >>> deleted_tiles = vtl_manager.delete_tiles() >>> type(deleted_tiles)
The edit operation enables editing many parameters in the service definition as well as the source_item_id which can be found by looking at the Vector Tile Layerâs related items.
Parameter
Description
source_item_id
Optional String. The Source Item ID is the GeoWarehouse Item ID of the tile service.
export_tiles_allowed
Optional boolean. exports_tiles_allowed
sets the value to let users export tiles
min_scale
Optional float. Sets the services minimum scale for caching. At the moment this parameter can only be set if the Vector Tile Layer was published through a service directory.
max_scale
Optional float. Sets the services maximum scale for caching. At the moment this parameter can only be set if the Vector Tile Layer was published through a service directory.
max_export_tile_count
Optional int. max_export_tile_count
sets the maximum amount of tiles to be exported from a single call.
layers
Optional list of dictionaries. Each dict representing a layer.
Syntax Example:
layers = [{
ânameâ: âLayer Nameâ,
âidâ: 1159321,
âlayerIdâ: 0,
âtableNameâ: âtableNameâ,
âtypeâ: âFeature Layerâ,
âxssTrustedFieldsâ: ââ
}]
cache_max_age
Optional int. The maximum cache age. At the moment this parameter can only be set if the Vector Tile Layer was published through a feature service.
max_zoom
Optional int. The maximum zoom level. At the moment this parameter can only be set if the Vector Tile Layer was published through a feature service.
# USAGE EXAMPLE >>> from arcgis.layers import VectorTileLayer >>> from arcgis.gis import GIS # connect to your GIS and get the tile layer item >>> gis = GIS(url, username, password) >>> vector_layer_item = gis.content.get('abcd_item-id') >>> source_item_id = vector_tile_item.related_items(rel_type="Service2Data", direction="forward")[0]["id"] >>> vector_tile_layer = VectorTileLayer.fromitem(vector_layer_item) >>> vtl_manager = vector_tile_layer.manager >>> vtl_manager.edit_tile_service( min_scale = 50, max_scale = 100, source_item_id = source_item_id, export_tiles_allowed = True, max_Export_Tile_Count = 10000 )
The tile service job summary (jobs) resource represents a summary of all jobs associated with a vector tile service. Each job contains a jobid that corresponds to the specific jobid run and redirects you to the Job Statistics page.
The tile service job summary (jobs) resource represents a summary of all jobs associated with a vector tile service. Each job contains a jobid that corresponds to the specific jobid run and redirects you to the Job Statistics page.
The rebuild_cache operation update the vector tile layer cache to reflect any changes made to the feature layer used to publish this vector tile layer. The results of the operation is a response indicating success, which redirects you to the Job Statistics page, or failure.
The refresh operation clears and refreshes the service cache.
The rerun_job
operation supports re-running a canceled job from a hosted map service. The result of this operation is a response indicating success or failure with error code and description.
Parameter
Description
code
required string, parameter used to re-run a given jobs with a specific error code: ALL | ERROR | CANCELED
job_id
required string, job to reprocess
A boolean or dictionary
The status operation returns a dictionary indicating whether a service is started (available) or stopped.
The swap operation replaces the current service cache with an existing one.
Note
The swap
operation is for ArcGIS Online only and can only be used for a Vector Tile Layer published from a service directory.
Parameter
Description
target_service_name
Required string. Name of service you want to swap with.
Dictionary indicating success or error
The update_tiles operation supports updating the cooking extent and cache levels in a Hosted Vector Tile Service. The results of the operation is a response indicating success and a url to the Job Statistics page, or failure.
It is recommended to use the rebuild_cache method when your layer has been published through a Feature Layer since edits require regeneration of the tiles.
Parameter
Description
merge_bundle
Optional bool. Default is False. This parameter will only be set if the Vector Tile Layer has been published through a service directory.
Dictionary. If the product is not ArcGIS Online tile service, the result will be None.
# USAGE EXAMPLE >>> from arcgis.layers import VectorTileLayer >>> from arcgis.gis import GIS # connect to your GIS and get the web map item >>> gis = GIS(url, username, password) >>> vector_layer_item = gis.content.get('abcd_item-id') >>> vector_tile_layer = VectorTileLayer.fromitem(vector_layer_item) >>> vtl_manager = vector_tile_layer.manager >>> update_tiles = vtl_manager.update_tiles() >>> type(update_tiles) <Dictionary>
Bases: _GISResource
The EnterpriseVectorTileLayerManager
class allows administration (if access permits) of ArcGIS Enterprise hosted vector tile layers. A Hosted Vector Tile Service is published through a Feature Layer and these methods can only be applied to such Vector Tile Services. A VectorTileLayer
offers access to layer content.
Note
Url must be admin url such as: https://services.myserver.com/arcgis/server/admin/services/serviceName.VectorTileServer/
The changeProvider operation updates an individual service to use either a dedicated or a shared instance type. When a qualified service is published, the service is automatically set to use shared instances.
When using this operation, services may populate other provider types as values for the provider parameter, such as ArcObjects and SDS. While these are valid provider types, this operation does not support changing the provider of such services to either ArcObjects11 or DMaps. Services with ArcObjects or SDS as their provider cannot change their instance type.
Parameter
Description
provider
Optional String. Specifies the service instance as either a shared (âDMapsâ) or dedicated (âArcObjects11â) instance type. These values are case sensitive.
Boolean
This operation deletes an individual service, stopping the service and removing all associated resources and configurations.
This operation edits the properties of a service. To edit a service, you need to submit the complete JSON representation of the service, which includes the updates to the service properties. Editing a service can cause the service to be restarted with updated properties.
The JSON representation of a service contains the following four sections:
Service description propertiesâCommon properties that are shared by all services. These properties typically identify a specific service.
Service framework propertiesâProperties targeted toward the framework that hosts the GIS service. They define the life cycle and load balancing of the service.
Service type propertiesâProperties targeted toward the core service type as seen by the server administrator. Since these properties are associated with a server object, they vary across the service types.
Extension propertiesâRepresent the extensions that are enabled on the service.
Note
The JSON is submitted to the operation URL as a value of the parameter service. You can leave out the serviceName and type parameters in the JSON representation. Any other properties that are left out are not persisted by the server.
Note
If the service is currently running you need to stop the service before editing it. This can be done by calling the stop method on the service object. Once the service is stopped, you can edit the service and then start it again by calling the start method on the service object.
Parameter
Description
service_dictionary
Required dict. The JSON representation of the service and the properties that have been updated or added.
Example:
{
âserviceNameâ: âRI_Fed2019_WMâ,
âtypeâ: âVectorTileServerâ,
âdescriptionâ: ââ,
âcapabilitiesâ: âTilesOnly,Tilemapâ,
âextensionsâ: [],
âframeworkPropertiesâ: {},
âdatasetsâ: []
}
boolean
The rebuild_cache operation updates the vector tile layer cache to reflect any changes made. The results of the operation is the url to the vector tile service once it is done rebuilding.
Parameter
Description
min_scale
Optional Float. Represents the minimum scale of the tiles. If nothing is provided, default value is used.
max_scale
Optional Float. Represents the maximum scale of the tiles. If nothing is provided, default value is used.
This operation starts a service and loads the serviceâs configuration.
This operation stops all instances of a service. Once a service is stopped, it cannot process any incoming requests. Performing this operation will stop the respective servers, terminating all pods that run this service.
Bases: BaseOpenData
Represents a CSV File Hosted on a Server.
Parameter
Description
url_or_item
Required String or Item. The web address or Item
to the CSV resource.
gis
Optional GIS
. The GIS used to reference the service. The active_gis
is used if not specified.
copyright
Optional String. Describes limitations and usage of the data.
delimiter
Optional String. The separator value. This can be the following:
, (comma), â â (space), | (pipe), r (tab), or ; (semicolon).
fields
Optional List. An array of dictionaries containing the field information.
opacity
Optional Float. This value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
scale
Optional Tuple. The min/max scale of the layer where the positions are: (min, max) as float values.
sql_expression
Optional String. Optional query string to apply to the layer when displayed on the widget or web map.
title
Optional String. The title of the layer used to identify it in places such as the Legend and Layer List widgets.
Copyright information for the layer.
Gets/Sets the delimiter for the CSV Layer. The default is ,
returns the CSV file as a DataFrame
Returns the fields values for the CSV source.
list of strings
The latitude field name. If not specified, the class will look for following field names in the CSV source:
âlatâ, âlatitudeâ, âyâ, âycenterâ, âlatitude83â, âlatdecdegâ, âPOINT-Yâ
The longitude field name. If not specified, the CSVLayer will look for following field names in the CSV source:
âlonâ, âlngâ,âlongâ, âlongitudeâ, âxâ, âxcenterâ, âlongitude83â, âlongdecdegâ, âPOINT-Xâ
Get/Set the opacity value.
Parameter
Description
value
Required float. Value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
Float
Returns the properties of the Layer.
dict
Get/Set the Renderer of the CSV Layer
A dict
like object used to update and alter JSON
Gets/Sets the Min/Max Scale for the layer
Parameter
Description
value
Required tuple. (Min_value, Max_value)
A tuple (min, max)
The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the widget. Setting a definition expression is useful when the dataset is large and you donât want to bring all features to the client for analysis. The sql_expressions may be set when a layer is constructed prior to it loading in the view or after it has been loaded into the class.
String
Get/Set the title of the layer used to identify it in places such as the Legend and LayerList widgets.
Parameter
Description
value
Required string. Name of title
String
Bases: BaseOGC
The GeoJSONLayer class is used to create a layer based on GeoJSON. GeoJSON is a format for encoding a variety of geographic data structures. The GeoJSON data must comply with the RFC 7946 specification which states that the coordinates are in spatial reference: WGS84 (wkid 4326).
Parameter
Description
url
Optional String. The web location of the GeoJSON file.
data
Optional String or Dict. A path to a GeoJSON file, the GeoJSON data as a string, or the GeoJSON data as a dictionary.
copyright
Optional String. Describes limitations and usage of the data.
opacity
Optional Float. This value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
renderer
Optional Dictionary. A custom set of symbology for the given geojson dataset.
scale
Optional Tuple. The min/max scale of the layer where the positions are: (min, max) as float values.
title
Optional String. The title of the layer used to identify it in places such as the Legend and Layer List widgets.
Copyright information for the layer.
Get/Set the opacity value.
Parameter
Description
value
Required float. Value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
Float
Returns the properties of the Layer.
dict
Gets/Sets the renderer for the layer
Gets/Sets the Min/Max Scale for the layer
Parameter
Description
value
Required tuple. (Min_value, Max_value)
A tuple (min, max)
Get/Set the title of the layer used to identify it in places such as the Legend and LayerList widgets.
Parameter
Description
value
Required string. Name of title
String
Get/Set the data associated with the GeoJSON Layer
String
Bases: BaseOGC
The GeoRSSLayer class is used to create a layer based on GeoRSS. GeoRSS is a way to add geographic information to an RSS feed. The GeoRSSLayer supports both GeoRSS-Simple and GeoRSS GML encodings, and multiple geometry types.
It exports custom RSS tags as additional attribute fields in the form of simple strings or an array of JSON objects.
Parameter
Description
url
Required String. The URL of the GeoRSS service.
copyright
Optional String. Describes limitations and usage of the data.
line_symbol
Optional Dict. The symbol for the polyline data in the GeoRSS.
opacity
Optional Float. This value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
point_symbol
Optional Dict. The symbol for the point data in the GeoRSS.
polygon_symbol
Optional Dict. The symbol for the polygon data in the GeoRSS.
title
Optional String. The title of the layer used to identify it in places such as the Legend and LayerList widgets.
scale
Optional Tuple. The min/max scale of the layer where the positions are: (min, max) as float values.
Copyright information for the layer.
Gets/Sets the Line Symbol for Polyline Geometries
InsensitiveDict
: A case-insensitive dict
like object used to update and alter JSON A variants of a case-less dictionary that allows for dot and bracket notation.
Get/Set the opacity value.
Parameter
Description
value
Required float. Value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
Float
Gets/Sets the Point Symbol for Point Geometries
A dict
object used to update and alter JSON
Gets/Sets the Polygon Symbol for Polygon Geometries
InsensitiveDict
: A case-insensitive dict
like object used to update and alter JSON A variants of a case-less dictionary that allows for dot and bracket notation.
Returns the properties of the Layer.
dict
Gets/Sets the Min/Max Scale for the layer
Parameter
Description
value
Required tuple. (Min_value, Max_value)
A tuple (min, max)
Get/Set the title of the layer used to identify it in places such as the Legend and LayerList widgets.
Parameter
Description
value
Required string. Name of title
String
Bases: object
Represents the Hosted OGC Feature Server
Parameter
Description
url
Required String. The web address endpoint.
gis
Optional GIS
. The connection object.
Yields all the OGC Feature Service Layers within the service.
Iterator[OGCCollection
]
Provides the API conformance with the OGC standard.
Dict[str, Any]
returns the service properties
Bases: object
Represents a single OGC dataset
Parameter
Description
url
Required String. The web address endpoint.
gis
Optional GIS
. The connection object.
Gets an individual feature on the service. Needs to correspond to an id of the feature.
Dict[str, Any]
returns the service properties
Queries the OGCFeatureService
Layer and returns back the information as a Spatially Enabled DataFrame.
Parameter
Description
query
Optional String. A SQL based query applied to the service.
limit
Optional Integer. The number of records to limit to. The default is 10,000.
bbox
Optional List[float]. The bounding box to limit search in.
bbox_sr
Optional Integer. The coordinate reference system as a WKID.
time_filter
Optional String. The dates to filter time by.
Union[Dict[str, Any], pd.DataFrame]
Bases: BaseOGC
Represents a Web Map Service, which is an OGC web service endpoint.
Parameter
Description
url
Required string. The administration URL for the ArcGIS Server.
version
Optional String. The version number of the WMS service. The default is 1.3.0.
gis
Optional GIS
. The GIS used to reference the service by. The arcgis.env.active_gis is used if not specified.
copyright
Optional String. Describes limitations and usage of the data.
scale
Optional Tuple. The min/max scale of the layer where the positions are: (min, max) as float values.
opacity
Optional Float. This value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
title
Optional String. The title of the layer used to identify it in places such as the Legend and Layer List widgets.
Copyright information for the layer.
Returns all layers from the WMS service, excluding the top-level group layer if present.
Get/Set the opacity value.
Parameter
Description
value
Required float. Value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
Float
Returns the properties of the Layer, including sublayers if present.
dict
Gets/Sets the Min/Max Scale for the layer
Parameter
Description
value
Required tuple. (Min_value, Max_value)
A tuple (min, max)
Get/Set the title of the layer used to identify it in places such as the Legend and LayerList widgets.
Parameter
Description
value
Required string. Name of title
String
Bases: BaseOGC
Represents a Web Map Tile Service, which is an OGC web service endpoint.
Parameter
Description
url
Required string. The web address of the endpoint.
version
Optional String. The version number of the WMTS service. The default is 1.0.0
gis
Optional GIS
. The GIS used to reference the service by. The arcgis.env.active_gis is used if not specified.
copyright
Optional String. Describes limitations and usage of the data.
opacity
Optional Float. This value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
scale
Optional Tuple. The min/max scale of the layer where the positions are: (min, max) as float values.
title
Optional String. The title of the layer used to identify it in places such as the Legend and Layer List widgets.
Copyright information for the layer.
Get/Set the opacity value.
Parameter
Description
value
Required float. Value can range between 1 and 0, where 0 is 100 percent transparent and 1 is completely opaque.
Float
Represents the JSON Format for the specified layer.
Parameter
Description
identifier
Required string. The layerâs Identifier to get the JSON format for.
You can find this by looping through the layers in the properties attribute.
print(lyr[âIdentifierâ])
dict
Returns the properties of the Layer.
dict
Gets/Sets the Min/Max Scale for the layer
Parameter
Description
value
Required tuple. (Min_value, Max_value)
A tuple (min, max)
Get/Set the title of the layer used to identify it in places such as the Legend and LayerList widgets.
Parameter
Description
value
Required string. Name of title
String
The sync_navigation
method synchronizes the navigation from one rendered Map to another rendered Map instance so panning/zooming/navigating in one will update the other.
Note
Users can sync more than two instances together by passing in a list of Map instances to sync. The syncing will be remembered
Parameter
Description
map
Either a single Map instance, or a list of Map
instances to synchronize to.
The print
method prints the Map
object to a printable file such as a PDF, PNG32, JPG.
Note
The render and print operations happen server side (ArcGIS Online or Enterprise) and not on the client.
The print
method takes the state of the Map
, renders and returns either a page layout or a map without page surrounds of the specified extent in raster or vector format.
Parameter
Description
file_format
Required String. Specifies the output file format. Valid types:
PNG8
| PNG32
| JPG
| GIF
| PDF
| EPS
| SVG
| SVGZ
.
extent
Required Dictionary. Specify the extent to be printed.
# Example Usage: >>> extent = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'xmin': -15199645.40582486, 'ymin': 3395607.5273594954, 'xmax': -11354557.134968376, 'ymax': 5352395.451459487}
The spatial reference of the extent object is optional; when it is not provided, it is assumed to be in the mapâs spatial reference. When the aspect ratio of the map extent is different than the size of the map on the output page or the output_dimensions
, you might notice more features on the output map.
dpi
Optional integer. Specify the print resolution of the output file. dpi
stands for dots per inch. A higher number implies better resolution and a larger file size.
output_dimensions
Optional tuple. Specify the dimensions of the output file in pixels. If the layout_template
is not MAP_ONLY
, the specific layout template chosen takes precedence over this parameter.
scale
Optional float. Specify the map scale to be printed. The map scale at which you want your map to be printed. This parameter is optional but recommended for optimal results. The scale
property is especially useful when map services in the web map have scale-dependent layers or reference scales set. Since the map that you are viewing on the web app may be smaller than the size of the output map (for example, 8.5 x 11 in. or A4 size), the scale of the output map will be different and you could see differences in features and/or symbols in the web application as compared with the output map.
When scale is used, it takes precedence over the extent, but the output map is drawn at the requested scale centered on the center of the extent.
rotation
Optional float. Specify the number of degrees by which the map frame will be rotated, measured counterclockwise from the north. To rotate clockwise, use a negative value.
spatial_reference
Optional Dictionary.Specify the spatial reference in which map should be printed. When not specified, the following is the order of precedence:
read from the extent
parameter
read from the base map layer of your web map
read from the layout_template
chosen
layout_template
Optional String. The default value MAP_ONLY
does not use any template.
time_extent
Optional List . If there is a time-aware layer and you want it to be drawn at a specified time, specify this property. This order list can have one or two elements. Add two elements (startTime
followed by endTime
) to represent a time extent, or provide only one time element to represent a time instant. Times are always in UTC.
# Example Usage to represent Tues. Jan 1, 2008 00:00:00 UTC: # to Thurs. Jan 1, 2009 00:00:00 UTC. >>> time_extent = [1199145600000, 1230768000000]
layout_options
Optional Dictionary. This defines settings for different available page layout elements and is only needed when an available layout_template
is chosen. Page layout elements include title
, copyright text
, scale bar
, author name
, and custom text elements
. For more details, see ExportWebMap specification.
A URL to the file which can be downloaded and printed.
# USAGE EXAMPLE 1: Printing a web map to a JPG file of desired extent. from arcgis.map import Map from arcgis.gis import GIS # connect to your GIS and get the web map item gis = GIS(url, username, password) wm_item = gis.content.get('1234abcd_web map item id') # create a WebMap object from the existing web map item wm = Map(item=wm_item) # create an empty web map wm2 = Map() wm2.content.add(<desired Item or Layer object>) # set extent redlands_extent = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'xmin': -13074746.000753032, 'ymin': 4020957.451106308, 'xmax': -13014666.49652086, 'ymax': 4051532.26242039} # print printed_file_url = wm.print(file_format='JPG', extent=redlands_extent) printed_file2_url = wm2.print(file_format='PNG32', extent=redlands_extent) # Display the result in a notebook: from IPython.display import Image Image(printed_file_url) # Download file to disk import requests with requests.get(printed_file_url) as resp: with open('./output_file.png', 'wb') as file_handle: file_handle.write(resp.content)
Bases: object
Symbol service is an ArcGIS Server utility service that provides access to operations to build and generate images for Esri symbols to be consumed by internal and external web applications.
Returns a single symbol based on a web style item.
Parameter
Description
item
Required Item. The web style ArcGIS Enterprise portal item ID. The web style must belong to the same organization the ArcGIS Server is federated to.
name
Optional String. The web style ArcGIS Enterprise portal item ID. The web style must belong to the same organization the ArcGIS Server is federated to.
dict_features
Optional dict[str, Any]. The attributes and configuration key and value pairs for dictionary-based styles.
size
Optional String. The size (width and height) of the exported image in pixels. If the size is not specified, the image will be constrained by the requested symbolâs size.
scale
Optional Float. A value of 1.0 implies the symbol is not scaled. Setting the value to 1.5 scales the image to 50 percent more than the imageâs original size. Settings the value to 0.5 reduces the imageâs original size by 50 percent. If both the size and scale parameters are specified, both changes will be honored; the symbol will be scaled to the value set for scale and resized to the value set for the size parameter.
anchor
Optional Bool. The symbol placement in the image. When set to true, the original symbol anchor point placement in the image is honored. When set to false, the symbol is centered to the image. Having the image centered can be useful if you want to preview the whole symbol without taking symbol offset or anchor points into account. The default value is false.
image_format
Optional String. The output image format. The default format is png. The allowed values are: png, png8, png24, png32, jpg, bmp, gif, svg, and svgz.
dpi
Optional Int. The device resolution of the exported image (dots per inch). If the dpi value is not specified, an image with a default DPI of 96 will be exported.
file_path
Optional String | pathlib.Path. The full save path with the file name to the save location. The folder must exist.
String
converts an SVG Image to a CIM Compatible Image
returns the serviceâs properties
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4