<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Need to know in what units I am getting Shape_Area here? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1388629#M6959</link>
    <description>&lt;P&gt;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 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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 &amp;gt; 5) : break # bail after a few, this is an example
        finally :
            row_ct += 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RHmapping_0-1709205316598.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96269iCDB60C008F4AB431/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RHmapping_0-1709205316598.png" alt="RHmapping_0-1709205316598.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 09:11:20 GMT</pubDate>
    <dc:creator>RHmapping</dc:creator>
    <dc:date>2024-03-07T09:11:20Z</dc:date>
    <item>
      <title>Need to know in what units I am getting Shape_Area here?</title>
      <link>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1385199#M6948</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I am new to ArcGIS, I am using this layer:&lt;BR /&gt;&lt;A href="https://atlas.marine.ie/arcgis/rest/services/05_Aquaculture_Sites/MapServer/0/query?" target="_blank"&gt;https://atlas.marine.ie/arcgis/rest/services/05_Aquaculture_Sites/MapServer/0/query?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It returns&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shape_Area as&amp;nbsp;&lt;I&gt;Shape_Area:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt;3.3790882371196156E-5 value like this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to know in what UNIT it returns this value, As I want area in HECTARE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be highly appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:01:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1385199#M6948</guid>
      <dc:creator>YasirKhan2608</dc:creator>
      <dc:date>2024-02-22T00:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need to know in what units I am getting Shape_Area here?</title>
      <link>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1385262#M6949</link>
      <description>&lt;P&gt;square degrees&lt;/P&gt;&lt;P&gt;If you want planar units then you will have to specify a projected coordinate system (not Web Mercator) suitable for your area&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 04:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1385262#M6949</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-02-22T04:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need to know in what units I am getting Shape_Area here?</title>
      <link>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1388629#M6959</link>
      <description>&lt;P&gt;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 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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 &amp;gt; 5) : break # bail after a few, this is an example
        finally :
            row_ct += 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RHmapping_0-1709205316598.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96269iCDB60C008F4AB431/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RHmapping_0-1709205316598.png" alt="RHmapping_0-1709205316598.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 09:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/need-to-know-in-what-units-i-am-getting-shape-area/m-p/1388629#M6959</guid>
      <dc:creator>RHmapping</dc:creator>
      <dc:date>2024-03-07T09:11:20Z</dc:date>
    </item>
  </channel>
</rss>

