<?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: Help with first notebook in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/help-with-first-notebook/m-p/1610253#M64569</link>
    <description>&lt;P&gt;Few things to get you rolling:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When you get an item from the content manager, it's an Item, not a FeatureLayerCollection, so you can't access the "layers" property right away.&amp;nbsp; You can use the FeatureLayerCollection.fromitem() class method to get a layer collection from an item, however.&amp;nbsp; Alternatively, use the FeatureLayerCollection(url) or FeatureLayer(url) constructors - they take the URLs to the service or layer (respectively), rather than an Item ID.&lt;/LI&gt;&lt;LI&gt;Features don't have an area property.&amp;nbsp; You can get area a few different ways (from the geometry if you have ArcPy access, from the shape-area field, from geoaccessors, from "areas_and_lengths", etc.), but depending how you do it, you'll want to make sure that your coordinate system is appropriate.&amp;nbsp; For example, if you use the shape-area field and you're using Web Mercator, the area likely won't be accurate.&lt;/LI&gt;&lt;LI&gt;When you assign a value to the acres field, you need to push it back to the service.&amp;nbsp; Setting it on the feature as you're doing will set the value in memory, but won't edit the service.&amp;nbsp; You'll want to look into the FeatureLayer.edit_features() method, this pushes a feature set to the service, saving the changes you've made.&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Wed, 30 Apr 2025 04:27:03 GMT</pubDate>
    <dc:creator>MobiusSnake</dc:creator>
    <dc:date>2025-04-30T04:27:03Z</dc:date>
    <item>
      <title>Help with first notebook</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-first-notebook/m-p/1610059#M64561</link>
      <description>&lt;P&gt;Hi, I am a Notebook newbie. I have a simple task. I need to schedule a task to calculate acres for a polygon feature layer in ArcGIS Online. I just need to access the area of the geometry, convert to acres, and set the Acres field. Below is what I have so far in my first-ever notebook. I'm not sure I'm even taking the right approach. I am currently stuck on how to get at the area of the feature shape... Any guidance is appreciated.&lt;/P&gt;&lt;P&gt;from arcgis import GIS&lt;BR /&gt;from arcgis.geometry import lengths, areas_and_lengths, project&lt;BR /&gt;from arcgis.geometry import Point, Polyline, Polygon, Geometry&lt;BR /&gt;from IPython.display import display&lt;BR /&gt;import pandas as pd&lt;BR /&gt;from arcgis.features import GeoAccessor, GeoSeriesAccessor&lt;/P&gt;&lt;P&gt;## connect to AGOL&lt;BR /&gt;agol = GIS("home")&lt;/P&gt;&lt;P&gt;## access the feature service item&lt;BR /&gt;item = agol.content.get("xyz")&lt;/P&gt;&lt;P&gt;## get the layer of interest as a FeatureLayer&lt;BR /&gt;## the example here is the first layer in the Feature Service&lt;BR /&gt;lyr = item.layers[0]&lt;BR /&gt;fset = lyr.query()&lt;BR /&gt;features = fset.features&lt;/P&gt;&lt;P&gt;for f in features:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print(f.area)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f.attributes['Acres'] = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 16:30:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-first-notebook/m-p/1610059#M64561</guid>
      <dc:creator>Mike_Koutnik</dc:creator>
      <dc:date>2025-04-29T16:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with first notebook</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-first-notebook/m-p/1610253#M64569</link>
      <description>&lt;P&gt;Few things to get you rolling:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When you get an item from the content manager, it's an Item, not a FeatureLayerCollection, so you can't access the "layers" property right away.&amp;nbsp; You can use the FeatureLayerCollection.fromitem() class method to get a layer collection from an item, however.&amp;nbsp; Alternatively, use the FeatureLayerCollection(url) or FeatureLayer(url) constructors - they take the URLs to the service or layer (respectively), rather than an Item ID.&lt;/LI&gt;&lt;LI&gt;Features don't have an area property.&amp;nbsp; You can get area a few different ways (from the geometry if you have ArcPy access, from the shape-area field, from geoaccessors, from "areas_and_lengths", etc.), but depending how you do it, you'll want to make sure that your coordinate system is appropriate.&amp;nbsp; For example, if you use the shape-area field and you're using Web Mercator, the area likely won't be accurate.&lt;/LI&gt;&lt;LI&gt;When you assign a value to the acres field, you need to push it back to the service.&amp;nbsp; Setting it on the feature as you're doing will set the value in memory, but won't edit the service.&amp;nbsp; You'll want to look into the FeatureLayer.edit_features() method, this pushes a feature set to the service, saving the changes you've made.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 30 Apr 2025 04:27:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-first-notebook/m-p/1610253#M64569</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2025-04-30T04:27:03Z</dc:date>
    </item>
  </channel>
</rss>

