<?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: return geodesic area from spatial dataframe area property in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169570#M7353</link>
    <description>&lt;P&gt;That worked like a champ.&amp;nbsp; I hadn't dug into the geometry module much before now.&amp;nbsp; It is good to learn about the area_and_length functionality.&lt;/P&gt;</description>
    <pubDate>Sat, 30 Apr 2022 15:21:42 GMT</pubDate>
    <dc:creator>DavidAnderson_1701</dc:creator>
    <dc:date>2022-04-30T15:21:42Z</dc:date>
    <item>
      <title>return geodesic area from spatial dataframe area property</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169322#M7350</link>
      <description>&lt;P&gt;Now that the calculate geomemtry tool in Pro gives the option to calculate either planar area or geodesic area, I was wondering if spatial data frames would have that option.&lt;/P&gt;&lt;P&gt;Currently data_frame.spatial.area returns planar area.&amp;nbsp; The documentation (&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#geoaccessor" target="_blank" rel="noopener"&gt;arcgis.features module — arcgis 2.0.0 documentation&lt;/A&gt;) does not show a option to flip between planar and geodesic.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 14:29:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169322#M7350</guid>
      <dc:creator>DavidAnderson_1701</dc:creator>
      <dc:date>2022-04-29T14:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: return geodesic area from spatial dataframe area property</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169346#M7351</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/483343"&gt;@DavidAnderson_1701&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Have you thought about using the areas_and_lengths function of the geometry.functions class? It isnt as easy as accessing the area property by doesnt add too much additional overhead!&lt;/P&gt;&lt;P&gt;I have put together an example below:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.geometry.functions import areas_and_lengths
from arcgis.features import GeoAccessor
from arcgis.geometry import LengthUnits, AreaUnits

# Sign in
gis = GIS("home")
print(f"Signed in to {gis.url} as {gis.users.me.username}.\n\nCreating SEDF:")


# Get Polygon layer and query to return SEDF
polygon_flc = gis.content.get("&amp;lt;item_id&amp;gt;")
print(f"Obtained item: {polygon_flc.title}")

# Get layer
polygon_fl = polygon_flc.layers[0]
print(f"Obtained layer: {polygon_fl.properties.name}")

# Query and return SEDF
polygon_sdf = GeoAccessor.from_layer(polygon_fl)
print(f"SEDF has {polygon_sdf.shape[0]} rows")

# Get the area of the entire dataframe (planar)
area_property_planar = polygon_sdf.spatial.area
print(f"Area property (planar) is: {area_property_planar}")

# Get the area of the entire dataframe (planar)
areas_lengths_planar = areas_and_lengths(
    polygons=list(polygon_sdf["SHAPE"]), 
    length_unit = LengthUnits.METER, 
    area_unit = AreaUnits.SQUAREMETERS, 
    calculation_type = "planar")
print(f"Areas and lengths (planar) is: {sum(areas_lengths_planar['areas'])}")

# Get the area of the entire dataframe (geodesic)
areas_lengths_geodesic = areas_and_lengths(
    polygons=list(polygon_sdf["SHAPE"]), 
    length_unit = LengthUnits.METER, 
    area_unit = AreaUnits.SQUAREMETERS, 
    calculation_type = "geodesic")
print(f"Areas and lengths (geodesic) is: {sum(areas_lengths_geodesic['areas'])}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 15:22:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169346#M7351</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2022-04-29T15:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: return geodesic area from spatial dataframe area property</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169570#M7353</link>
      <description>&lt;P&gt;That worked like a champ.&amp;nbsp; I hadn't dug into the geometry module much before now.&amp;nbsp; It is good to learn about the area_and_length functionality.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 15:21:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/return-geodesic-area-from-spatial-dataframe-area/m-p/1169570#M7353</guid>
      <dc:creator>DavidAnderson_1701</dc:creator>
      <dc:date>2022-04-30T15:21:42Z</dc:date>
    </item>
  </channel>
</rss>

