arcrest.geometryservice package

Submodules

arcrest.geometryservice.geometryservice module

class arcrest.geometryservice.geometryservice.GeometryService(url, securityHandler=None, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseAGSServer

A geometry service contains utility methods that provide access to sophisticated and frequently used geometric operations. An ArcGIS Server web site can only expose one geometry service with the static name “Geometry”.

areasAndLengths(polygons, lengthUnit, areaUnit, calculationType)[source]

The areasAndLengths operation is performed on a geometry service resource. This operation calculates areas and perimeter lengths for each polygon specified in the input array.

Inputs:
polygons - The array of polygons whose areas and lengths are
to be computed.
lengthUnit - The length unit in which the perimeters of
polygons will be calculated. If calculationType is planar, then lengthUnit can be any esriUnits constant. If lengthUnit is not specified, the units are derived from sr. If calculationType is not planar, then lengthUnit must be a linear esriUnits constant, such as esriSRUnit_Meter or esriSRUnit_SurveyMile. If lengthUnit is not specified, the units are meters. For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type Constant.
areaUnit - The area unit in which areas of polygons will be
calculated. If calculationType is planar, then areaUnit can be any esriUnits constant. If areaUnit is not specified, the units are derived from sr. If calculationType is not planar, then areaUnit must be a linear esriUnits constant such as esriSRUnit_Meter or esriSRUnit_SurveyMile. If areaUnit is not specified, then the units are meters. For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type constant. The list of valid esriAreaUnits constants include, esriSquareInches | esriSquareFeet | esriSquareYards | esriAcres | esriSquareMiles | esriSquareMillimeters | esriSquareCentimeters | esriSquareDecimeters | esriSquareMeters | esriAres | esriHectares | esriSquareKilometers.
calculationType - The type defined for the area and length

calculation of the input geometries. The type can be one of the following values: planar - Planar measurements use 2D

Euclidean distance to calculate area and length. Th- should only be used if the area or length needs to be calculated in the given spatial reference. Otherwise, use preserveShape.
geodesic - Use this type if you want to
calculate an area or length using only the vertices of the polygon and define the lines between the points as geodesic segments independent of the actual shape of the polygon. A geodesic segment is the shortest path between two points on an ellipsoid.
preserveShape - This type calculates the
area or length of the geometry on the surface of the Earth ellipsoid. The shape of the geometry in its coordinate system is preserved.
Output:
JSON as dictionary
autoComplete(polygons=[], polylines=[], sr=None)[source]

The autoComplete operation simplifies the process of constructing new polygons that are adjacent to other polygons. It constructs polygons that fill in the gaps between existing polygons and a set of polylines.

Inputs:
polygons - array of Polygon objects polylines - list of Polyline objects sr - spatial reference of the input geometries WKID
buffer(geometries, inSR, distances, units, outSR=None, bufferSR=None, unionResults=True, geodesic=True)[source]

The buffer operation is performed on a geometry service resource The result of this operation is buffered polygons at the specified distances for the input geometry array. Options are available to union buffers and to use geodesic distance.

Inputs:

convexHull(geometries, sr=None)[source]
cut(cutter, target, sr=None)[source]
density(geometries, sr, maxSegmentLength, lengthUnit, geodesic=False)[source]
difference(geometries, sr, geometry)[source]
distance(sr, geometry1, geometry2, distanceUnit='', geodesic=False)[source]
findTransformation(inSR, outSR, extentOfInterest=None, numOfResults=1)[source]

The findTransformations operation is performed on a geometry service resource. This operation returns a list of applicable geographic transformations you should use when projecting geometries from the input spatial reference to the output spatial reference. The transformations are in JSON format and are returned in order of most applicable to least applicable. Recall that a geographic transformation is not needed when the input and output spatial references have the same underlying geographic coordinate systems. In this case, findTransformations returns an empty list. Every returned geographic transformation is a forward transformation meaning that it can be used as-is to project from the input spatial reference to the output spatial reference. In the case where a predefined transformation needs to be applied in the reverse direction, it is returned as a forward composite transformation containing one transformation and a transformForward element with a value of false.

Inputs:
inSR - The well-known ID (WKID) of the spatial reference or a
spatial reference JSON object for the input geometries
outSR - The well-known ID (WKID) of the spatial reference or a
spatial reference JSON object for the input geometries
extentOfInterest - The bounding box of the area of interest
specified as a JSON envelope. If provided, the extent of interest is used to return the most applicable geographic transformations for the area. If a spatial reference is not included in the JSON envelope, the inSR is used for the envelope.
numOfResults - The number of geographic transformations to
return. The default value is 1. If numOfResults has a value of -1, all applicable transformations are returned.
fromGeoCoordinateString(sr, strings, conversionType, conversionMode=None)[source]

The fromGeoCoordinateString operation is performed on a geometry service resource. The operation converts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user. An optional conversion mode parameter is available for some conversion types.

Inputs:
sr - The well-known ID of the spatial reference or a spatial
reference json object.
strings - An array of strings formatted as specified by

conversionType. Syntax: [<string1>,...,<stringN>] Example: [“01N AA 66021 00000”,”11S NT 00000 62155”,

“31U BT 94071 65288”]
conversionType - The conversion type of the input strings.
Valid conversion types are:
MGRS - Military Grid Reference System USNG - United States National Grid UTM - Universal Transverse Mercator GeoRef - World Geographic Reference System GARS - Global Area Reference System DMS - Degree Minute Second DDM - Degree Decimal Minute DD - Decimal Degree
conversionMode - Conversion options for MGRS, UTM and GARS

conversion types. Conversion options for MGRS and UTM conversion types. Valid conversion modes for MGRS are:

mgrsDefault - Default. Uses the spheroid from the given spatial
reference.
mgrsNewStyle - Treats all spheroids as new, like WGS 1984. The
180 degree longitude falls into Zone 60.
mgrsOldStyle - Treats all spheroids as old, like Bessel 1841.
The 180 degree longitude falls into Zone 60.
mgrsNewWith180InZone01 - Same as mgrsNewStyle except the 180
degree longitude falls into Zone 01.
mgrsOldWith180InZone01 - Same as mgrsOldStyle except the 180
degree longitude falls into Zone 01.
Valid conversion modes for UTM are:

utmDefault - Default. No options. utmNorthSouth - Uses north/south latitude indicators instead of

zone numbers. Non-standard. Default is recommended
generalize(sr, geometries, maxDeviation, deviationUnit)[source]
intersect(sr, geometries, geometry)[source]
labelPoints(sr, polygons)[source]
lengths(sr, polylines, lengthUnit, calculationType)[source]
offset(geometries, offsetDistance, offsetUnit, offsetHow='esriGeometryOffsetRounded', bevelRatio=10, simplifyResult=False, sr=None)[source]
project(geometries, inSR, outSR, transformation='', transformFoward=False)[source]
relation(geometries1, geometries2, sr, relation='esriGeometryRelationIntersection', relationParam='')[source]
reshape(sr, target, reshaper)[source]

calls the reshape command on a geometry service

simplify(sr, geometries)[source]

returns a simplied geometry object

toGeoCoordinateString(sr, coordinates, conversionType, conversionMode='mgrsDefault', numOfDigits=None, rounding=True, addSpaces=True)[source]

The toGeoCoordinateString operation is performed on a geometry service resource. The operation converts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user. Optional parameters are available for some conversion types. Note that if an optional parameter is not applicable for a particular conversion type, but a value is supplied for that parameter, the value will be ignored.

Inputs:
sr - The well-known ID of the spatial reference or a spatial
reference json object.
coordinates - An array of xy-coordinates in JSON format to be
converted. Syntax: [[x1,y2],...[xN,yN]]
conversionType - The conversion type of the input strings.
Allowed Values:
MGRS - Military Grid Reference System USNG - United States National Grid UTM - Universal Transverse Mercator GeoRef - World Geographic Reference System GARS - Global Area Reference System DMS - Degree Minute Second DDM - Degree Decimal Minute DD - Decimal Degree
conversionMode - Conversion options for MGRS and UTM conversion

types. Valid conversion modes for MGRS are:

mgrsDefault - Default. Uses the spheroid from the given spatial
reference.
mgrsNewStyle - Treats all spheroids as new, like WGS 1984. The
180 degree longitude falls into Zone 60.
mgrsOldStyle - Treats all spheroids as old, like Bessel 1841.
The 180 degree longitude falls into Zone 60.
mgrsNewWith180InZone01 - Same as mgrsNewStyle except the 180
degree longitude falls into Zone 01.
mgrsOldWith180InZone01 - Same as mgrsOldStyle except the 180
degree longitude falls into Zone 01.
Valid conversion modes for UTM are:

utmDefault - Default. No options. utmNorthSouth - Uses north/south latitude indicators instead of

zone numbers. Non-standard. Default is recommended.
numOfDigits - The number of digits to output for each of the
numerical portions in the string. The default value for numOfDigits varies depending on conversionType.
rounding - If true, then numeric portions of the string are
rounded to the nearest whole magnitude as specified by numOfDigits. Otherwise, numeric portions of the string are truncated. The rounding parameter applies only to conversion types MGRS, USNG and GeoRef. The default value is true.
addSpaces - If true, then spaces are added between components of
the string. The addSpaces parameter applies only to conversion types MGRS, USNG and UTM. The default value for MGRS is false, while the default value for both USNG and UTM is true.
trimExtend(sr, polylines, trimExtendTo, extendHow=0)[source]
union(sr, geometries)[source]

Module contents