arcgis.geometry module¶
The arcgis.geometry module defines useful geometry types for working with geographic information and GIS functionality. It provides functions which use geometric types as input and output as well as functions for easily converting geometries between different representations.
Several functions accept geometries represented as dictionaries and the geometry objects in this module behave like them as well as support the ‘.’ (dot) notation providing attribute access.
Example:
>>> pt = Point({"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}})
>>> print (pt.is_valid)
True
>>> print (pt.type) # POINT
'POINT'
>>> print (pt)
'{"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}}'
>>> print (pt.x, pt.y)
(-118.15,33.80)
Example Polyline:
>>> line = {
"paths" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
[[-97.06326,32.759],[-97.06298,32.755]]],
"spatialReference" : {"wkid" : 4326}
}
>>> polyline = Polyline(line)
>>> print(polyline)
'{"paths" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],[[-97.06326,32.759],[-97.06298,32.755]]],"spatialReference" : {"wkid" : 4326}}'
>>> print(polyline.is_valid)
True
Example of invalid geometry:
>>> line = {
"paths" : [[[-97.06138],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
[[-97.06326,32.759],[-97.06298,32.755]]],
"spatialReference" : {"wkid" : 4326}
}
>>> polyline = Polyline(line)
>>> print(polyline)
'''{"paths" : [[[-97.06138],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
[[-97.06326,32.759],[-97.06298,32.755]]],"spatialReference" : {"wkid" : 4326}}'''
>>>print(polyline.is_valid)
False
The same pattern can be used repeated for Polygon, MultiPoint and SpatialReference.
You can create a Geometry even when you don’t know the exact type. The Geometry constructor is able to figure out the geometry type and returns the correct type as the example below demonstrates:
>>> geom = Geometry({
"rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832],
[-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749],
[-97.06326,32.759]]],
"spatialReference" : {"wkid" : 4326}
})
>>> print (geom.type) # Polygon
'Polygon'
>>> print(isinstance(geom, Polygon)
True
Point¶
-
class
arcgis.geometry.
Point
(iterable=None)¶ The
Point
class contains x and y fields along with aSpatialReference
field. APoint
can also contain m and z fields. APoint
is empty when its x field is present and has the value null or the string NaN. An emptypoint
has no location in space.-
coordinates
()¶ The
coordinates
method retrieves the coordinates of thePoint
as a np.array#Usage Example >>> coords = point.coordinates() >>> coords [x1,y1,m1,z1]
- Returns
An np.array containing coordinate values
-
svg
(scale_factor=1, fill_color=None)¶ The
svg
method returns a SVG circle element for thePoint
geometry.Keys
Description
scale_factor
An optional float. Multiplication factor for the SVG circle diameter. Default is 1.
fill_color
An optional string. Hex string for fill color. Default is to use “#66cc99” if geometry is valid, and “#ff3333” if invalid.
- Returns
An SVG circle element
-
property
type
¶ The
type
method retrieves the type of the currentPoint
object.
-
MultiPoint¶
-
class
arcgis.geometry.
MultiPoint
(iterable=None, **kwargs)¶ A
multipoint
contains an array ofPoint
, along with aSpatialReference
field. Amultipoint
can also have boolean-valued hasZ and hasM fields. These fields control the interpretation of elements of the points array.Note
Omitting an hasZ or hasM field is equivalent to setting it to false.
Each element of the points array is itself an array of two, three, or four numbers. It will have two elements for 2D points, two or three elements for 2D points with Ms, three elements for 3D points, and three or four elements for 3D points with Ms. In all cases, the x coordinate is at index 0 of a point’s array, and the y coordinate is at index 1. For 2D points with Ms, the m coordinate, if present, is at index 2. For 3D points, the Z coordinate is required and is at index 2. For 3D points with Ms, the Z coordinate is at index 2, and the M coordinate, if present, is at index 3.
Note
An empty multipoint has a points field with no elements. Empty points are ignored.
-
coordinates
()¶ The
coordinates
method retrieves the coordinates of theMultiPoint
as a np.array#Usage Example >>> coords = multiPoint.coordinates() >>> coords [ [x1,y1,m1,z1], [x2,y2,m2,z2],...]
- Returns
An np.array containing coordinate values
-
svg
(scale_factor=1.0, fill_color=None)¶ The
svg
method returns a group of SVG circle element for theMultiPoint
geometry.Keys
Description
scale_factor
An optional float. Multiplication factor for the SVG circle diameter. Default is 1.
fill_color
An optional string. Hex string for fill color. Default is to use “#66cc99” if geometry is valid, and “#ff3333” if invalid.
- Returns
A group of SVG circle elements
-
property
type
¶ The
type
method retrieves the type of the currentMultiPoint
object.
-
Polyline¶
-
class
arcgis.geometry.
Polyline
(iterable=None, **kwargs)¶ The
Polyline
contains an array of paths or curvePaths and aSpatialReference
. ForPolylines
with curvePaths, see the sections on JSON curve object andPolyline
with curve. Each path is represented as an array ofPoint
, and each point in the path is represented as an array of numbers. APolyline
can also have boolean-valued hasM and hasZ fields.Note
See the description of
MultiPoint
for details on how the point arrays are interpreted.An empty
PolyLine
is represented with an empty array for the paths field. Nulls and/or NaNs embedded in an otherwise defined coordinate stream forPolylines
andPolygon
objects is a syntax error.-
coordinates
()¶ The
coordinates
method retrieves the coordinates of thePolyline
as a np.array#Usage Example >>> coords = polyLine.coordinates() >>> coords [ [x1,y1,m1,z1], [x2,y2,m2,z2],...]
- Returns
An np.array containing coordinate values
-
svg
(scale_factor=1, stroke_color=None)¶ The
svg
method retrieves SVG polyline element for the LineString geometry.Keys
Description
scale_factor
An optional float. Multiplication factor for the SVG stroke-width. Default is 1.
stroke_color
An optional string. Hex string for fill color. Default is to use “#66cc99” if geometry is valid, and “#ff3333” if invalid.
- Returns
The SVG polyline element for the LineString Geometry
-
property
type
¶ The
type
method retrieves the type of the currentPolyline
object.
-
Polygon¶
-
class
arcgis.geometry.
Polygon
(iterable=None, **kwargs)¶ The
Polygon
contains an array of rings or curveRings and aSpatialReference
. ForPolygons
with curveRings, see the sections on JSON curve object andPolygon
with curve. Each ring is represented as an array ofPoint
. The first point of each ring is always the same as the last point. Each point in the ring is represented as an array of numbers. APolygon
can also have boolean-valued hasM and hasZ fields.An empty
Polygon
is represented with an empty array for the rings field. Null and/or NaNs embedded in an otherwise defined coordinate stream forPolyline
andPolygons
is a syntax error. Polygons should be topologically simple. Exterior rings are oriented clockwise, while holes are oriented counter-clockwise. Rings can touch at a vertex or self-touch at a vertex, but there should be no other intersections. Polygons returned by services are topologically simple. When drawing a polygon, use the even-odd fill rule. The even-odd fill rule will guarantee that the polygon will draw correctly even if the ring orientation is not as described above.-
coordinates
()¶ The
coordinates
method retrieves the coordinates of thePolygon
as a np.array#Usage Example >>> coords = polygon.coordinates() >>> coords [ [x1,y1,m1,z1], [x2,y2,m2,z2],...,[x1,y1,m1,z1] ]
- Returns
An np.array containing coordinate values
-
svg
(scale_factor=1, fill_color=None)¶ The
svg
method retrieves SVG polygon element.- Returns
The SVG polygon element
-
property
type
¶ The
type
method retrieves the type of the currentPolyline
object.
-
Envelope¶
-
class
arcgis.geometry.
Envelope
(iterable=None, **kwargs)¶ The
Envelope
class represents a rectangle defined by a range of values for each coordinate and attribute. It also has aSpatialReference
field. The fields for the z and m ranges are optional.Note
An empty
Envelope
has no points in space and is defined by the presence of an xmin field a null value or a NaN string.-
coordinates
()¶ The
coordinates
method retrieves the coordinates of theEnvelope
as a np.array#Usage Example >>> coords = envelope.coordinates() >>> coords [ [x1,y1,m1,z1], [x2,y2,m2,z2],...]
- Returns
An np.array containing coordinate values
-
property
geohash
¶ The
geohash
method retrieves a geohash string of the extent of the ``Envelope.- Returns
A geohash String
-
property
geohash_covers
¶ The
geohash_covers
method retrieves a list of up to the four longest geohash strings that fit within the extent of theEnvelope
.- Returns
A list of geohash Strings
-
property
geohash_neighbors
¶ The
geohash_neighbors
method retrieves a list of the geohash neighbor strings for the extent of theEnvelope
.- Returns
A list of geohash neighbor Strings
-
property
height
¶ The
height
property retrieves the extent height value.- Returns
The extent height value
-
property
polygon
¶ The
Polygon
property retrieves theEnvelope
as aPolygon
object.- Returns
A
Polygon
object
-
svg
(scale_factor=1, fill_color=None)¶ The
svg
method returns a SVG envelope element for theEnvelope
geometry.Keys
Description
scale_factor
An optional float. Multiplication factor for the SVG circle diameter. Default is 1.
fill_color
An optional string. Hex string for fill color. Default is to use “#66cc99” if geometry is valid, and “#ff3333” if invalid.
- Returns
An SVG envelope element
-
property
type
¶ The
type
method retrieves the type of the currentPolyline
object.
-
property
width
¶ The
width
property retrieves the extent width value.- Returns
The extent width value
-
SpatialReference¶
-
class
arcgis.geometry.
SpatialReference
(iterable=None, **kwargs)¶ A
SpatialReference
object can be defined using a well-known ID (wkid) or well-known text (wkt). The default tolerance and resolution values for the associated coordinate system are used.Note
The x, y and z tolerance values are 1 mm or the equivalent in the unit of the coordinate system. If the coordinate system uses feet, the tolerance is 0.00328083333 ft. The resolution values are 10x smaller or 1/10 the tolerance values. Thus, 0.0001 m or 0.0003280833333 ft. For geographic coordinate systems using degrees, the equivalent of a mm at the equator is used.
The well-known ID (WKID) for a given spatial reference can occasionally change. For example, the WGS 1984 Web Mercator (Auxiliary Sphere) projection was originally assigned WKID 102100, but was later changed to 3857. To ensure backward compatibility with older spatial data servers, the JSON wkid property will always be the value that was originally assigned to an SR when it was created. An additional property, latestWkid, identifies the current WKID value (as of a given software release) associated with the same spatial reference.
A
SpatialReference
object can optionally include a definition for a vertical coordinate system (VCS), which is used to interpret the z-values of a geometry. A VCS defines units of measure, the location of z = 0, and whether the positive vertical direction is up or down. When a vertical coordinate system is specified with a WKID, the same caveat as mentioned above applies.Note
There are two VCS WKID properties: vcsWkid and latestVcsWkid. A VCS WKT can also be embedded in the string value of the wkt property. In other words, the WKT syntax can be used to define an SR with both horizontal and vertical components in one string. If either part of an SR is custom, the entire SR will be serialized with only the wkt property.
Note
Starting at 10.3, Image Service supports image coordinate systems.
-
property
as_arcpy
¶ The
as_arcpy
property retrieves the class as anarcpy SpatialReference
object.- Returns
An
arcpy SpatialReference
object
-
svg
(scale_factor=1, fill_color=None)¶ The
svg
method retrieves SVG polygon element for aSpatialReference
field.- Returns
The SVG element
-
property
type
¶ The
type
method retrieves the type of the currentPoint
object.
-
property
Geometry¶
-
class
arcgis.geometry.
Geometry
(iterable=None, **kwargs)¶ The base class for all geometries.
You can create a Geometry even when you don’t know the exact type. The Geometry constructor is able to figure out the geometry type and returns the correct type as the example below demonstrates:
#Usage Example >>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> print (geom.type) # POLYGON >>> print (isinstance(geom, Polygon) # True
-
property
EWKT
¶ The
EKWT
method retrieves theextended well-known text
(EWKT) representation for OGC geometry. It provides a portable representation of a geometry value as a text string.Note
Any true curves in the geometry will be densified into approximate curves in the WKT string.
- Returns
A String
-
property
JSON
¶ The
JSON
method retrieves an Esri JSON representation of theGeometry
object as a string.- Returns
A string representing a
Geometry
object
-
property
WKB
¶ The
WKB
method retrieves thewell-known binary
(WKB) representation for OGC geometry. It provides a portable representation of a geometry value as a contiguous stream of bytes.- Returns
bytes
-
property
WKT
¶ The
WKY
method retrieves thewell-known text
(WKT
) representation for OGC geometry. It provides a portable representation of a geometry value as a text string.Note
Any true curves in the geometry will be densified into approximate curves in the WKT string.
- Returns
A string
-
angle_distance_to
(second_geometry, method='GEODESIC')¶ The
angle_distance_to
method retrieves a tuple of angle and distance to anotherPoint
using a measurement type.Note
The
angle_distance_to
method requires ArcPy. If ArcPy is not installed, none is returned.Argument
Description
second_geometry
Required Geometry. An
Geometry
object.method
Optional String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.angle_distance_to(second_geometry = geom2, >>> method="PLANAR") {54.5530, 1000.1111}
- Returns
A tuple of angle and distance to another
Point
using a measurement type.
-
property
area
¶ The
area
method retrieves the area of aPolygon
feature. The units of the returned area are based off theSpatialReference
field.Note
None for all other feature types.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.area -1.869999999973911e-06
- Returns
A float
-
property
as_arcpy
¶ The
as_arcpy
method retrieves the Geometry as an ArcPy Geometry.If ArcPy is not installed, none is returned.
Note
The
as_arcpy
method requires ArcPy- Returns
An
Geometry
object
-
property
as_shapely
¶ The
as_shapely
method retrieves a shapelyGeometry
object- Returns
A shapely
Geometry
object
-
boundary
()¶ The
boundary
method constructs the boundary of theGeometry
object.- Returns
A
Geometry
object
-
buffer
(distance)¶ The buffer method constructs a
Polygon
at a specified distance from theGeometry
object.Note
The
buffer
method requires ArcPyArgument
Description
distance
Required float. The buffer distance. The buffer distance is in the same units as the geometry that is being buffered. A negative distance can only be specified against a polygon geometry.
- Returns
A
Polygon
object
-
property
centroid
¶ The
centroid
method retrieves the center of theGeometry
objectNote
The
centroid
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.centroid (-97.06258999999994, 32.754333333000034)
- Returns
A tuple(x,y)
-
clip
(envelope)¶ The
clip
method constructs the intersection of theGeometry
object and the specified extent.Note
The
clip
method requires ArcPy. If ArcPy is not installed, none is returned.Argument
Description
envelope
Required tuple. The tuple must have (XMin, YMin, XMax, YMax) each value represents the lower left bound and upper right bound of the extent.
- Returns
The
Geometry
object clipped to the extent
-
contains
(second_geometry, relation=None)¶ The
contain
method indicates if the baseGeometry
object contains the comparisonGeometry
object.Note
The
contain
method requires ArcPy/ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometryrelation
Optional string. The spatial relationship type.
BOUNDARY - Relationship has no restrictions for interiors or boundaries.
CLEMENTINI - Interiors of geometries must intersect. Specifying CLEMENTINI is equivalent to specifying None. This is the default.
PROPER - Boundaries of geometries must not intersect.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.contains(second_geometry = geom2, relation="CLEMENTINI") True
- Returns
A boolean indicating containment (True), or no containment (False)
-
convex_hull
()¶ The
convex_hull
method constructs theGeometry
object that is the minimal boundingPolygon
such that all outer angles are convex.- Returns
A
Geometry
object
-
crosses
(second_geometry)¶ The
crosses
method indicates if the twoGeometry
objects intersect in a geometry of a lesser shape type.Note
The
crosses
method requires ArcPy/ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A boolean indicating yes (True), or no (False)
-
cut
(cutter)¶ The
cut
method splits thisGeometry
object into a part left of the cuttingPolyline
and a part right of it.Note
The
cut
method requires ArcPyArgument
Description
cutter
Required
Polyline
. The cutting polyline geometry- Returns
a list of two
Geometry
objects
-
densify
(method, distance, deviation)¶ The
densify
method creates a newGeometry
object with added verticesNote
The
densify
method requires ArcPyArgument
Description
method
Required String. The type of densification:
DISTANCE
,ANGLE
, orGEODESIC
distance
Required float. The maximum distance between vertices. The actual distance between vertices will usually be less than the maximum distance as new vertices will be evenly distributed along the original segment. If using a type of DISTANCE or ANGLE, the distance is measured in the units of the geometry’s spatial reference. If using a type of GEODESIC, the distance is measured in meters.
deviation
Required float.
Densify
uses straight lines to approximate curves. You use deviation to control the accuracy of this approximation. The deviation is the maximum distance between the new segment and the original curve. The smaller its value, the more segments will be required to approximate the curve.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom2 = geom.densify(method = "GEODESIC", distance = 1244.0, deviation = 100.0)
- Returns
A new
Geometry
object
-
difference
(second_geometry)¶ The
difference
method constructs theGeometry
object that is composed only of the region unique to the base geometry but not part of the other geometry.Note
The
difference
method requires ArcPy/ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A
Geometry
object
-
disjoint
(second_geometry)¶ The
disjoint
method indicates if the base and comparisonGeometry
objects share noPoint
objects in common.Note
The
disjoint
method requires ArcPy/ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A boolean indicating no
Point
objects in common (True), or some in common (False)
-
distance_to
(second_geometry)¶ The
distance_to
method retrieves the minimum distance between twoGeometry
objects. If the geometries intersect, the minimum distance is 0.Note
Both geometries must have the same projection.
Note
The
distance_to
method requires ArcPy/ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A float
-
equals
(second_geometry)¶ The
equals
method indicates if the base and comparisonGeometry
objects are of the same shape type and define the same set of points in the plane. This is a 2D comparison only; M and Z values are ignored.Note
The
equals
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
. A second geometry- Returns
boolean
-
property
extent
¶ The
extent
method retrieves the extent of theGeometry
object as a tuple containing xmin, ymin, xmax, ymaxNote
The
extent
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.extent (-97.06326, 32.749, -97.06124, 32.837)
- Returns
A tuple
-
property
first_point
¶ The
first
method retrieves first coordinate point of the geometry.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.first_point {'x': -97.06138, 'y': 32.837, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}
- Returns
A
Geometry
object
-
classmethod
from_shapely
(shapely_geometry, spatial_reference=None)¶ The
from_shapely
method creates a Python API Geometry object from a Shapely geometry object.- Returns
A
Geometry
object
# Usage Example: importing shapely geometry object and setting spatial reference to WGS84 Geometry.from_shapely( shapely_geometry=shapely_geometry_object, spatial_reference={'wkid': 4326} )
-
generalize
(max_offset)¶ The
generalize
method creates a new simplifiedGeometry
object using a specified maximum offset tolerance.Note
The
generalize
method requires ArcPy or Shapely**Argument
Description
max_offset
Required float. The maximum offset tolerance.
- Returns
A
Geometry
object
-
property
geoextent
¶ The
geoextent
property retrieves the current feature’s extent#Usage Example >>> g = Geometry({...}) >>> g.geoextent (1,2,3,4)
- Returns
tuple
-
property
geometry_type
¶ -
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.geometry_type 'polygon'
- Returns
A string representing the geometry type
-
get_area
(method, units=None)¶ The
get_area
method retrieves the area of theGeometry
using a measurement type.Note
The
get_area
method requires ArcPy or Shapely**Argument
Description
method
Required String. LANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
units
Optional String. Areal unit of measure keywords: ACRES | ARES | HECTARES | SQUARECENTIMETERS | SQUAREDECIMETERS | SQUAREINCHES | SQUAREFEET | SQUAREKILOMETERS | SQUAREMETERS | SQUAREMILES | SQUAREMILLIMETERS | SQUAREYARDS
- Returns
A float representing the area of the
Geometry
object
-
get_length
(method, units)¶ The
get_length
method retrieves the length of theGeometry
using a measurement type.Note
The
get_length
method requires ArcPy or ShapelyArgument
Description
method
Required String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
units
Required String. Linear unit of measure keywords: CENTIMETERS | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICALMILES | YARDS
- Returns
A float representing the length of the
Geometry
object
-
get_part
(index=None)¶ The
get_part
method retrieves an array ofPoint
objects for a particular part of aGeometry
object or an array containing a number of arrays, one for each part.Note
The
get_part
method requires ArcPyArgument
Description
index
Required Integer. The index position of the
Geometry
object.- Returns
A
Geometry
object
-
property
has_m
¶ The
has_m
method determines if the geometry has a M value.- Returns
A boolean indicating yes (True), or no (False)
-
property
has_z
¶ The
has_z
method determines if the geometry has a Z value.- Returns
A boolean indicating yes (True), or no (False)
-
property
hull_rectangle
¶ The
hull_rectangle
method retrieves the space-delimited string of the coordinate pairs of the convex hull rectangle.Note
The
hull-rectangle
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.hull_rectangle '-97.06153 32.749 -97.0632940971127 32.7490060186843 -97.0629938635673 32.8370055061228 -97.0612297664546 32.8369994874385'
- Returns
A space-delimited string
-
intersect
(second_geometry, dimension=1)¶ The
intersect
method constructs aGeometry
object that is the geometric intersection of the two input geometries. Different dimension values can be used to create different shape types. The intersection of two geometries of the same shape type is a geometry containing only the regions of overlap between the original geometries.Note
The
intersect
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometrydimension
Required Integer. The topological dimension (shape type) of the resulting geometry.
1 -A zero-dimensional geometry (
Point
orMultiPoint
).2 -A one-dimensional geometry (
Polyline
).4 -A two-dimensional geometry (
Polygon
).
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.intersect(second_geometry = geom2, dimension = 4) True
- Returns
A boolean indicating an intersection (True), or no intersection (False)
-
property
is_empty
¶ The
is_empty
property`` determines if the geometry is empty.- Returns
A boolean indicating empty (True), or filled (False)
-
property
is_multipart
¶ The
is_multipart
method determines if the number of parts for this geometry is more than one.Note
The
is_multipart
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.is_multipart True
- Returns
A boolean indicating yes (True), or no (False)
-
property
label_point
¶ The
label_point
method determines thePoint
at which the label is located. Thelabel_point
is always located within or on a feature.Note
The
label_point
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.label_point {'x': -97.06258999999994, 'y': 32.754333333000034, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}
- Returns
A
Point
object
-
property
last_point
¶ The
last_point
method retrieves the last coordinatePoint
of the feature.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.last_point {'x': -97.06326, 'y': 32.759, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}
- Returns
A
Point
object
-
property
length
¶ The
length
method retrieves length of the linear feature. The length units is the same as theSpatialReference
field.Note
The
length
method returns zero forPoint
andMultiPoint
feature types.Note
The
length
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.length 0.03033576008004027
- Returns
A float
-
property
length3D
¶ The
length3D
method retrieves the 3D length of the linear feature. Zero for point and multipoint The length units is the same as theSpatialReference
field.Note
The
length3D
method returns zero forPoint
andMultiPoint
feature types.Note
The
length3D
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.length3D 0.03033576008004027
- Returns
A float
-
measure_on_line
(second_geometry, as_percentage=False)¶ The
measure_on_line
retrieves a measure from the startPoint
of this line to thein_point
.Note
The
measure_on_line
method requires ArcPyArgument
Description
second_geometry
Required
Geometry
object. A second geometryas_percentage
Optional Boolean. If False, the measure will be returned as a distance; if True, the measure will be returned as a percentage.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.measure_on_line(second_geometry = geom2, as_percentage = True) 0.33
- Returns
A float
-
overlaps
(second_geometry)¶ The
overlaps
method indicates if the intersection of the twoGeometry
objects has the same shape type as one of the input geometries and is not equivalent to either of the input geometries.Note
The
overlaps
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A boolean indicating an intersection of same shape type (True), or different type (False)
-
property
part_count
¶ The
part_count
method retrieves the number ofGeometry
parts for the feature.>>> geom = Geometry({ "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], [-97.06326,32.759]]], "spatialReference" : {"wkid" : 4326} }) >>> geom.part_count 1
- Returns
An Integer representing the amount of
Geometry
parts
-
property
point_count
¶ The
point_count
method retrieves total number ofPoint
objects for the feature.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.point_count 9
- Returns
An Integer representing the amount of
Point
objects
-
point_from_angle_and_distance
(angle, distance, method='GEODESCIC')¶ The
point_from_angle_and_distance
retrieves aPoint
at a given angle and distance, in degrees and meters, using the specified measurement type.Note
The
point_from_angle_and_distance
method requires ArcPyArgument
Description
angle
Required Float. The angle in degrees to the returned point.
distance
Required Float. The distance in meters to the returned point.
method
Optional String. PLANAR measurements reflect the projection of geographic data onto the 2D surface (in other words, they will not take into account the curvature of the earth). GEODESIC, GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE measurement types may be chosen as an alternative, if desired.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> point = geom.point_from_angle_and_distance(angle=60, distance = 100000, method = "PLANAR") >>> point.type "POINT"
- Returns
A
Point
object
-
position_along_line
(value, use_percentage=False)¶ The
position_along_line
method retrieves aPoint
on a line at a specified distance from the beginning of the line.Note
The
position_along_line
method requires ArcPy or ShapelyArgument
Description
value
Required Float. The distance along the line.
use_percentage
Optional Boolean. The distance may be specified as a fixed unit of measure or a ratio of the length of the line. If True, value is used as a percentage; if False, value is used as a distance.
Note
For percentages, the value should be expressed as a double from 0.0 (0%) to 1.0 (100%).
- Returns
A
Geometry
object
-
project_as
(spatial_reference, transformation_name=None)¶ The
project_as
method projects aGeometry
object and optionally applies ageotransformation
.Note
The
project_as
method requires ArcPy or pyproj>=1.9 and PROJ.4Argument
Description
spatial_reference
Required SpatialReference. The new spatial reference. This can be a
SpatialReference
object or the coordinate system name.transformation_name
Required String. The
geotransformation
name.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom2 = geom.project_as(spatial_reference="GCS", transformation_name = "transformation") >>> geom2.type arcgis.geometry.Geometry
- Returns
A
Geometry
object
-
query_point_and_distance
(second_geometry, use_percentage=False)¶ The
query_point_and_distance
method finds thePoint
on thePolyline
nearest to the in_point and the distance between those points.query_point_and_distance
retrieves information about the side of the line the in_point is on as well as the distance along the line where the nearest point occurs.Note
The
query_point_and_distance
method requires ArcPyArgument
Description
second_geometry
Required
Geometry
object. A second geometryas_percentage
Optional boolean - if False, the measure will be returned as distance, True, measure will be a percentage
- Returns
A tuple
-
rotate
(theta, inplace=False)¶ The
rotate
methode rotates aGeometry
object counter-clockwise by a given angle.Argument
Description
theta
Required Float. The rotation angle.
inplace
Optional Boolean. If True, the value is updated in the object, False creates a new object
- Returns
A
Geometry
object
-
scale
(x_scale=1, y_scale=1, inplace=False)¶ The
scale
method scales aGeometry
object in either the x,y or both directions.Argument
Description
x_scale
Optional Float. The x-scale factor.
y_scale
Optional Float. The y-scale factor.
inplace
Optional Boolean. If True, the value is updated in the object, False creates a new object
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom2 = geom.sacle(x_scale = 3, y_scale = 0.5, inplace = False)
- Returns
A
Geometry
object
-
segment_along_line
(start_measure, end_measure, use_percentage=False)¶ The
segment_along_line
method retrieves aPolyline
betweenstart
andend
measures.segment_along_line
is similar to thepositionAlongLine
method but will return a polyline segment between two points on the polyline instead of a singlePoint
.Note
The
segment_along_line
method requires ArcPyArgument
Description
start_measure
Required Float. The starting distance from the beginning of the line.
end_measure
Required Float. The ending distance from the beginning of the line.
use_percentage
Optional Boolean. The start and end measures may be specified as fixed units or as a ratio. If True, start_measure and end_measure are used as a percentage; if False, start_measure and end_measure are used as a distance.
Note
For percentages, the measures should be expressed as a double from 0.0 (0 percent) to 1.0 (100 percent).
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.segment_along_line(start_measure =0, end_measure= 1000, use_percentage = True) 0.56 :return: a float
-
skew
(x_angle=0, y_angle=0, inplace=False)¶ The
skew
method creates a skew transform along one or both axes.Argument
Description
x_angle
optional Float. Angle to skew in the x coordinate
y_angle
Optional Float. Angle to skew in the y coordinate
inplace
Optional Boolean. If True, the value is updated in the object, False creates a new object
- Returns
A
Geometry
object
-
snap_to_line
(second_geometry)¶ The
snap_to_line
method retrieves a newPoint
based on in_point snapped to thisGeometry
object.Note
The
snap_to_line
method requires ArcPyArgument
Description
second_geometry
Required
Geometry
- A second geometry- Returns
A
Point
object
-
property
spatial_reference
¶ The
spatial_reference
method retrieves theSpatialReference
of the geometry.>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.spatial_reference <SpatialReference Class>
- Returns
A
SpatialReference
object
-
symmetric_difference
(second_geometry)¶ The
symmetric_difference
method constructs a newGeometry
object that is the union of two geometries minus the intersection of those geometries.Note
The two input geometries must be the same shape type.
Note
The
symmetric_difference
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A
Geometry
object
-
touches
(second_geometry)¶ The
touches
method indicates if the boundaries of the twoGeometry
objects intersect.Note
The
touches
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
method. A second geometry- Returns
A boolean indicating whether the
Geometry
objects touch (True), or if they do not touch (False)
-
translate
(x_offset=0, y_offset=0, inplace=False)¶ The
translate
method moves aGeometry
object in the x and y direction by a given distance.Argument
Description
x_offset
Optional Float. Translation x offset
y_offset
Optional Float. Translation y offset
inplace
Optional Boolean. If True, updates the existing Geometry,else it creates a new Geometry object
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.translate(x_offset = 40, y_offset = 50, inplace = True)
- Returns
A
Geometry
object
-
property
true_centroid
¶ The
true_centroid
method retrieves thePoint
representing the center of gravity for a feature.Note
The
true_centroid
method requires ArcPy or Shapely>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.true_centroid {'x': -97.06272135472369, 'y': 32.746201426025, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}
- Returns
A
Point
object
-
union
(second_geometry)¶ The
union
method constructs theGeometry
object that is the set-theoretic union of the input geometries.Note
The
union
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometry- Returns
A
Geometry
object
-
within
(second_geometry, relation=None)¶ The
within
method indicates if the baseGeometry
object is within the comparisonGeometry
object.Note
The
within
method requires ArcPy or ShapelyArgument
Description
second_geometry
Required
Geometry
object. A second geometryrelation
Optional String. The spatial relationship type.
BOUNDARY - Relationship has no restrictions for interiors or boundaries.
CLEMENTINI - Interiors of geometries must intersect. Specifying CLEMENTINI is equivalent to specifying None. This is the default.
PROPER - Boundaries of geometries must not intersect.
- Returns
A boolean indicating the
Geometry
object is within (True), or not within (False)
-
property
areas_and_lengths¶
-
arcgis.geometry.
areas_and_lengths
(polygons, length_unit, area_unit, calculation_type, spatial_ref=4326, gis=None, future=False)¶ The
areas_and_lengths
function calculates areas and perimeter lengths for eachPolygon
specified in the input array.Keys
Description
polygons
The array of
Polygon
whose areas and lengths are to be computed.length_unit
The length unit in which the perimeters of polygons will be calculated. If
calculation_type
is planar, thenlength_unit
can be any esriUnits constant. Iflength_unit
is not specified, the units are derived fromspatial_ref
. IfcalculationType
is not planar, thenlength_unit
must be a linear esriUnits constant, such as esriSRUnit_Meter or esriSRUnit_SurveyMile. Iflength_unit
is not specified, the units are meters. For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type Constant.area_unit
The area unit in which areas of polygons will be calculated. If calculation_type is planar, then area_unit can be any esriUnits constant. If
area_unit
is not specified, the units are derived fromspatial_ref
. Ifcalculation_type
is not planar, thenarea_unit
must be a linear esriUnits constant such as esriSRUnit_Meter or esriSRUnit_SurveyMile. If area_unit 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.calculation_type
The type defined for the area and length calculation of the input geometries. The type can be one of the following values:
1. planar - Planar measurements use 2D Euclidean distance to calculate area and length. This should only be used if the area or length needs to be calculated in the given
SpatialReference
. Otherwise, usepreserveShape
.2. 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 thePolygon
. A geodesic segment is the shortest path between two points on an ellipsoid.3. 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.
future
A required Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> geom.areas_and_lengths(polygons =[polygon1, polygon2,...], length_unit = "esriMeters", area_unit = "esriSquareMeters", calculation_type = "planar", future = True)
- Returns
JSON as dictionary
auto_complete¶
-
arcgis.geometry.
auto_complete
(polygons=None, polylines=None, spatial_ref=None, gis=None, future=False)¶ The
auto_complete
function simplifies the process of constructing newPolygon
objects that are adjacent to other polygons. It constructs polygons that fill in the gaps between existing polygons and a set ofPolyline
objects.Keys
Description
polygons
An array of
Polygon
objectspolylines
An List of
Polyline
objectsspatial_ref
A
SpatialReference
of the input geometries WKIDfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
A
Polygon
object
buffer¶
-
arcgis.geometry.
buffer
(geometries, in_sr, distances, unit, out_sr=None, buffer_sr=None, union_results=None, geodesic=None, gis=None, future=False)¶ The
buffer
function is performed on a geometry service resource The result of this function is a bufferedPolygon
at the specified distances for the inputGeometry
array.Note
The options are available to union buffers and to use geodesic distance.
Keys
Description
geometries
The array of geometries to be buffered
in_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the input geometries.distances
The distances that each of the input geometries is buffered.
unit
The units for calculating each buffer distance. If unit is not specified, the units are derived from
bufferSR
. IfbufferSR
is not specified, the units are derived fromin_sr
.out_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the output geometries.buffer_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the buffer geometries.union_results
A boolean. If True, all geometries buffered at a given distance are unioned into a single (gis,possibly multipart)
Polygon
, and the unioned geometry is placed in the output array. The default is False.geodesic
Set geodesic to true to buffer the input geometries using geodesic distance. Geodesic distance is the shortest path between two points along the ellipsoid of the earth. If geodesic is set to False, the 2D Euclidean distance is used to buffer the input geometries.
Note
The default value depends on the geometry type, unit and bufferSR.
future
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> new_poly = geom.buffer(geometries =[geom1, geom2,...], in_sr = "wkid_in", unit = "esriMeters", out_sr = "wkid_out", buffer_sr = "wkid_buffer", union_results =True, geodesic = True, future = True) >>> new_poly.type "POLYGON"
- Returns
A
Polygon
object
convex_hull¶
-
arcgis.geometry.
convex_hull
(geometries, spatial_ref=None, gis=None, future=False)¶ The convex_hull function is performed on a
Geometry
service resource. It returns the convex hull of the input geometry. The input geometry can be aPoint
,MultiPoint
,Polyline
, orPolygon
.Note
The convex hull is typically a polygon but can also be a polyline or point in degenerate cases.
Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
The convex hull of the
Geometry
object
cut¶
-
arcgis.geometry.
cut
(cutter, target, spatial_ref=None, gis=None, future=False)¶ The cut function is performed on a
Geometry
service resource. This function splits the targetPolyline
orPolygon
where it is crossed by the cutter polyline.Note
At 10.1 and later, this function calls simplify on the input cutter and target geometries.
Keys
Description
cutter
The
Polyline
that will be used to divide the target into pieces where it crosses the target.The spatial reference of the polylines is specified byspatial_ref
.Note
The structure of the polyline is the same as the structure of the JSON polyline objects returned by the ArcGIS REST API.
geometries
The array of
Polyline
orPolygon
to be cut. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. The spatial reference of the target geometry array is specified by spatial_ref.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or a JSON object for the output geometryfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
A List of
Geometry
objects
densify¶
-
arcgis.geometry.
densify
(geometries, spatial_ref, max_segment_length, length_unit, geodesic=False, gis=None, future=False)¶ The
densify
function is performed using theGIS
geometry engine. This function densifiesGeometry
objects by plottingPoint
objects between existing vertices.Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.spatial_ref
The
well-known ID
or a spatial reference JSON object for the inputPolyline
object.Note
For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.
max_segment_len
All segments longer than
maxSegmentLength
are replaced with sequences of lines no longer thanmax_segment_length
.length_unit
The length unit of
max_segment_length
. Ifgeodesic
is set to false, then the units are derived fromspatial_ref
, andlength_unit
is ignored. Ifgeodesic
is set to true, thenlength_unit
must be a linear unit. In a case wherelength_unit
is not specified andspatial_ref
is a PCS, the units are derived fromspatial_ref
. In a case wherelength_unit
is not specified andspatial_ref
is a GCS, then the units are meters.geodesic
If geodesic is set to true, then geodesic distance is used to calculate max_segment_length. Geodesic distance is the shortest path between two points along the ellipsoid of the earth. If geodesic is set to false, then 2D Euclidean distance is used to calculate max_segment_length. The default is false.
future
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> new_geom = geom.densify(geometries =[geom1, geom2,...], spatial_ref = "wkid", max_segment_length = 100.0, length_unit = "esriMeters", geodesic = True, future = True) >>> new_geom.type "GEOMETRY"
- Returns
A
Geometry
object
difference¶
-
arcgis.geometry.
difference
(geometries, spatial_ref, geometry, gis=None, future=False)¶ The
difference
function is performed on a geometry service resource. This function constructs the set-theoretic difference between each element of an array of geometries and another geometry the so-called difference geometry. In other words, let B be the difference geometry. For each geometry, A, in the input geometry array, it constructs A-B.Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.geometry
A single geometry of any type and of a dimension equal to or greater than the elements of geometries. The structure of geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. The use of simple syntax is not supported.
spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
A
Geometry
object
distance¶
-
arcgis.geometry.
distance
(spatial_ref, geometry1, geometry2, distance_unit='', geodesic=False, gis=None, future=False)¶ The
distance
function is performed on a geometry service resource. It reports the 2D Euclidean or geodesic distance between the twoGeometry
objects.- Returns
The 2D or geodesic distance between the two
Geometry
objects
find_transformation¶
-
arcgis.geometry.
find_transformation
(in_sr, out_sr, extent_of_interest=None, num_of_results=1, gis=None, future=False)¶ The
find_transformations
function is performed on aGeometry
service resource. This function returns a list of applicable geographic transformations you should use when projecting geometries from the inputSpatialReference
to the outputSpatialReference
. 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.Note
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.
Keys
Description
in_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the input geometries.out_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the output geometries.ext_of_interest
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.
Note
If a
SpatialReference
is not included in the JSON envelope, thein_sr
is used for the envelope.num_of_results
The number of geographic transformations to return. The default value is 1.
Note
If
num_of_results
has a value of -1, all applicable transformations are returned.future
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
A List of geographic transformations
from_geo_coordinate_string¶
-
arcgis.geometry.
from_geo_coordinate_string
(spatial_ref, strings, conversion_type, conversion_mode=None, gis=None, future=False)¶ The
from_geo_coordinate_string
function is performed on aGeometry
service resource. The function converts an array of well-known strings into xy-coordinates based on the conversion type andSpatialReference
supplied by the user. An optional conversion mode parameter is available for some conversion types. Seeto_geo_coordinate_strings
for more information on the opposite conversion.Keys
Description
spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectstrings
An array of strings formatted as specified by conversion_type. Syntax: [<string1>,…,<stringN>]
conversion-type
The conversion type of the input strings.
Note
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
conversion_mode
Conversion options for MGRS, UTM and GARS conversion types.
Note
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 80 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
Note
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
future
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> coords = from_geo_coordinate_string(spatial_ref = "wkid", strings = ["01N AA 66021 00000","11S NT 00000 62155", "31U BT 94071 65288"] conversion_type = "MGRS", conversion_mode = "mgrs_default", future = True) >>> coords [[x1,y1], [x2,y2], [x3,y3]]
- Returns
An array of (x,y) coordinates
generalize¶
-
arcgis.geometry.
generalize
(spatial_ref, geometries, max_deviation, deviation_unit, gis=None, future=False)¶ The
generalize
function is performed on aGeometry
service resource. The generalize function simplifies the input geometries using the Douglas-Peucker algorithm with a specified maximum deviation distance.Note
The output geometries will contain a subset of the original input vertices.
Keys
Description
geometries
The array
Geometry
objects to be generalized.max_deviation
max_deviation
sets the maximum allowable offset, which will determine the degree of simplification. This value limits the distance the output geometry can differ from the input geometry.deviation_unit
If
geodesic
is set to true, then the geodesic distancebetween the
geometry1
andgeometry2
geometries is returned. Geodesic distance is the shortest path between two points along the ellipsoid of the earth. Ifgeodesic
is set to false or not specified, the planar distance is returned. The default value is false.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
An array of the simplified
Geometry
objects
intersect¶
-
arcgis.geometry.
intersect
(spatial_ref, geometries, geometry, gis=None, future=False)¶ The
intersect
function is performed on aGeometry
service resource. This function constructs the set-theoretic intersection between an array of geometries and another geometry.Note
The dimension of each resultant geometry is the minimum dimension of the input geometry in the geometries array and the other geometry specified by the geometry parameter.
Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.geometry
A single
Geometry
of any type and of a dimension equal to or greater than the elements of geometries. The structure of geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. The use of simple syntax is not supported.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
The set-theoretic dimension between
Geometry
objects
label_points¶
-
arcgis.geometry.
label_points
(spatial_ref, polygons, gis=None, future=False)¶ The
label_points
function is performed on aGeometry
service resource. ThelabelPoints
function calculates an interiorPoint
for eachPolygon
specified in the input array. These interior points can be used by clients for labeling the polygons.Keys
Description
polygons
An array of
Polygon
objects whose labelPoint
objects are to be computed. The spatial reference of the polygons is specified byspatial_ref
.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
An array of
Point
objects
lengths¶
-
arcgis.geometry.
lengths
(spatial_ref, polylines, length_unit, calculation_type, gis=None, future=False)¶ The
lengths
function is performed on aGeometry
service resource. This function calculates the` 2D Euclidean` or geodesic lengths of eachPolyline
specified in the input array.Keys
Description
polylines
The array of
Polyline
whose lengths are to be computed.length_unit
The length unit in which the length of
Polyline
will be calculated. Ifcalculation_type
is planar, thenlength_unit
can be any esriUnits constant. IflengthUnit
is not specified, the units are derived fromspatial_ref
. IfcalculationType
is not planar, then lengthUnit must be a linear esriUnits constant, such as esriSRUnit_Meter or esriSRUnit_SurveyMile. Iflength_unit
is not specified, the units are meters. For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type Constant.calculation_type
The type defined for the length calculation of the input geometries. The type can be one of the following values:
1. planar - Planar measurements use 2D Euclidean distance to calculate area and length. This should only be used if the area or length needs to be calculated in the given
SpatialReference
. Otherwise, usepreserveShape
.2. 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 thePolygon
. A geodesic segment is the shortest path between two points on an ellipsoid.3. 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.
future
A required Boolean. This operation determines if the job is run asynchronously or not.
- Returns
A list of floats of 2D-Euclidean or Geodesic lengths
offset¶
-
arcgis.geometry.
offset
(geometries, offset_distance, offset_unit, offset_how='esriGeometryOffsetRounded', bevel_ratio=10, simplify_result=False, spatial_ref=None, gis=None, future=False)¶ The
offset
function is performed on aGeometry
service resource. This function constructs geometries that are offset from the given input geometries. If the offset parameter is positive, the constructed offset will be on the right side of the geometry. Left side offsets are constructed with negative parameters.Note
Tracing the geometry from its first vertex to the last will give you a direction along the geometry. It is to the right and left perspective of this direction that the positive and negative parameters will dictate where the offset is constructed. In these terms, it is simple to infer where the offset of even horizontal geometries will be constructed.
Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.offset_distance
Specifies the distance for constructing an offset based on the input geometries.
Note
If the
offset_distance
parameter is positive, the constructed offset will be on the right side of the curve. Left-side offsets are constructed with negative values.offset_unit
A unit for offset distance. If a unit is not specified, the units are derived from
spatial_ref
.offset_how
The
offset_how
parameter determines how outer corners between segments are handled. The three options are as follows:esriGeometryOffsetRounded
- Rounds the corner between extended offsets.esriGeometryOffsetBevelled
- Squares off the corner after a given ratio distance.
3.
esriGeometryOffsetMitered
- Attempts to allow extended offsets to naturally intersect, but if that intersection occurs too far from the corner, the corner is eventually bevelled off at a fixed distance.bevel_ratio
bevel_ratio
is multiplied by theoffset_distance
, and the result determines how far a mitered offset intersection can be located before it is bevelled. When mitered is specified, bevel_ratio is ignored and 10 is used internally. When bevelled is specified, 1.1 will be used if bevel_ratio is not specified.bevel_ratio
is ignored for rounded offset.simplify_result
if
simplify_result
is set to true, then self intersecting loops will be removed from the result offset geometries. The default is false.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> new_geom = offset(geometries = [geom1,geom2,...], offset_distance = 100, offset_unit = "esriMeters", offset_how = "esriGeometryOffsetRounded", bevel_ratio = 0, simplify_result = True spatial_ref = "wkid", future = True) >>> new_geom.type arcgis.geometry.Geometry
- Returns
A
Geometry
object
project¶
-
arcgis.geometry.
project
(geometries, in_sr, out_sr, transformation='', transform_forward=False, gis=None, future=False)¶ The
project
function is performed on aGeometry
service resource. This function projects an array of input geometries from the inputSpatialReference
to the outputSpatialReference
Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.in_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the input geometries.out_sr
The well-known ID of the
SpatialReference
or a spatial reference JSON object for the output geometries.transformations
The WKID or a JSON object specifying the geographic transformation (gis,also known as datum transformation) to be applied to the projected geometries.
Note
A transformation is needed only if the output
SpatialReference
contains a different geographic coordinate system than the input spatial reference.transformforward
A Boolean value indicating whether or not to transform forward. The forward or reverse direction of transformation is implied in the name of the transformation. If transformation is specified, a value for the
transform_Forward
parameter must also be specified. The default value is false.future
An optional Boolean. This operation determines if the job is run asynchronously or not.
#Usage Example >>> input_geom = [{"x": -17568824.55, "y": 2428377.35}, {"x": -17568456.88, "y": 2428431.352}] >>> result = project(geometries = input_geom, in_sr = 3857, out_sr = 4326) [{"x": -157.82343617279275, "y": 21.305781607280093}, {"x": -157.8201333369876, "y": 21.306233559873714}]
- Returns
A list of
Geometry
objects in theout_sr
coordinate system
relation¶
-
arcgis.geometry.
relation
(geometries1, geometries2, spatial_ref, spatial_relation='esriGeometryRelationIntersection', relation_param='', gis=None, future=False)¶ The
relation
function is performed on aGeometry
service resource. This function determines the pairs of geometries from the input geometry arrays that participate in the specified spatial relation. Both arrays are assumed to be in the spatial reference specified byspatial_ref
, which is a required parameter. Geometry types cannot be mixed within an array.Note
The relations are evaluated in 2D. In other words, z coordinates are not used.
Keys
Description
geometry1
The first array of
Geometry
objects to compute relations.geometry2
The second array of
Geometry
objects to compute relations.relation_param
The Shape Comparison Language string to be evaluated.
spatial_relation
The spatial relationship to be tested between the two input geometry arrays. Values: esriGeometryRelationCross | esriGeometryRelationDisjoint | esriGeometryRelationIn | esriGeometryRelationInteriorIntersection | esriGeometryRelationIntersection | esriGeometryRelationLineCoincidence | esriGeometryRelationLineTouch | esriGeometryRelationOverlap | esriGeometryRelationPointTouch | esriGeometryRelationTouch | esriGeometryRelationWithin | esriGeometryRelationRelation
spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> new_geom = relation(geometry1 = [geom1,geom2,...], geometry2 = [geom21,geom22,..], relation_param = "relationParameter", spatial_relation = "esriGeometryRelationPointTouch" spatial_ref = "wkid", future = True) >>> new_geom [[geom1,geom22], [geom2,geom21]]
- Returns
An array of paired
Geometry
objects
reshape¶
-
arcgis.geometry.
reshape
(spatial_ref, target, reshaper, gis=None, future=False)¶ The
reshape
function is performed on aGeometry
service resource. It reshapes aPolyline
orPolygon
feature by constructing a polyline over the feature. The feature takes the shape of the reshaper polyline from the first place the reshaper intersects the feature to the last.Keys
Description
target
reshaper
The single-part
Polyline
that does the reshaping.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or a JSON object for the input geometryfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
to_geo_coordinate_string¶
-
arcgis.geometry.
to_geo_coordinate_string
(spatial_ref, coordinates, conversion_type, conversion_mode='mgrsDefault', num_of_digits=None, rounding=True, add_spaces=True, gis=None, future=False)¶ The
to_geo_coordinate_string
function is performed on aGeometry
service resource. The function converts an array of xy-coordinates into well-known strings based on the conversion type andSpatialReference
supplied by theUser
. Optional parameters are available for some conversion types. Seefrom_geo_coordinate_strings
for more information on the opposite conversion.Note
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.
Keys
Description
spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectcoordinates
An array of xy-coordinates in JSON format to be converted. Syntax: [[x1,y2],…[xN,yN]]
conversion-type
The conversion type of the input strings.
Note
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
conversion_mode
Conversion options for MGRS, UTM and GARS conversion types.
Note
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 80 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
Note
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
num_of_digits
The number of digits to output for each of the numerical portions in the string. The default value for
num_of_digits
varies depending onconversion_type
.rounding
If
True
, then numeric portions of the string are rounded to the nearest whole magnitude as specified by num_of_digits. Otherwise, numeric portions of the string are truncated. The rounding parameter applies only to conversion types MGRS, USNG and GeoRef. The default value isTrue
.addSpaces
If
True
, then spaces are added between components of the string. TheaddSpaces
parameter applies only to conversion types MGRS, USNG and UTM. The default value for MGRS isFalse
, while the default value for both USNG and UTM isTrue
.future
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> strings = from_geo_coordinate_string(spatial_ref = "wkid", coordinates = [[x1,y1], [x2,y2], [x3,y3]] conversion_type = "MGRS", conversion_mode = "mgrs_default", future = True) >>> strings ["01N AA 66021 00000","11S NT 00000 62155", "31U BT 94071 65288"]
- Returns
An array of Strings
trim_extend¶
-
arcgis.geometry.
trim_extend
(spatial_ref, polylines, trim_extend_to, extend_how=0, gis=None, future=False)¶ The
trim_extend
function is performed on aGeometry
service resource. This function trims or extends eachPolyline
specified in the input array, using the user-specified guide polylines.Note
When trimming features, the part to the left of the oriented cutting line is preserved in the output, and the other part is discarded. An empty
Polyline
is added to the output array if the corresponding input polyline is neither cut nor extended.Keys
Description
polylines
An array of
Polyline
objects to trim or extendtrim_extend_to
A
Polyline
that is used as a guide for trimming or extending input polylines.extend_how
A flag that is used along with the trimExtend function.
0
- By default, an extension considers both ends of a path. The old ends remain, and new points are added to the extended ends. The new points have attributes that are extrapolated from adjacent existing segments.1
- If an extension is performed at an end, relocate the end point to the new position instead of leaving the old point and adding a new point at the new position.2
- If an extension is performed at an end, do not extrapolate the end-segment’s attributes for the new point. Instead, make its attributes the same as the current end. Incompatible with esriNoAttributes.4
- If an extension is performed at an end, do not extrapolate the end-segment’s attributes for the new point. Instead, make its attributes empty. Incompatible with esriKeepAttributes.8
- Do not extend the ‘from’ end of any path.16
- Do not extend the ‘to’ end of any path.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
>>> geom = Geometry({ >>> "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832], >>> [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749], >>> [-97.06326,32.759]]], >>> "spatialReference" : {"wkid" : 4326} >>> }) >>> polylines_arr = trim_extends(polylines = [polyline1,polyline2, ...], trim_extend_to = polyline_trimmer extend_how = 2, spatial_ref = "wkid", future = True) >>> polyline_arr [polyline1, polyline2,...]
- Returns
An array of
Polyline
objects
union¶
-
arcgis.geometry.
union
(spatial_ref, geometries, gis=None, future=False)¶ The
union
function is performed on aGeometry
service resource. This function constructs the set-theoretic union of the geometries in the input array.Note
All inputs must be of the same type.
Keys
Description
geometries
An array of
Point
,MultiPoint
,Polyline
, orPolygon
objects. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.spatial_ref
A
SpatialReference
of the input geometries Well-Known ID or JSON objectfuture
An optional Boolean. This operation determines if the job is run asynchronously or not.
- Returns
The set-theoretic union of the
Geometry
objects