arcrest.ags package

Submodules

arcrest.ags.featureservice module

Contains information regarding an ArcGIS Server Feature Server

class arcrest.ags.featureservice.FeatureService(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

contains information about a feature service

administration

returns the service admin object (if accessible)

allowGeometryUpdates

informs the user if the data allows geometry updates

capabilities

returns a list of capabilities

copyrightText

returns the copyright text

currentVersion

returns the map service current version

description

returns the service description

documentInfo
downloadMetadataFile(outPath)[source]

downloads the metadata file to a given path

downloadThumbnail(outPath)[source]

downloads the items’s thumbnail

editorTrackingInfo
enableZDefaults
fullExtent

returns the full extent of the feature service

hasStaticData
hasVersionedData

returns boolean for versioned data

initialExtent

returns the initial extent of the feature service

itemInfo

gets the item’s info

layers

gets the layers for the feature service

maxRecordCount

returns the max record count

query(layerDefsFilter=None, geometryFilter=None, timeFilter=None, returnGeometry=True, returnIdsOnly=False, returnCountOnly=False, returnZ=False, returnM=False, outSR=None)[source]

The Query operation is performed on a feature service resource

securityHandler

gets the security handler

serviceDescription

returns the serviceDescription of the map service

spatialReference

returns the spatial reference

supportedQueryFormats
supportsDisconnectedEditing

returns boolean is disconnecting editted supported

syncCapabilities

type of sync that can be performed

syncEnabled

informs the user if sync of data can be performed

tables

lists the tables on the feature service

units

returns the measurement unit

zDefault

arcrest.ags.layer module

class arcrest.ags.layer.DynamicDataLayer(dataSource, fields=None)[source]

Bases: arcrest._abstract.abstract.DynamicData

asDictionary

returns the value as a dictionary

asJSON
dataSource

returns the data source object

fields

returns the fields

class arcrest.ags.layer.DynamicMapLayer(mapLayerId, gdbVersion='')[source]

Bases: arcrest._abstract.abstract.DynamicData

creates a dynamic map layer object A dynamic map layer refers to a layer in the current map service. If supported, use gdbVersion to specify an alternate geodatabase version.

asDictionary

converts the object to a dictionary

asJSON

converts the dynamic object to a string

class arcrest.ags.layer.FeatureLayer(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

This contains information about a feature service’s layer.

addAttachments(featureId, attachment, gdbVersion=None, uploadId=None)[source]

This operation adds an attachment to the associated feature (POST only). The addAttachment operation is performed on a feature service feature resource. Since this request uploads a file, it must be a multipart request pursuant to IETF RFC1867. This operation is available only if the layer has advertised that it has attachments. A layer has attachments if its hasAttachments property is true. See the Limiting upload file size and file types section under Uploads to learn more about default file size and file type limitations imposed on attachments. The result of this operation is an array of edit result objects. Each edit result indicates whether or not the edit was successful. If successful, the objectId of the result is the ID of the new attachment. If unsuccessful, it also includes an error code and error description. You can provide arguments to the addAttachment operation as defined in the following parameters table:

Inputs:
attachment - The file to be uploaded as a new feature
attachment. The content type, size, and name of the attachment will be derived from the uploaded file.
gdbVersion - Geodatabase version to apply the edits. This
parameter applies only if the isDataVersioned property of the layer is true. If the gdbVersion parameter is not specified, edits are made to the published map’s version.
uploadId - This option was added to the July 2014 of ArcGIS
Online. It is not available with ArcGIS Server. The ID of the attachment that has already been uploaded to the server. This parameter only applies if the supportsAttachmentsByUploadId property of the layer is true.
addFeature(features, gdbVersion=None, rollbackOnFailure=True)[source]

Adds a single feature to the service Inputs:

feature - list of common.Feature object or a single
common.Feature Object

gdbVersion - Geodatabase version to apply the edits rollbackOnFailure - Optional parameter to specify if the

edits should be applied only if all submitted edits succeed. If false, the server will apply the edits that succeed even if some of the submitted edits fail. If true, the server will apply the edits only if all edits succeed. The default value is true.
Output:
JSON message as dictionary
addFeatures(fc, attachmentTable=None, nameField='ATT_NAME', blobField='DATA', contentTypeField='CONTENT_TYPE', rel_object_field='REL_OBJECTID', lowerCaseFieldNames=False)[source]

adds a feature to the feature service Inputs:

fc - string - path to feature class data to add. attachmentTable - string - (optional) path to attachment table nameField - string - (optional) name of file field in attachment table blobField - string - (optional) name field containing blob data contentTypeField - string - (optional) name of field containing content type rel_object_field - string - (optional) name of field with OID of feature class
Output:
boolean, add results message as list of dictionaries
advancedQueryCapabilities

returns the advancedQueryCapabilities property

allowGeometryUpdates

returns the boolean value

applyEdits(addFeatures=[], updateFeatures=[], deleteFeatures=None, gdbVersion=None, rollbackOnFailure=True)[source]

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

addFeatures - The array of features to be added. These
features should be common.general.Feature objects, or they should be a common.general.FeatureSet object.
updateFeatures - The array of features to be updateded.
These features should be common.Feature objects

deleteFeatures - string of OIDs to remove from service gdbVersion - Geodatabase version to apply the edits. rollbackOnFailure - Optional parameter to specify if the

edits should be applied only if all submitted edits succeed. If false, the server will apply the edits that succeed even if some of the submitted edits fail. If true, the server will apply the edits only if all edits succeed. The default value is true.
Output:
dictionary of messages
calculate(where, calcExpression, sqlFormat='standard')[source]

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

Inputs:
where - A where clause can be used to limit the updated records.
Any legal SQL where clause operating on the fields in the layer is allowed.
calcExpression - The array of field/value info objects that

contain the field or fields to update and their scalar values or SQL expression. Allowed types are dictionary and list. List must be a list of dictionary objects. Calculation Format is as follows:

{“field” : “<field name>”, “value” : “<value>”}
sqlFormat - The SQL format for the calcExpression. It can be
either standard SQL92 (standard) or native SQL (native). The default is standard. Values: standard, native
Output:
JSON as string

Usage: >>>sh = arcrest.AGOLTokenSecurityHandler(“user”, “pw”) >>>fl = arcrest.agol.FeatureLayer(url=”someurl”,

securityHandler=sh, initialize=True)
>>>print fl.calculate(where=”OBJECTID < 2”,
calcExpression={“field”: “ZONE”,
“value” : “R1”})

{‘updatedFeatureCount’: 1, ‘success’: True}

canModifyLayer
canScaleSymbols
capabilities
copyrightText

returns the copyright text

currentVersion

returns the current version

dateFieldsTimeReference

returns the boolean value

defaultVisibility
definitionExpression

returns the definitionExpression

deleteFeatures(objectIds='', where='', geometryFilter=None, gdbVersion=None, rollbackOnFailure=True)[source]

removes 1:n features based on a sql statement Input:

objectIds - The object IDs of this layer/table to be deleted where - A where clause for the query filter. Any legal SQL

where clause operating on the fields in the layer is allowed. Features conforming to the specified where clause will be deleted.
geometryFilter - a filters.GeometryFilter object to limit
deletion by a geometry.
gdbVersion - Geodatabase version to apply the edits. This
parameter applies only if the isDataVersioned property of the layer is true
rollbackOnFailure - parameter to specify if the edits should
be applied only if all submitted edits succeed. If false, the server will apply the edits that succeed even if some of the submitted edits fail. If true, the server will apply the edits only if all edits succeed. The default value is true.
Output:
JSON response as dictionary
description

returns the layer’s description

displayField
drawingInfo
editFieldsInfo

returns the edit field information

effectiveMaxScale
effectiveMinScale
extent
fields
geometryType

returns the geometry type

globalIdField

returns the global id field

hasAttachments
hasLabels
hasM

returns if it has a m value or not

hasZ

returns if it has a Z value or not

htmlPopupType
id

returns the id

indexes

gets the indexes for the Featurelayer object

isDataVersioned
maxRecordCount
maxRecordCountFactor

returns the maxRecordCountFactor for the feature layer

maxScale

sets the max scale

minScale

minimum scale layer will show

name

returns the name

objectIdField

returns the object id field

ownershipBasedAccessControlForFeatures
parentLayer

returns information about the parent

query(where='1=1', out_fields='*', timeFilter=None, geometryFilter=None, returnGeometry=True, returnIDsOnly=False, returnCountOnly=False, returnFeatureClass=False, returnDistinctValues=False, returnExtentOnly=False, maxAllowableOffset=None, geometryPrecision=None, outSR=None, groupByFieldsForStatistics=None, statisticFilter=None, out_fc=None, **kwargs)[source]

queries a feature service based on a sql statement Inputs:

where - the selection sql statement out_fields - the attribute fields to return timeFilter - a TimeFilter object where either the start time

or start and end time are defined to limit the search results for a given time. The values in the timeFilter should be as UTC timestampes in milliseconds. No checking occurs to see if they are in the right format.
geometryFilter - a GeometryFilter object to parse down a given
query by another spatial dataset.
returnGeometry - true means a geometry will be returned,
else just the attributes
returnIDsOnly - false is default. True means only OBJECTIDs
will be returned
returnCountOnly - if True, then an integer is returned only
based on the sql statement
returnFeatureClass - Default False. If true, query will be
returned as feature class
out_fc - only valid if returnFeatureClass is set to True.
Output location of query.
groupByFieldsForStatistics - One or more field names on
which the values need to be grouped for calculating the statistics.

statisticFilter - object that performs statistic queries kwargs - optional parameters that can be passed to the Query

function. This will allow users to pass additional parameters not explicitly implemented on the function. A complete list of functions available is documented on the Query REST API.
Output:
A list of Feature Objects (default) or a path to the output featureclass if returnFeatureClass is set to True.
queryRelatedRecords(objectIds, relationshipId, outFields='*', definitionExpression=None, returnGeometry=True, maxAllowableOffset=None, geometryPrecision=None, outWKID=None, gdbVersion=None, returnZ=False, returnM=False)[source]

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

objectIds - The object IDs of the table/layer to be queried. relationshipId - The ID of the relationship to be queried. outFields - 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 returnGeometry to true. You can also specify the wildcard “*” as the value of this parameter. In this case, the result s will include all the field values.
definitionExpression - 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.
returnGeometry - If true, the feature set includes the
geometry associated with each feature. The default is true.
maxAllowableOffset - This option can be used to specify the
maxAllowableOffset to be used for generalizing geometries returned by the query operation. The maxAllowableOffset is in the units of the outSR. If outSR is not specified, then maxAllowableOffset is assumed to be in the unit of the spatial reference of the map.
geometryPrecision - This option can be used to specify the
number of decimal places in the response geometries.
outWKID - The WKID for the spatial reference of the
returned geometry.
gdbVersion - The geodatabase version to query. This parameter
applies only if the isDataVersioned property of the layer queried is true.
returnZ - 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.
returnM - 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.
relationships
standardMaxRecordCount

returns the standardMaxRecordCount for the feature layer

subLayers

returns sublayers for layer

supportedQueryFormats
supportsAdvancedQueries
supportsApplyEditsWithGlobalIds

returns the boolean value

supportsCalculate

returns the boolean value

supportsRollbackOnFailureParameter

returns the value for the supportsRollbackOnFailureParameter

supportsStatistics
supportsValidateSQL

returns the boolean value

syncCanReturnChanges

returns the sync can return changes

templates

returns the templates

tileMaxRecordCount

returns the tileMaxRecordCount for the feature layer

timeInfo
type

returns the type

typeIdField
types
updateFeature(features, gdbVersion=None, rollbackOnFailure=True)[source]

updates an existing feature in a feature service layer Input:

feature - feature object(s) to get updated. A single feature
or a list of feature objects can be passed
Output:
dictionary of result messages
useStandardizedQueries
validateSQL(sql, sqlType='where')[source]

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

Inputs:

sql - The SQL expression or WHERE clause to validate. sqlType - Three SQL types are supported in validateSQL:

where (default) - Represents the custom WHERE clause the user can compose when querying a layer or using calculate. expression - Represents an SQL-92 expression. Currently, expression is used as a default value expression when adding a new field or using the calculate API. statement - Represents the full SQL-92 statement that can be passed directly to the database. No current ArcGIS REST API resource or operation supports using the full SQL-92 SELECT statement directly. It has been added to the validateSQL for completeness. Values: where | expression | statement
class arcrest.ags.layer.GroupLayer(url, securityHandler=None, proxy_url=None, proxy_port=None)[source]

Bases: arcrest.ags.layer.FeatureLayer

represents a group layer

class arcrest.ags.layer.JoinTableDataSource(leftTableSource, rightTableSource, leftTableKey, rightTableKey, joinType)[source]

Bases: arcrest._abstract.abstract.DataSource

joinTable data source is the result of a join operation. Nested joins are supported. To use nested joins, set either leftTableSource or rightTableSource to be a joinTable.

asDictionary

returns the data source as a dictionary

asJSON

returns the object as JSON string

datatype

returns the type

joinTypes = ['esriLeftOuterJoin', 'esriLeftInnerJoin']
class arcrest.ags.layer.QueryTableDataSource(workspaceId, query, oidFields, wkid, geometryType='')[source]

Bases: arcrest._abstract.abstract.DataSource

asDictionary

returns the data source as a dictionary

asJSON

returns the data source as JSON

datatype

returns the type

geometryType

returns the geometry type of the query table

workspaceId

returns the workspace id

class arcrest.ags.layer.RasterDataSource(workspaceId, dataSourceName)[source]

Bases: arcrest._abstract.abstract.DataSource

Raster data source is a file-based raster that resides in a registered raster workspace.

asDictionary

returns the data source as JSON

asJSON

returns the data source as JSON

dataSourceName

returns the dataSourceName

datatype

returns the type

workspaceId

returns the workspace id

class arcrest.ags.layer.RasterLayer(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest.ags.layer.FeatureLayer

Raster Layer is exactly like FeatureLayer object

class arcrest.ags.layer.SchematicsLayer(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest.ags.layer.FeatureLayer

represents a Schematics Layer

class arcrest.ags.layer.TableDataSource(workspaceId, dataSourceName, gdbVersion='')[source]

Bases: arcrest._abstract.abstract.DataSource

Table data source is a table, feature class, or raster that resides in a registered workspace (either a folder or geodatabase). In the case of a geodatabase, if versioned, use version to switch to an alternate geodatabase version. If version is empty or missing, the registered geodatabase version will be used.

asDictionary

returns the data source as JSON

asJSON

returns the data source as JSON

dataSourceName

returns the dataSourceName

datatype

returns the type

gdbVersion

gets the gdbVersion

workspaceId

returns the workspace id

class arcrest.ags.layer.TableLayer(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest.ags.layer.FeatureLayer

Table object is exactly like FeatureLayer object

arcrest.ags.mapservice module

class arcrest.ags.mapservice.MapService(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

contains information about a map service

allLayers

returns all layers for the service

capabilities

returns the service’s capabilities

copyrightText

returns the copyright text

currentVersion

returns the map service current version

description

returns the map service description

documentInfo

returns the document information as a dictionary

downloadMetadataFile(outPath)[source]

downloads the metadata file to a given path

downloadThumbnail(outPath)[source]

downloads the items’s thumbnail

estimateExportTilesSize(exportBy, levels, tilePackage=False, exportExtent='DEFAULTEXTENT', areaOfInterest=None, async=True)[source]

The estimateExportTilesSize operation 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 exceced the maxExportTileCount limit set by the administrator of the service. The result of this operation is Map Service Job. 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.

Inputs:

tilePackage - 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

Values: True | False
exportExtent - 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
exportBy - 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 - 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 exportBy 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
areaOfInterest - (Optional) The areaOfInterest polygon allows

exporting tiles within the specified polygon areas. This parameter supersedes exportExtent parameter. Also excepts geometry.Polygon.

Example: { “features”: [{“geometry”:{“rings”:[[[-100,35],
[-100,45],[-90,45],[-90,35],[-100,35]]], “spatialReference”:{“wkid”:4326}}}]}
async - (optional) 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.

Values: True | False
exportMap(bbox, size='600, 550', dpi=200, imageSR=None, image_format='png', layerDefFilter=None, layers=None, transparent=False, timeFilter=None, layerTimeOptions=None, dynamicLayers=None, mapScale=None)[source]

The export 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. Inputs:

bbox - envelope geometry object size - size of image in pixels dpi - dots per inch imageSR - spatial reference of the output image image_format - Description: The format of the exported image.

The default format is .png. Values: png | png8 | png24 | jpg | pdf | bmp | gif

svg | svgz | emf | ps | png32
layerDefFilter - Description: 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 - 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 - If true, the image will be exported with the
background color of the map set as its transparent color. The default is false. Only the .png and .gif formats support transparency. Internet Explorer 6 does not display transparency correctly for png24 image formats.
timeFilter - The time instant or time extent of the exported
map image.
layerTimeOptions - 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. see: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/
dynamicLayers - Use dynamicLayers parameter to modify the layer
drawing order, change layer drawing info, and change layer data source version for this request. New layers (dataLayer) can also be added to the dynamicLayers based on the map service registered workspaces.
mapScale - Use this parameter to export a map image at a specific
scale, with the map centered around the center of the specified bounding box (bbox).
exportTiles(levels, exportBy='LevelID', tilePackage=False, exportExtent='DEFAULT', optimizeTilesForSize=True, compressionQuality=0, areaOfInterest=None, async=False)[source]

The exportTiles 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 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. exportTiles can be enabled in a service by using ArcGIS for Desktop or the ArcGIS Server Administrator Directory. In ArcGIS for 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. 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.

At 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:

Inputs:
exportBy - 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 - Specifies the tiled service levels to export. The values

should correspond to Level IDs, cache scales. or the resolution as specified in exportBy 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
tilePackage - 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 false

Values: true | false
exportExtent - 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}}
optimizeTilesForSize - (Optional) 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.

Values: true | false
compressionQuality - (Optional) When optimizeTilesForSize=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.
areaOfInterest - (Optional) The areaOfInterest polygon allows
exporting tiles within the specified polygon areas. This parameter supersedes the exportExtent parameter. Must be geometry.Polygon object.
Example: { “features”: [{“geometry”:{“rings”:[[[-100,35],
[-100,45],[-90,45],[-90,35],[-100,35]]], “spatialReference”:{“wkid”:4326}}}]}
async - default True, this value ensures the returns are returned
to the user instead of the user having the check the job status manually.
exportTilesAllowed

Boolean if export tiles is allowed

find(searchText, layers, contains=True, searchFields='', sr='', layerDefs='', returnGeometry=True, maxAllowableOffset='', geometryPrecision='', dynamicLayers='', returnZ=False, returnM=False, gdbVersion='')[source]

performs the map service find operation

fullExtent

returns the full extent of the map service

generateKML(save_location, docName, layers, layerOptions='composite')[source]

The generateKml operation is performed on a map service resource. The result of this operation is a KML document wrapped in a KMZ file. The document contains a network link to the KML Service endpoint with properties and parameters you specify. Inputs:

docName - The name of the resulting KML document. This is the
name that appears in the Places panel of Google Earth.
layers - the layers to perform the generateKML operation on.
The layers are specified as a comma-separated list of layer ids.
layerOptions - 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
getExtensions()[source]

returns objects for all map service extensions

getFeatureDynamicLayer(oid, dynamicLayer, returnZ=False, returnM=False)[source]

The feature resource represents a single feature in a dynamic layer in a map service

hasVersionedData

reutrn boolean if has versioned data

identify(geometry, mapExtent, imageDisplay, tolerance, geometryType='esriGeometryPoint', sr=None, layerDefs=None, time=None, layerTimeOptions=None, layers='top', returnGeometry=True, maxAllowableOffset=None, geometryPrecision=None, dynamicLayers=None, returnZ=False, returnM=False, gdbVersion=None)[source]

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. Each identified result includes its name, layer ID, layer name, geometry and geometry type, and other attributes of that result as name-value pairs.

Inputs: geometry - 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 ArcGIS REST API. In addition to the JSON structures, for points and envelopes, you can specify the geometries with a simpler comma-separated syntax. Syntax: JSON structures: <geometryType>&geometry={ geometry} Point simple syntax: esriGeometryPoint&geometry=<x>,<y> Envelope simple syntax: esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
geometryType - The type of geometry specified by the geometry parameter.
The geometry type could be a point, line, polygon, or an envelope. Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope
sr - The well-known ID of the spatial reference of the input and
output geometries as well as the mapExtent. If sr is not specified, the geometry and the mapExtent are assumed to be in the spatial reference of the map, and the output geometries are also in the spatial reference of the map.
layerDefs - 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 - The time instant or the time extent of the features to be identified.

layerTimeOptions - 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 - 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 - The distance in screen pixels from the specified geometry
within which the identify should be performed. The value for the tolerance is an integer.
mapExtent - The extent or bounding box of the map currently being viewed.
Unless the sr parameter has been specified, the mapExtent is assumed to be in the spatial reference of the map. Syntax: <xmin>, <ymin>, <xmax>, <ymax> The mapExtent and the imageDisplay 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.
imageDisplay - The screen image display parameters (width, height, and DPI)
of the map being currently viewed. The mapExtent and the imageDisplay 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>
returnGeometry - If true, the resultset will include the geometries
associated with each result. The default is true.
maxAllowableOffset - This option can be used to specify the maximum allowable
offset to be used for generalizing geometries returned by the identify operation. The maxAllowableOffset is in the units of the sr. If sr is not specified, maxAllowableOffset is assumed to be in the unit of the spatial reference of the map.
geometryPrecision - 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).
dynamicLayers - 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.
returnZ - 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. This parameter only applies if returnGeometry=true.
returnM - 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. This parameter only applies if returnGeometry=true.

gdbVersion - Switch map layers to point to an alternate geodatabase version.

initialExtent

returns the initial extent of the map service

itemInfo

gets the item’s info

json_dict

returns object as a dictionary

layers

returns all the layers in the map service

mapName

returns the map name value

maxExportTilesCount

returns the maximum export tiles count

maxImageHeight

returns the max image height

maxImageWidth

returns the max image width

maxRecordCount

returns the max number of records returned by a query/display ect.

maxScale

returns the max scale for a map service

minScale

returns the map service minimum scale

securityHandler

gets the security handler

serviceDescription

returns the serviceDescription of the map service

singleFusedMapCache

returns boolean for this property

spatialReference

returns the spatialreference information for the map service

supportedExtensions

returns the supported extensions

supportedImageFormatTypes

returns the supported image format types

supportedQueryFormats

returns the supported query formats

supportsDynamicLayers

returns boolean (True/False) if it support dynamic layers

tables

returns all tables in the map service

tileInfo

Returns tile info for cached services

tileServers

gets the tileServers for the service

timeInfo

returns the timeInformation for a given service

units

returns the map service’s measurement units

arcrest.ags.server module

This provides access to a server and it’s services for non administrative functions. This allows developers to access a REST service just like a user/developer would.

class arcrest.ags.server.Server(url, securityHandler, proxy_url=None, proxy_port=None, initialize=False)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

This object represents an ArcGIS Server instance

admin

points to the adminstrative side of ArcGIS Server

currentFolder

gets/sets the current folder name

currentVersion

gets the current version of arcgis server

folders

returns the folders on server

location

returns the current url position in the server folder structure

root

gets the url of the class

self

gets the logged in user

services

gets the services in the current folder

arcrest.ags.services module

Contains information regarding an ArcGIS Server Feature Server

class arcrest.ags.services.FeatureService(url, securityHandler=None, initialize=False, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

contains information about a feature service

administration

returns the service admin object (if accessible)

allowGeometryUpdates

informs the user if the data allows geometry updates

capabilities

returns a list of capabilities

copyrightText

returns the copyright text

currentVersion

returns the map service current version

description

returns the service description

documentInfo
downloadMetadataFile(outPath)[source]

downloads the metadata file to a given path

downloadThumbnail(outPath)[source]

downloads the items’s thumbnail

editorTrackingInfo
enableZDefaults
fullExtent

returns the full extent of the feature service

hasStaticData
hasVersionedData

returns boolean for versioned data

initialExtent

returns the initial extent of the feature service

itemInfo

gets the item’s info

layers

gets the layers for the feature service

maxRecordCount

returns the max record count

query(layerDefsFilter=None, geometryFilter=None, timeFilter=None, returnGeometry=True, returnIdsOnly=False, returnCountOnly=False, returnZ=False, returnM=False, outSR=None)[source]

The Query operation is performed on a feature service resource

securityHandler

gets the security handler

serviceDescription

returns the serviceDescription of the map service

spatialReference

returns the spatial reference

supportedQueryFormats
supportsDisconnectedEditing

returns boolean is disconnecting editted supported

syncCapabilities

type of sync that can be performed

syncEnabled

informs the user if sync of data can be performed

tables

lists the tables on the feature service

units

returns the measurement unit

zDefault

Module contents