Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Esri Developer

ArcGIS API for PythonAPI Reference

arcgis.geometry.functions module

Thefunctions module is used to takeGeometry objectsas parameter arguments and returnGeometry objects as results.

These functions use spatial references as inputs and outputs. They can be entered asSpatialReference objects or as integer values representing thewell-known ID of each reference.

>>>fromarcgis.geometryinputSpatialReference>>>sr=SpatialReference(iterable={"wkid":3857})>>>function_res=function_name(...                                 spatial_ref = sr,                                 ...)

or

>>>sr=3857>>>function_res=function(...                            in_sr = sr,                            ...)

For further details and explanation of concepts, seeUsing Spatial References.Also see theWorking with Geometries Introduction guide in theEditingsection of the API for Python documentation.

For a complete list of well-known ID values, seeCoordinate System PDF

GeometryJob

classarcgis.geometry.GeometryJob(future:Future,task_name:str,jobid:str=None,task_url:str=None,notify:bool=False,gis=None,out_wkid:int=None)
cancelled()

Return True if the call was successfully cancelled.

Returns:

boolean

done()

Return True if the call was successfully cancelled or finished running.

Returns:

boolean

propertyelapse_time

Returns the amount of time that has passed while theAsyncJob ran.

result()

returns the job result

running()

Return True if the call is currently being executed and cannot be cancelled.

Returns:

boolean

Enumerations

AreaUnits

classarcgis.geometry.functions.AreaUnits(value,names=None,*,module=None,qualname=None,type=None,start=1,boundary=None)

Represents the Supported Geometry Service Area Units Enumerations.Example: areas_and_lengths(polygons=[geom],area_unit=AreaUnits.ACRES)

ACRES={'areaUnit':'esriAcres'}
ARES={'areaUnit':'esriAres'}
HECTARES={'areaUnit':'esriHectares'}
SQUARECENTIMETERS={'areaUnit':'esriSquareCentimeters'}
SQUAREDECIMETERS={'areaUnit':'esriSquareDecimeters'}
SQUAREFEET={'areaUnit':'esriSquareFeet'}
SQUAREINCHES={'areaUnit':'esriSquareInches'}
SQUAREKILOMETERS={'areaUnit':'esriSquareKilometers'}
SQUAREMETERS={'areaUnit':'esriSquareMeters'}
SQUAREMILES={'areaUnit':'esriSquareMiles'}
SQUAREMILLIMETERS={'areaUnit':'esriSquareMillimeters'}
SQUAREYARDS={'areaUnit':'esriSquareYards'}
UNKNOWNAREAUNITS={'areaUnit':'esriUnknownAreaUnits'}

LengthUnits

classarcgis.geometry.functions.LengthUnits(value,names=None,*,module=None,qualname=None,type=None,start=1,boundary=None)

Represents the Geometry Service Length Units EnumerationsExample: areas_and_lengths(polygons=[geom],length_unit=LengthUnits.FOOT)

ARCMINUTE=9103
ARCMINUTECENTESIMAL=9112
ARCSECOND=9104
ARCSECONDCENTESIMAL=9113
BENOIT1895A_CHAIN=9052
BENOIT1895A_FOOT=9051
BENOIT1895A_LINK=9053
BENOIT1895A_YARD=9050
BENOIT1895B_CHAIN=9062
BENOIT1895B_FOOT=9061
BENOIT1895B_LINK=9063
BENOIT1895B_YARD=9060
BRITISH1936FOOT=9095
CENTIMETER=1033
CLARKECHAIN=9038
CLARKEFOOT=9005
CLARKELINK=9039
CLARKEYARD=9037
DECIMETER=109005
DEGREE=9102
FATHOM=9014
FIFTYKMLENGTH=109030
FOOT=9002
FOOT1865=9070
GERMANMETER=9031
GOLDCOASTFOOT=9094
GON=9106
GRAD=9105
INDIAN1937FOOT=9081
INDIAN1937YARD=9085
INDIAN1962FOOT=9082
INDIAN1962YARD=9086
INDIAN1975FOOT=9083
INDIAN1975YARD=9087
INDIANFOOT=9080
INDIANYARD=9084
INTERNATIONALCHAIN=9097
INTERNATIONALINCH=109008
INTERNATIONALLINK=9098
INTERNATIONALROD=109010
INTERNATIONALYARD=9096
KILOMETER=9036
METER=9001
MICRORADIAN=9109
MIL6400=9114
MILLIMETER=1025
NAUTICALMILE=9030
ONEFIFTYKMLENGTH=109031
RADIAN=9101
SEARSCHAIN=9042
SEARSFOOT=9041
SEARSLINK=9043
SEARSYARD=9040
STATUTEMILE=9093
SURVEYCHAIN=9033
SURVEYFOOT=9003
SURVEYLINK=9034
SURVEYMILE=9035
SURVEYYARD=109002
UKNAUTICALMILE=109013
USNAUTICALMILE=109012
USSURVEYINCH=109009
USSURVEYROD=109011

Functions

areas_and_lengths

arcgis.geometry.functions.areas_and_lengths(polygons:Polygon,length_unit:str|LengthUnits,area_unit:str|AreaUnits,calculation_type:str,spatial_ref:int=4326,gis:gis.GIS|None=None,future:bool=False)

Theareas_and_lengths function calculates areas and perimeter lengthsfor eachPolygon specified in the input array.

Keys

Description

polygons

The list ofPolygon objects whose areas and lengthsare to be computed.

length_unit

The length unit in which the perimeters of polygons will be calculated.

  • Ifcalculation_type isplanar, then this argument can be anyesriUnitsconstant string or integer.

  • IfcalculationType isnot planar, thenlength_unit must be a linearLengthUnits constant or string. For example:

    • Formeters, use9001 orLengthUnits.METER

    • Forsurvey miles, use9035 orLengthUnits.SURVEYMILE

  • Iflength_unit is not specified, the units are derived fromspatial_ref.Ifspatial_ref is not specified as well, the units are inmeters.

area_unit

The area unit in which areas of polygons will be calculated.

  • Ifcalculation_type isplanar, then area_unit can be anyesriAreaUnits constant.

  • Ifcalculation_type is not planar, thenarea_unit must be anAreaUnits dictionary.For example,

    • forsquare meters use -{“areaUnit”: “esriSquareMeters”}

    • forsquare miles use -{“areaUnit”: “esriSquareMiles”}

  • Ifarea_unit is not specified, the units are derived from thespatial_ref.Ifspatial_ref is not specified, then the units are in square meters.

calculation_type

The type defined for the area and length calculation of the input geometries. The type can be oneof the following values:

  • planar - Planar measurements use 2D Euclidean distance to calculate area and length. Thisshould only be used if the area or length needs to be calculated in the givenSpatialReference. Otherwise, usepreserveShape.

  • geodesic - Use this type if you want to calculate an area or length using only the verticesof thePolygon and define the lines between the points as geodesicsegments independent of the actual shape of thePolygon. A geodesicsegment is the shortest path between two points on an ellipsoid.

  • preserveShape - This type calculates the area or length of the geometry on the surface ofthe Earth ellipsoid. The shape of the geometry in its coordinate system is preserved.

spatial_ref

Optional integer. The desired spatial reference of the output. Integer valueis thewkid value of the spatial reference. Default4326.

Note

SeeUsing Spatial Referencesfor links to comprehensive list of values.

gis

OptionalGIS object. If no argument provided, the activeGIS will be used.

future

Optional boolean.

  • IfTrue, aGeometryJob that can be queriedwill be returned and control returns to the user.

  • IfFalse, a dictionary object with results after the function completes.

Returns:

A dictionary with result output iffuture=False, or aGeometryJob objectiffuture = True.

>>>fl_item=gis.content.get("<item_id>")#Feature Layer item with polygon later>>>poly_lyr=fl_item.layers[0]>>>polygon1=poly_lyr.query(where="objectid=14, as_df=True).SHAPE.loc[0]>>>polygon2=poly_lyr.query(where="objectid=38, as_df=True).SHAPE.loc[0]# Usage Example 1>>>output_1=areas_and_lengths(polygons=[polygon1,polygon2],length_unit=9001,area_unit={"areaUnit":"esriSquareMeters"},spatial_ref=3857,calculation_type="preserveShape")>>>output_1{'areas':[7845609.082046935,52794153.65053841],'lengths':[29042.783436295722,98763.80242520552]}# Usage Example 2>>>fromarcgis.geometryimportLengthUnits,AreaUnits>>>output_2=areas_and_lengths(polygons=[polygon1,polygon2,...],length_unit=LengthUnits.FOOT,area_unit=AreaUnits.SQUAREFEET,spatial_ref={"wkid":3857}calculation_type="planar",future=True)>>>trials=0>>>whiletrials<10:>>>ifnotft_output.done():>>>print("...processing...")>>>time.sleep(3)>>>trials+=1>>>else:>>>print(ft_output.result())>>>break...processing......processing...{'areas':[84449433.3236774,568271540.420404],'lengths':[95284.72256002533,324028.2231798081]}

auto_complete

arcgis.geometry.functions.auto_complete(polygons:list[Polygon]|None=None,polylines:list[Polyline]|None=None,spatial_ref:SpatialReference|None=None,gis:GIS|None=None,future:bool=False)

Theauto_complete function simplifies the process of constructing newPolygon objects that are adjacent to otherpolygons. It constructspolygons that fill in the gaps between existingpolygons and a set ofPolyline objects.

Keys

Description

polygons

A List ofPolygon objects

polylines

A List ofPolyline objects

spatial_ref

ASpatialReference of the input geometries or theinteger WKID of the spatial reference.

future

Optional boolean.

  • IfTrue, aGeometryJob that canbe queried will be returned and control returns to the user.

  • IfFalse, aPolygon object will be returnedafter the function completes.

Returns:

Iffuture=False, aPolygon object. Iffuture=True, aGeometryJob object. See code example inareas_and_lengthsfor code snippet querying the job.

buffer

arcgis.geometry.functions.buffer(geometries:list,in_sr:int|dict[str,Any],distances:float|list[float],unit:str|LengthUnits,out_sr:int|dict[str,Any]|None=None,buffer_sr:float|None=None,union_results:bool|None=None,geodesic:bool|None=None,gis:GIS|None=None,future:bool=False)

Thebuffer function createspolygonsaround each inputGeometry in the list at thespecified distance.

Note

The options are available to union buffers and to use geodesic distance.

Keys

Description

geometries

The list ofgeometries to buffer.

in_sr

The well-known ID, or aSpatialReference object forthe input geometries.

distances

The distances that each inputGeometry will bebuffered.

unit

The unit of the bufferdistances.* If not specified, the units are derived frombuffer_sr.* Ifbuffer_sr is also not specified, the units are derived fromin_sr.

out_sr

The well-known ID or theSpatialReference object forthe returnedgeometries.

buffer_sr

The well-known ID or theSpatialReference objectin which thegeometries are buffered.

union_results

Optional boolean.* IfTrue, allgeometries buffered at a given distance are unioned into asingle (possibly multipart)Polygon and the unionedGeometry is placed in the output list. The defaultisFalse.

geodesic

Optional boolean.

  • IfTrue, buffer the inputgeometries using geodesic distance. Geodesic

distance is the shortest path between two points along the ellipsoid of the earth.IfFalse, the 2D Euclidean distance is used

Note

The default value depends on the geometry type,unit andbuffer_srarguments. Seebuffering using GCSandbuffering using PCSfor details.

future

Optional boolean.

  • IfTrue, aGeometryJob will be returned for queryand the process returns control to the user.

  • IfFalse, the process waits until completion before returning the outputpolygons

The default is False.

Note

If setting future toTrue there is a limitation of 6500geometriesthat can be processed in one call.

Returns:

A list ofPolygon objects iffuture=False, or aGeometryJob object iffuture=True.Query the job’sresult() method to get results.

>>>fromarcgis.gisimportGIS>>>fromarcgis.geometryimportPoint,buffer,LengthUnits,AreaUnits>>>gis=GIS(profile="my_entertprise_user")>>>flyr_item=gis.content.get("<item_id>")>>>pts_layer=fl_item.layers[0]>>>geom1=Point(pts_layer.query(where="name='Water Dept'").features[0].geometry)>>>geom2=Point(pts_layer.query(where="name='Water Satellite'").features[0].geometry)>>>buffer_res=buffer(geometries=[geom1,geom2],                 distances=[1000,2000,...],                 in_sr = {"wkid": 3857},                 unit = LengthUnits.FOOT,                 out_sr = 102009,                 buffer_sr = 102009,                 union_results = False,                 geodesic = True,                 future = False)>>>buffer_res[{'rings': [[[-1231272.7177999988, -367594.3729999997], [-1231259.824000001, -367596.90949999914],…            [-1231285.7353999987, -367592.5767999999], [-1231272.7177999988, -367594.3729999997]]],            'spatialReference': {'wkid': 102009, 'latestWkid': 102009}}, {'rings': [[[-1414089.7775999978, -547764.3929000013], [-1414076.887000002, -547767.1926000006],…            [-1414102.8069999963, -547762.3337000012], [-1414089.7775999978, -547764.3929000013]]],            'spatialReference': {'wkid': 102009, 'latestWkid': 102009}}]

convex_hull

arcgis.geometry.functions.convex_hull(geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],spatial_ref:int|dict[str,Any]|None=None,gis:GIS|None=None,future:bool=False)

Theconvex_hull function is performed on aGeometry Serviceresource.It returns the minimum bounding shape that contains the input geometry. Theinput geometry can be aPoint,MultiPoint,Polyline , orPolygon object.

Note

The convex hull is typically a polygon but can also be a polylineor point in degenerate cases.

Keys

Description

geometries

A list ofPoint,MultiPoint,Polyline, orPolygon objects.The structure of each geometry in the array is defined the same as theJSON geometry objectsreturned by the ArcGIS REST API.

Note

Geometry objects can be obtained by querying aFeatureLayer, returning it as a Pandasdata frame, and then assigning variables to a geometry based on the row index.

>>>flyr_item=gis.content.search("*","Feature Layer")[0]>>>flyr_df=flyr_item.query(where="1=1",as_df=True)>>>geom0=flyr_df.loc[0].SHAPE

spatial_ref

An integer value, or aSpatialReference objectdefined using the the Well-Known ID (wkid) of the Spatial Reference.

Note

SeeSpatial Referencein theGeometry objects help, orUsing Spatial Referencesfor details on concepts and resources for finding specificwkid values.

>>>geom_result=convex_hull(geometries=[geometry_object]                              spatial_ref=<wkid>)

or

>>>geom_result=convex_hull(geometries=[geometry_object],                              spatial_ref={"wkid": <wkid>})

or

>>>fromarcgis.geometryimportSpatialReference>>>sr_obj_wkid=SpatialReference(<wkid>)>>>geom_result=convex_hull(geometries=[geometry_object],                              spatial_ref=sr_obj_wkid)

future

Optional boolean.

  • IfTrue, aGeometryJob will be returned for queryand the process returns control to the user.

  • IfFalse, the process waits until completion before returning the outputpolygons

The default is False.

Note

If setting future toTrue there is a limitation of 6500geometriesthat can be processed in one call.

Returns:

A list containing theGeometry object of the result, or iffuture=True,aGeometryJob object. Call the job’sresult() method to inspect the process and results.

# Usage Example:>>>importtime>>>fromarcgis.gisimportGIS>>>fromarcgis.geometryimportconvex_hull>>>gis=GIS(profile="your_organization_profile")>>>flyr_item=gis.content.get("<item_id for feature layer>")>>>flyr=flyr_item.layers[0]>>>df=flyr.query(where="OBJECTID=1",as_df=True)>>>geom1=df.loc[0].SHAPE>>>hull_job=convex_hull(geometries=[geom1],spatial_ref={"wkid":2056},future=True)>>>trials=0>>>whiletrials<5:>>>ifnothull_job.done():>>>print("...processing...")>>>time.sleep(3)>>>trials+=1>>>else:>>>print(hull_job.result())>>>break...processing...{'rings':[[[2664507.7925999984,1212609.7138999999],...,[2664678.264199998,1212618.6860999987],[2664507.7925999984,1212609.7138999999]]],'spatialReference':{'wkid':{'wkid':2056}}}

cut

arcgis.geometry.functions.cut(cutter:Polyline,target:list[Polyline]|list[Polygon],spatial_ref:int|dict[str,Any]|None=None,gis:GIS|None=None,future:bool=False)

The geometry servicecut function splits a targetPolylineorPolygon geometry where it is crossed by the cutterPolyline geometry.

Note

At 10.1 and later, this function calls simplify on the inputcutter and target geometries.

Keys

Description

cutter

ThePolyline that will be used to divide the targetgeometry into pieces where it crosses the target.

target

The list ofPolyline orPolygon objects to be cut.

spatial_ref

ASpatialReference object or well-known ID specifyingthe spatial reference of the input geometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

A List ofGeometry objects iffuture=False, or aGeometryJob iffuture=True.

densify

arcgis.geometry.functions.densify(geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],spatial_ref:int|dict[str,Any]|None,max_segment_length:float|None,length_unit:str|None|LengthUnits,geodesic:bool=False,gis:GIS|None=None,future:bool=False)

Thedensify function adds vertices toGeometry objectsat regular intervals.

Keys

Description

geometries

A list ofPolyline orPolygongeometry objects to densify.

spatial_ref

The well-known ID or aSpatialReference object forthe inputgeometries.

max_segment_len

All segments longer thanmaxSegmentLength arereplaced with sequences of lines no longer thanmax_segment_length.

length_unit

The length unit ofmax_segment_length.

  • Ifgeodesic = False, then the units are derived from thespatial_refargument and thelength_unit argument is ignored

  • Ifgeodesic = True, thenlength_unit must be a linear unit

  • If argument is not provided and thespatial_ref argument is a projectedcoordinate system, this value is derived from thespatial_ref

  • If argument is not provided and thespatial_ref argument is a geographiccoordinate system, the units aremeters

geodesic

Optional boolean.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list ofGeometry objects. Iffuture = True,aGeometryJob object.

difference

arcgis.geometry.functions.difference(geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],spatial_ref:int|dict[str,Any]|None,geometry:Geometry,gis:GIS|None=None,future:bool=False)

Thedifference function constructs the set-theoretic differencebetween each member of a list ofgeometriesand anotherGeometry object. In other words, let B be thedifference geometry. For each geometry, A, in the input geometrylist, it constructs A - B.

Note

The operation callssimplify() on the inputgeometries

Keys

Description

geometries

An array ofPoint,MultiPoint,Polyline, orPolygon objects.

geometry

A singleGeometry object of any type and of adimension equal to or greater than the elements of thegeometries argument.

spatial_ref

ASpatialReference object or the well-known IDspecifying the spatial reference of the inputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list ofGeometry objects. Iffuture = True,aGeometryJob object.

distance

arcgis.geometry.functions.distance(spatial_ref:int|dict[str,Any]|None,geometry1:Geometry,geometry2:Geometry,distance_unit:str|LengthUnits|None='',geodesic:bool=False,gis:GIS|None=None,future:bool=False)

Thedistance function is performed on a geometry service resource.It reports the2D Euclidean orgeodesic distance between the twoGeometry objects.

Keys

Description

geometry1

TheGeometry object from which the distance ismeasured. The structure of each geometry in the array is thesame as the structure of the JSON geometry objects returned bythe ArcGIS REST API.

geometry2

TheGeometry object to which the distance ismeasured. The structure of each geometry in the array is thesame as the structure of the JSON geometry objects returned bythe ArcGIS REST API.

distance_unit

Optional. One ofLengthUnits enumerationmembers. See Geometry Servicedistancefor full details.

geodesic

Ifgeodesic is set to true, then the geodesic distancebetween thegeometry1 andgeometry2 geometries is returned.Geodesic distance is the shortest path between two points alongthe ellipsoid of the earth. Ifgeodesic is set to false or notspecified, the planar distance is returned. The default value is false.

spatial_ref

ASpatialReference of the input geometries Well-KnownID or JSON object

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

Iffuture = False, the distance value between theGeometry objects.Iffuture = True, aGeometryJob object.

find_transformation

arcgis.geometry.functions.find_transformation(in_sr:int|dict[str,Any]|None,out_sr:int|dict[str,Any]|None,extent_of_interest:dict[str,Any]|None=None,num_of_results:int=1,gis:GIS|None=None,future:bool=False)

Thefind_transformations function is performed on aGeometryservice resource. This function returns a list of applicablegeographic transformations you should use when projectinggeometries from the inputSpatialReference to the outputSpatialReference. The transformations are in JSON format and are returnedin order of most applicable to least applicable. Recall that ageographic transformation is not needed when the input and outputspatial references have the same underlying geographic coordinatesystems. In this case, findTransformations returns an empty list.

Note

Every returned geographic transformation is a forwardtransformation meaning that it can be used as-is to project fromthe input spatial reference to the output spatial reference. In thecase where a predefined transformation needs to be applied in thereverse direction, it is returned as a forward compositetransformation containing one transformation and a transformForwardelement with a value of false.

Keys

Description

in_sr

The well-known ID of theSpatialReference or a spatialreference JSON object for the input geometries.

out_sr

The well-known ID of theSpatialReference or aspatial 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 ofinterest is used to return the most applicable geographictransformations for the area.

Note

If aSpatialReference is notincluded in the JSON envelope, thein_sr is used for theenvelope.

num_of_results

The number of geographic transformations toreturn. The default value is 1.

Note

Ifnum_of_results has a value of -1, all applicable transformations are returned.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list of geographic transformations, or iffuture = True, aGeometryJob object.

from_geo_coordinate_string

arcgis.geometry.functions.from_geo_coordinate_string(spatial_ref:int|dict[str,Any]|None,strings:list[str],conversion_type:str|None,conversion_mode:str|None=None,gis:GIS|None=None,future:bool=False)

Thefrom_geo_coordinate_string function is performed on aGeometryservice resource. The function converts an array of well-knownstrings into xy-coordinates based on the conversion type andSpatialReference supplied by the user. An optional conversion modeparameter is available for some conversion types. Seeto_geo_coordinate_stringsfor more information on the opposite conversion.

Keys

Description

spatial_ref

ASpatialReference of the input geometries Well-Known ID or JSON object

strings

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

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

Iffuture = False, a is of (x,y) coordinates and iffuture = True, aGeometryJob object.

>>>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 = False)>>>coords[[-117.378, 34.233], [14.387, 58.092], [179.0432, 98.653]]

generalize

arcgis.geometry.functions.generalize(spatial_ref:int|dict[str,Any]|None,geometries:list[Geometry],max_deviation:int,deviation_unit:str|LengthUnits|None=None,gis:GIS|None=None,future:bool=False)

Thegeneralize simplifies the input geometries using the _Douglas-Peucker_algorithm with a specified maximum deviation distance.

Note

The output geometries will contain a subset ofthe original input vertices.

Keys

Description

geometries

Required. The list ofPolyline orPolygon objects to be generalized.

max_deviation

Sets the maximum allowable offset, which determines the degree of simplification.This value limits the distance the output geometry can differ from the inputgeometry.

deviation_unit

Specifies a unit for themax_deviation argument.

Note

If not specified, the units are derived fromspatial_ref

spatial_ref

ASpatialReference object or the Well-Known IDof the inputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list of the generalizedGeometry objects, oriffuture = True, aGeometryJob object.

intersect

arcgis.geometry.functions.intersect(spatial_ref:int|dict[str,Any]|None,geometries:list[Geometry],geometry:Geometry,gis:GIS|None=None,future:bool=False)

Theintersect function constructs the set-theoretic intersectionbetween a list ofgeometries <arcgis.geometry.Geometry> and anotherGeometry.

Note

The dimension of each resultant geometry is the minimum dimension of the inputgeometries list and the object serving as thegeometry argument.

Keys

Description

geometries

An list ofPoint,MultiPoint,Polyline, orPolygon objects.

geometry

A singleGeometry of any type and of a dimension equalto or greater than the elements ofgeometries.

spatial_ref

ASpatialReference object or the Well-Known ID of theinputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, the set-theoretic dimension betweenGeometry objects, oriffuture = True, aGeometryJob object.

label_points

arcgis.geometry.functions.label_points(spatial_ref:int|dict[str,Any]|None,polygons:list[Polygon],gis:GIS|None=None,future:bool=False)

Thelabel_points function calculates an interiorPointfor eachPolygon specified in the input list. These interiorpoints can be used by clients for labeling the polygons.

Keys

Description

polygons

Required list ofPolygon objects whose labelPoint objects are to be computed.

spatial_ref

ASpatialReference object or the well-known ID ofthe spatial reference of the inputpolygons.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list ofPoint objects, or iffuture = True,aGeometryJob object.

lengths

arcgis.geometry.functions.lengths(spatial_ref:int|dict[str,Any]|None,polylines:Polyline,length_unit:str|LengthUnits,calculation_type:str,gis:GIS|None=None,future:bool=False)

Thelengths function calculates the` 2D Euclidean` orgeodesic lengths ofeachPolyline specified in the input array.

Keys

Description

spatial_ref

ASpatialReference object or the well-known ID ofthe spatial reference of the inputpolygons.

polylines

The list ofPolyline objects to compute.

length_unit

The length unit in which the lengths are calculated.

  • Ifcalculation_type isplanar - value can be anyesriUnits constant

    • Ifcalculation_type isplanar and argument not provided, the unitsare derived fromspatial_ref.

  • IfcalculationType isnot planar, then must be aLengthUnits value, such asLengthUnits.METER orLengthUnits.SURVEYMILE

  • IfcalculationType isnot planar and argument not provided, the value ismeters

calculation_type

The length calculation type used for the operation. Can be one of the following:

  • planar - uses 2D Euclidean distance to calculate length. Only use this

    if the length needs to be calculated in the givenspatial_ref,otherwise usepreserveShape

  • geodesic - uses only the vertices of thepolygon and defines the

    lines between the vertices as geodesic independent of the actual shape ofthePolyline. This segment is the shortest pathbetween two points on an ellipsoid.

  • preserveShape - uses the surface of the earth ellipsoid to calculate

    the length. The shape of the geometry in its coordinate system is preserved.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list of 2D-Euclidean or geodesic lengths infloat format, or iffuture = True, aGeometryJob object.

offset

arcgis.geometry.functions.offset(geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],offset_distance:float,offset_unit:str|LengthUnits,offset_how:str='esriGeometryOffsetRounded',bevel_ratio:int=10,simplify_result:bool=False,spatial_ref:int|dict[str,Any]|None=None,gis:GIS|None=None,future:bool=False)

Theoffset function constructsgeometriesthat are offset from the inputgeometries. If the offset parameter is positive, theconstructed offset will be on the right side of the geometry; if negative on the left.

Note

Tracing the geometry from its first vertex to the last will give you adirection along the geometry. It is to the right and leftperspective of this direction that the positive and negativeparameters will dictate where the offset is constructed. In theseterms, you may infer where the offset of even horizontal geometries willbe constructed.

Keys

Description

geometries

Required list ofPoint,MultiPoint,Polyline, orPolygon objects.

offset_distance

Specifies the distance for constructing an offset geometry.

Note

If theoffset_distance parameter is positive, the constructed offsetwill be on the right side of the input; if negative on the left.

offset_unit

A unit for offset distance. Usearcgis.geometry.functions.LengthUnitsoptions.

offset_how

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

  • esriGeometryOffsetMitered - Attempts to allow extended offsets to naturallyintersect, but if that intersection occurs too far from the corner, the corneris eventually bevelled off at a fixed distance.

bevel_ratio

Value is multiplied by theoffset_distance, and determines how far a miteredoffset intersection can be located before it is bevelled.

  • whenoffset_how = esriGeometryOffsetMitered, argument is ignored and 10 isused internally.

  • whenoffset_how = esriGeometryOffsetBevelled, 1.1 will be used if argumentnot specified

  • whenoffset_how = esriGeometryOffsetRounded, argument is ignored

simplify_result

Option boolean. IfTrue, true, then self intersecting loops will be removed.The default is False.

spatial_ref

ASpatialReference object of the well-known ID of thespatial reference of the of the input geometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list ofGeometry objects, or iffuture = True, aGeometryJob object.

# Usage Example:>>>fromarcgis.geometryimportPolyline,LengthUnits>>>pline=Polyline(iterable={"paths":[[[0,0],[2000,2000],[3000,0]]],:spatialReference:{"wkid":2229}})>>>new_geoms=offset(geometries=[pline],offset_distance=1000,offset_unit=LengthUnits.METER,offset_how="esriGeometryOffsetMitered",spatial_ref={"wkid":2229})

project

arcgis.geometry.functions.project(geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],in_sr:int|dict[str,Any]|None,out_sr:int|dict[str,Any]|None,transformation:str='',transform_forward:bool=False,gis:GIS|None=None,future:bool=False)

Theproject function projects a list of input geometries from the inputSpatialReference to the outputSpatialReference

Keys

Description

geometries

An list ofPoint,MultiPoint,Polyline, orPolygon objects.

in_sr

The well-known ID of the spatial reference or aSpatialReference object specifying the spatialreference of the inputgeometries.

out_sr

The well-known ID of the spatial reference or aSpatialReference object specifying the spatialreference of the outputgeometries.

transformation

The well-known ID or a dictionary specifying thegeographic transformation(also known asdatum transformation) to be applied to the projectedgeometries.

Note

A transformation is needed only if the outputSpatialReference contains a different coordinatesystem from the input spatial reference. For comprehensive list oftransformations, seeTransformation PDFs.

transform_forward

Optional boolean. Indicates whether or not to transform forward.

Note

The forward or reverse direction is implied in the name of the transformation.If transformation is specified, a value for this argument must be provided.The default value isFalse.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, a list ofGeometry objects in theout_srcoordinate system,, or iffuture = True, aGeometryJob object.

#Usage Example>>>result=project(geometries=[{"x":-17568824.55,"y":2428377.35},{"x":-17568456.88,"y":2428431.352}],in_sr=3857,out_sr=4326)[{"x":-157.82343617279275,"y":21.305781607280093},{"x":-157.8201333369876,"y":21.306233559873714}]

relation

arcgis.geometry.functions.relation(geometries1:list[Geometry],geometries2:list[Geometry],spatial_ref:int|dict[str,Any]|None,spatial_relation:str='esriGeometryRelationIntersection',relation_param:str='',gis:GIS|None=None,future:bool=False)

Therelation function determines the pairs of geometries from the inputlist that participate in the specified spatialrelation.

Note

Both lists are assumed to be in the spatial reference specified bythespatial_ref, which is a required argument. Geometry types cannot be mixedwithin a list.

Note

The relations are evaluated in 2D.z coordinates are not used.

Keys

Description

geometries1

The first list ofGeometry objects used to computethe relations.

geometries2

The second list ofGeometry objects used.

spatial_ref

ASpatialReference object or the well-known ID of thespatial reference of thegeometries.

relation_param

Only relevant whenspatial_relation = esriGeometryRelationRelation. The ShapeComparison Language string to be evaluated. Seeherefor more details.

spatial_relation

The spatial relationship to be tested between the two input geometry lists.Options:

  • esriGeometryRelationCross

  • esriGeometryRelationDisjoint

  • esriGeometryRelationIn

  • `esriGeometryRelationInteriorIntersection `

  • esriGeometryRelationIntersection

  • esriGeometryRelationLineCoincidence

  • esriGeometryRelationLineTouch

  • esriGeometryRelationOverlap

  • esriGeometryRelationPointTouch

  • esriGeometryRelationTouch

  • esriGeometryRelationWithin

  • esriGeometryRelationRelation

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

Iffuture = False, a dictionary of geometry index positions of geometries that participatein the specifiedrelation, or iffuture = True, aGeometryJob object.

>>>new_res=relation(geometry1=[{"x":-104.53,"y":34.74},{"x":-63.53,"y":10.23}],                       geometry2 = [{"rings":[[[-105,34],[-104,34],[-104,35],[-105,35],[-105,34]]]}],                       spatial_relation = "esriGeometryRelationWithin",                       spatial_ref = 4326,                       future = False)>>>new_res{'relations': [{"geometry1Index": 0, "geometry2Index": 3},               {"geometry1Index": 1, "geometry2Index": 0}]}

reshape

arcgis.geometry.functions.reshape(spatial_ref:int|dict[str,Any]|None,target:Polyline|Polygon,reshaper:Polyline,gis:GIS|None=None,future:bool=False)

Thereshape function modifies aPolyline orPolygon feature by constructing apolyline over the feature.The feature takes the shape of thisreshaper polyline from the first place itintersects the feature to the last.

Keys

Description

target

ThePolyline orPolygonto reshape.

reshaper

The single-partPolyline object that reshapestarget.

spatial_ref

ASpatialReference object or the well-known ID of thespatial reference of the geometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

f *future = False, A reshapedPolyline orPolygonobject iffuture = True, aGeometryJob object.

simplify

arcgis.geometry.functions.simplify(spatial_ref:int|dict[str,Any]|None,geometries:list[Polygon]|list[Polyline]|list[MultiPoint]|list[Point],gis:GIS|None=None,future:bool=False)

Thesimplify function permanently alters each of the inputgeometries so they become topologically consistent.

Keys

Description

geometries

Required list ofPoint,MultiPoint,Polyline, orPolygon objectsto simplify.

spatial_ref

ASpatialReference object or the well-known ID of thespatial reference of the input and outputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

An array ofGeometry objects iffuture = False, or aGeometryJob object iffuture = True.

to_geo_coordinate_string

arcgis.geometry.functions.to_geo_coordinate_string(spatial_ref:int|dict[str,~typing.Any]|None,coordinates:<module'json'from'/opt/conda/envs/arcgis/lib/python3.11/json/__init__.py'>,conversion_type:str,conversion_mode:str='mgrsDefault',num_of_digits:int|None=None,rounding:bool=True,add_spaces:bool=True,gis:~arcgis.gis.GIS|None=None,future:bool=False)

Theto_geo_coordinate_string function is performed on aGeometryservice resource. The function converts an array ofxy-coordinates into well-known strings based on the conversion typeandSpatialReference supplied by theUser. Optional parameters areavailable for some conversion types. Seefrom_geo_coordinate_strings for moreinformation on the opposite conversion.

Note

If an optional parameter is not applicable for a particular conversion type, but avalue is supplied for that parameter, the value will be ignored.

Keys

Description

spatial_ref

ASpatialReference object or the well-known ID of thespatial reference of the inputcoordinates.

coordinates

An list of xy-coordinates in JSON format to be converted.Syntax:

  • [[10,10],[10,20]…[30,40]]

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 and UTM 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 defaultvalue fornum_of_digits varies depending onconversion_type:

  • MGRS: 5

  • USNG: 8

  • UTM: NA

  • GeoRef: 5

  • GARS: NA

  • DMS: 2

  • DDM: 4

  • DD: 6

rounding

  • IfTrue, then numeric portions of the string are rounded to the nearest whole magnitude asspecified bynum_of_digits

  • Otherwise, numeric portions of the string are truncated.

Note

The rounding parameter applies only to conversion typesMGRS,USNGandGeoRef.

The default value isTrue.

add_spaces

Option boolean.

  • IfTrue, then spaces are added between components of the string.

Note

Only applies toconversion_typesMGRS,USNG andUTM. The defaultvalue forMGRS isFalse, while the default value for bothUSNGandUTM isTrue.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

A list of strings iffuture = False, aGeometryJob object iffuture = True.

>>>strings=to_geo_coordinate_string(spatial_ref=4326,                                       coordinates = [[180,0],[-117,34],[0,52]],                                       conversion_type = "MGRS",                                       conversion_mode = "mgrsNewWith180InZone01",                                       num_of_digits=8,                                       add_spaces=True,                                       future = False)>>>strings    ["01N AA 66021 00000","11S NT 00000 62155", "31U BT 94071 65288"]

trim_extend

arcgis.geometry.functions.trim_extend(spatial_ref:int|dict[str,Any]|None,polylines:list[Polyline],trim_extend_to:Polyline,extend_how:int=0,gis:GIS|None=None,future:bool=False)

Thetrim_extend function trims or extends eachPolyline specifiedin the input list using the user-specified guide polylines.

Note

When trimming features, the part to the left of the oriented cuttingline is preserved in the output, and the other part is discarded.An emptyPolyline is added to the output listif the corresponding input polyline is neither cut nor extended.

Keys

Description

polylines

A list ofPolyline objects to trim or extend

trim_extend_to

APolyline serving as the guide for trimming orextending inputpolylines.

extend_how

A flag that is used along with the trimExtend function.

  • 0 - By default, an extension considers both ends of a path. Theold 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 endpoint to the new position instead of leaving the old point andadding a new point at the new position.

  • 2 - If an extension is performed at an end, do not extrapolatethe end-segment’s attributes for the new point. Instead, make

its attributes the same as the current end. Incompatible withesriNoAttributes.*4 - If an extension is performed at an end, do not extrapolate

the end-segment’s attributes for the new point. Instead, makeits 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

ASpatialReference object or the well-known ID of thespatial reference of the inputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Returns:

A list ofPolyline objects iffuture = False, or aGeometryJob object iffuture = True.

union

arcgis.geometry.functions.union(geometries:list[~arcgis.geometry._types.Polygon]|list[~arcgis.geometry._types.Polyline]|list[~arcgis.geometry._types.MultiPoint]|list[~arcgis.geometry._types.Point],spatial_ref:str|dict[slice(<class'str'>,<class'str'>,None)]|None=None,gis:~arcgis.gis.GIS|None=None,future:bool=False)

Theunion function constructs the set-theoretic union of eachGeometry in thegeometries list.

Note

All inputs must be of the same type.

Keys

Description

geometries

Required list ofPoint,MultiPoint,Polyline,orPolygon objects.

spatial_ref

ASpatialReference object or the well-known ID of thespatial reference of the inputgeometries.

future

Optional boolean.

  • IfTrue, aGeometryJob objectwill be returned and the process returns control to the user.

  • IfFalse, the process waits for the operation to complete before returningresults and passing control back to the user.

Note

Iffuture=True, there is a limitation of 6500 geometries that can beprocessed in one call.

Returns:

Iffuture = False, the set-theoretic union of theGeometry objectsin thegeometries argument, or iffuture = True, aGeometryJobobject.

Your browser is no longer supported. Please upgrade your browser for the best experience. See ourbrowser deprecation post for more details.


[8]ページ先頭

©2009-2025 Movatter.jp