Hey,
I am new to ArcGIS, I am using this layer:
https://atlas.marine.ie/arcgis/rest/services/05_Aquaculture_Sites/MapServer/0/query?
It returns
Shape_Area as Shape_Area: 3.3790882371196156E-5 value like this.
I want to know in what UNIT it returns this value, As I want area in HECTARE.
Any help would be highly appreciated.
square degrees
If you want planar units then you will have to specify a projected coordinate system (not Web Mercator) suitable for your area
You can wrap any map service end-point as a Layer, then the Describe properties Spatial Reference object will expose projection parameters such as units, which can help you convert stuff yourself. If you use a cursor and the Polygon.getArea method you can easily convert the Area to units of your choice as you read the data, just sub in "HECTARES" for the units on the getArea() call in the code below. On one machine I did get a "000229-cannot-open-value" error when wrapping the layer, but on a different environment the code worked fine ...
import arcpy
lyr = arcpy.management.MakeFeatureLayer("https://atlas.marine.ie/arcgis/rest/services/05_Aquaculture_Sites/MapServer/0", "Aquaculture_Sites")
descr = arcpy.Describe(lyr)
print(f'factoryCode: {descr.spatialReference.factoryCode}') # aka WKID
print(f'falseOriginAndUnits: {descr.spatialReference.falseOriginAndUnits}')
print(f'name: {descr.spatialReference.name}')
print(f'linearUnitName: {descr.spatialReference.linearUnitName}')
print(f'linearUnitCode: {descr.spatialReference.linearUnitCode}')
#print(f'metersPerUnit: {descr.spatialReference.metersPerUnit}') # not there on this CRS
print(f'radiansPerUnit: {descr.spatialReference.radiansPerUnit}')
print(f'angularUnitCode: {descr.spatialReference.angularUnitCode}')
print(f'angularUnitName: {descr.spatialReference.angularUnitName}')
row_ct = 0
with arcpy.da.SearchCursor(lyr, ["OID@", "SHAPE@", "SHAPE@AREA"]) as cur :
for row in cur :
try :
# the method parameter for getArea is GEODESIC by default, for Geographic CRS accuracy decreases further from the equator.
# Use the Project geoprocessing tool to convert to a projected CRS to use the PLANAR method
aream = row[1].getArea(method="GEODESIC", units="SQUAREMETERS") # assuming polygon, not null
print(f"ObjectID {row[0]}, {row[2]} Original Units, {aream} Meters Sq")
if (row_ct > 5) : break # bail after a few, this is an example
finally :
row_ct += 1