<?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: Update extent of layers in feature layer with python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1503598#M10326</link>
    <description>&lt;P&gt;Any updates on this issue because I have the same problem&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2024 14:54:40 GMT</pubDate>
    <dc:creator>GeoMartino</dc:creator>
    <dc:date>2024-07-10T14:54:40Z</dc:date>
    <item>
      <title>Update extent of layers in feature layer with python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1396927#M9768</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to update the extent of each layers in a feature layer after overwritting the data with new features (located elsewhere), but my script doesn't seem to have any effect. As anyone managed to update the extent of all layers using python?&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;/P&gt;&lt;P&gt;# Connect to ArcGIS Online (replace 'username' and 'password' with your credentials)&lt;BR /&gt;gis = GIS("&lt;A href="https://www.arcgis.com" target="_blank" rel="noopener"&gt;https://www.arcgis.com&lt;/A&gt;", "username", "password")&lt;/P&gt;&lt;P&gt;# Access the feature layer by item ID&lt;BR /&gt;item_id = 'item_id'&lt;BR /&gt;item = gis.content.get(item_id)&lt;/P&gt;&lt;P&gt;# Access the feature layer collection&lt;BR /&gt;feature_layer_collection = FeatureLayerCollection.fromitem(item)&lt;/P&gt;&lt;P&gt;# Get the layers within the feature layer collection&lt;BR /&gt;layers = feature_layer_collection.layers&lt;/P&gt;&lt;P&gt;# Iterate through each layer&lt;BR /&gt;for layer in layers:&lt;BR /&gt;# Update the extent of the layer (replace the values with the desired extent)&lt;BR /&gt;layer.manager.update_definition({&lt;BR /&gt;'extent': {&lt;BR /&gt;"xmin": new_min_x,&lt;BR /&gt;"ymin": new_min_y,&lt;BR /&gt;"xmax": new_max_x,&lt;BR /&gt;"ymax": new_max_y,&lt;BR /&gt;"spatialReference": {&lt;BR /&gt;"wkid": new_wkid&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;# Print the properties of the updated layer&lt;BR /&gt;print("Properties of Layer '{}' after updating extent:".format(layer.properties.name))&lt;BR /&gt;print(layer.properties)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 11:36:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1396927#M9768</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2024-03-16T11:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Update extent of layers in feature layer with python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1397956#M9783</link>
      <description>&lt;P&gt;Hey IB3,&lt;/P&gt;&lt;P&gt;I found the following &lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/update-feature-layer-extent/td-p/871087" target="_self"&gt;community post&lt;/A&gt; which seems to resolve this.&lt;/P&gt;&lt;P&gt;Please let me know if you have any further issues on this.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 16:43:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1397956#M9783</guid>
      <dc:creator>David_McRitchie</dc:creator>
      <dc:date>2024-03-19T16:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update extent of layers in feature layer with python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1397987#M9786</link>
      <description>&lt;P&gt;Yes. I had already seen it, but it does not change the extent of every layers, just the extent of the feature layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In map viewer, when I click zoom to&amp;nbsp; on the feature layer (the feature layer that contains all the layers) it works. But when I click on each individual layer, it is not applied.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 17:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1397987#M9786</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2024-03-19T17:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Update extent of layers in feature layer with python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1503598#M10326</link>
      <description>&lt;P&gt;Any updates on this issue because I have the same problem&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 14:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1503598#M10326</guid>
      <dc:creator>GeoMartino</dc:creator>
      <dc:date>2024-07-10T14:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update extent of layers in feature layer with python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1526329#M10463</link>
      <description>&lt;P&gt;Not yet!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 08:32:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-extent-of-layers-in-feature-layer-with/m-p/1526329#M10463</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2024-08-23T08:32:04Z</dc:date>
    </item>
  </channel>
</rss>

