本文簡要介紹 python 語言中 arcgis.geometry.areas_and_lengths
的用法。
用法:
arcgis.geometry.areas_and_lengths(polygons, length_unit, area_unit, calculation_type, spatial_ref=4326, gis=None, future=False)
返回:
JSON 作為字典,或
GeometryJob
對象。如果future = True
,則結果是Future
對象。調用result()
獲取響應。
areas_and_lengths
函數計算輸入數組中指定的每個Polygon
的麵積和周長。Keys
Description
polygons
要計算麵積和長度的
Polygon
數組。length_unit
計算多邊形周長的長度單位。如果
calculation_type
是平麵的,則length_unit
可以是任何 esriUnits 常量(字符串或整數)。如果calculationType
不是平麵的,則length_unit
必須是線性 esriUnits 常數,例如esriSRUnit_Meter`(i.e. `9001`|`LengthUnits.METER
) 或esriSRUnit_SurveyMile`(i.e. `9035`|`LengthUnits.SURVEYMILE
)。如果未指定length_unit
,則單位派生自spatial_ref
。如果未指定spatial_ref
,則單位為米。有關有效單位的列表,請參閱esriSRUnitType Constants
和esriSRUnit2Type Constants
。area_unit
將計算多邊形麵積的麵積單位。如果calculation_type 是平麵的,那麽area_unit 可以是任何
esriAreaUnits
常量(字典或枚舉)。如果calculation_type
不是平麵的,則area_unit
必須是esriAreaUnits
常量,例如AreaUnits.SQUAREMETERS
(即{“areaUnit”: “esriSquareMeters”}
)或AreaUnits.SQUAREMILES
(即{“areaUnit”: “esriSquareMiles”}
)。如果未指定area_unit
,則單位派生自spatial_ref
。如果未指定spatial_ref
,則單位為平方米。有關有效單位的列表,請參閱esriAreaUnits Constants
。有效的 esriAreaUnits 常量列表包括esriSquareInches | esriSquareFeet | esriSquareYards | esriAcres | esriSquareMiles | esriSquareMillimeters | esriSquareCentimeters | esriSquareDecimeters | esriSquareMeters | esriAres | esriHectares | esriSquareKilometers.
calculation_type
為輸入幾何的麵積和長度計算定義的類型。類型可以是以下值之一:
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
可選布爾值。如果為 True,則將返回 future 對象,並且進程不會等待任務完成。默認為False,表示等待結果。
>>> # Use case 1 >>> areas_and_lengths(polygons =[polygon1, polygon2,...], length_unit = 9001, area_unit = {"areaUnit": "esriSquareMeters"}, calculation_type = "planar") >>> # Use case 2 >>> from arcgis.geometry import LengthUnits, AreaUnits >>> areas_and_lengths(polygons =[polygon1, polygon2,...], length_unit = LengthUnits.METER, area_unit = AreaUnits.SQUAREMETERS, calculation_type = "planar", future = True)
相關用法
- Python ArcGIS arithmetic用法及代碼示例
- Python ArcGIS acos用法及代碼示例
- Python ArcGIS add_image用法及代碼示例
- Python ArcGIS abs用法及代碼示例
- Python ArcGIS acosh用法及代碼示例
- Python ArcGIS aspect_slope用法及代碼示例
- Python ArcGIS analyze_changes_using_ccdc用法及代碼示例
- Python ArcGIS asinh用法及代碼示例
- Python ArcGIS aggregate_points用法及代碼示例
- Python ArcGIS asin用法及代碼示例
- Python ArcGIS atan2用法及代碼示例
- Python ArcGIS atanh用法及代碼示例
- Python ArcGIS aggregate_multidimensional_raster用法及代碼示例
- Python ArcGIS aspect用法及代碼示例
- Python ArcGIS atan用法及代碼示例
- Python ArcGIS aggregate用法及代碼示例
- Python ArcGIS analyze_changes_using_landtrendr用法及代碼示例
- Python ArcGIS power用法及代碼示例
- Python ArcGIS APIKeyManager.get用法及代碼示例
- Python ArcGIS KnowledgeGraph.named_object_type_delete用法及代碼示例
- Python ArcGIS ContentManager.unshare_items用法及代碼示例
- Python ArcGIS ImageryLayer.thumbnail用法及代碼示例
- Python ArcGIS FormFieldElement用法及代碼示例
- Python ArcGIS Geometry.true_centroid用法及代碼示例
- Python ArcGIS Site.delete用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.geometry.areas_and_lengths。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。