<?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 Receiving error &amp;quot;The coordinates or measures are out of bounds&amp;quot; when doing spatial.to_featureclass() in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1690553#M11878</link>
    <description>&lt;P&gt;Hello all, I am trying to run a script that will extract the deleted features from a hosted feature layer on ArcGIS Online and ultimately publish them into a new feature class OR feature layer. However any time I run the spatial.to_featureclass() or spatial.to_featurelayer(), I receive the same error stating, "&lt;STRONG&gt;Could not insert the row because of error message: The coordinates or measures are out of bounds.. Recheck your data."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;As far as I'm aware there are no additional data transformations that occur on the layer and I am not running any custom or other projections on ArcGIS Online. I am mostly working in VS Code. When I run the same script in Notebooks (with appropriate modifications to work in AGOL Notebooks), I just receive the error "Error 1: Cannot Encode Value". I am running the newest version of the API for Python and newest version of Runtime in Notebooks.&lt;/P&gt;&lt;P&gt;Below is my script and screenshots of the errors I am seeing. Anyone run into this before?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from datetime import datetime, timedelta, timezone
import pandas as pd
from arcgis.features import FeatureLayerCollection  # new import
from arcgis.features import FeatureSet
print("Starting")

gis = GIS("https://napsg.maps.arcgis.com", username="USERNAME", password="PASSWORD")  # skip SSL verification for this demo

item_id = "ITEM_ID"  # replace with your item ID
flc_item = gis.content.get(item_id)    # FeatureLayerCollection item
flc  = FeatureLayerCollection.fromitem(flc_item)
# flc = flc_item                               # alias – we use it a lot below

utc_now = datetime.now(timezone.utc)
start_time_ms = int((utc_now - timedelta(hours=24)).timestamp() * 1000)
print(utc_now)

changes = flc.extract_changes(
    layers=0,                 # layer IDs to examine
    servergen=18985651,                 # start at generation 0 (all edits)    # &amp;lt;- add this so no syncLayers object is required
    return_inserts=False,
    return_updates=False,
    return_deletes=True,
    # # queries = {"0"{"where": "EditDate &amp;gt;= start_time_m"}
    queries={"0":{"where": f"EditDate &amp;lt;= '{utc_now}'"}
              },
    data_format="json"
)
changes

dels = changes["edits"][0]["features"]["deletes"] # gives list of features

print("Doing something")
for i, edit in enumerate(changes.get("edits")):
    layer_id = edit.get("id")
    # print(layer_id)
    features = changes.get("edits")[i].get("features")
    for op in ["adds", "updates", "deletes"]:
        # print(features[op])
        if op in features:
            feature_dict = {
                "features": [
                    {"attributes": feat["attributes"], "geometry": feat["geometry"]}
                    for feat in features[op]
                ]
            }
            feature_set = FeatureSet.from_dict(feature_dict)
# print(feature_set)

feature_set.sdf 

print("sending to csv")
output_csv_path = r"C:\Users\admin\Desktop\output_data.csv"
feature_set.sdf.spatial.to_table(location=output_csv_path)


print("sending to feature class")
output_fgdb_path = r"C:\Users\admin\Downloads\USAR_Pro_Template\incident_data\incident_data.gdb"
output_feature_class_name = "NewTestClass"
output_path = f"{output_fgdb_path}\\{output_feature_class_name}"
feature_set.sdf.spatial.to_featureclass(location=output_path)

# print("Publishing to feature layer")
# feature_set.sdf.spatial.to_featurelayer()
print("Done")&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Error in VS Code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-13 101741.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/149835i2832A6B154FC7712/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-13 101741.png" alt="Screenshot 2026-03-13 101741.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Error in Notebooks&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-13 101852.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/149836iDE8C0BA66A37EAB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-13 101852.png" alt="Screenshot 2026-03-13 101852.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Mar 2026 17:35:20 GMT</pubDate>
    <dc:creator>AFackler_NAPSG</dc:creator>
    <dc:date>2026-03-13T17:35:20Z</dc:date>
    <item>
      <title>Receiving error "The coordinates or measures are out of bounds" when doing spatial.to_featureclass()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1690553#M11878</link>
      <description>&lt;P&gt;Hello all, I am trying to run a script that will extract the deleted features from a hosted feature layer on ArcGIS Online and ultimately publish them into a new feature class OR feature layer. However any time I run the spatial.to_featureclass() or spatial.to_featurelayer(), I receive the same error stating, "&lt;STRONG&gt;Could not insert the row because of error message: The coordinates or measures are out of bounds.. Recheck your data."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;As far as I'm aware there are no additional data transformations that occur on the layer and I am not running any custom or other projections on ArcGIS Online. I am mostly working in VS Code. When I run the same script in Notebooks (with appropriate modifications to work in AGOL Notebooks), I just receive the error "Error 1: Cannot Encode Value". I am running the newest version of the API for Python and newest version of Runtime in Notebooks.&lt;/P&gt;&lt;P&gt;Below is my script and screenshots of the errors I am seeing. Anyone run into this before?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from datetime import datetime, timedelta, timezone
import pandas as pd
from arcgis.features import FeatureLayerCollection  # new import
from arcgis.features import FeatureSet
print("Starting")

gis = GIS("https://napsg.maps.arcgis.com", username="USERNAME", password="PASSWORD")  # skip SSL verification for this demo

item_id = "ITEM_ID"  # replace with your item ID
flc_item = gis.content.get(item_id)    # FeatureLayerCollection item
flc  = FeatureLayerCollection.fromitem(flc_item)
# flc = flc_item                               # alias – we use it a lot below

utc_now = datetime.now(timezone.utc)
start_time_ms = int((utc_now - timedelta(hours=24)).timestamp() * 1000)
print(utc_now)

changes = flc.extract_changes(
    layers=0,                 # layer IDs to examine
    servergen=18985651,                 # start at generation 0 (all edits)    # &amp;lt;- add this so no syncLayers object is required
    return_inserts=False,
    return_updates=False,
    return_deletes=True,
    # # queries = {"0"{"where": "EditDate &amp;gt;= start_time_m"}
    queries={"0":{"where": f"EditDate &amp;lt;= '{utc_now}'"}
              },
    data_format="json"
)
changes

dels = changes["edits"][0]["features"]["deletes"] # gives list of features

print("Doing something")
for i, edit in enumerate(changes.get("edits")):
    layer_id = edit.get("id")
    # print(layer_id)
    features = changes.get("edits")[i].get("features")
    for op in ["adds", "updates", "deletes"]:
        # print(features[op])
        if op in features:
            feature_dict = {
                "features": [
                    {"attributes": feat["attributes"], "geometry": feat["geometry"]}
                    for feat in features[op]
                ]
            }
            feature_set = FeatureSet.from_dict(feature_dict)
# print(feature_set)

feature_set.sdf 

print("sending to csv")
output_csv_path = r"C:\Users\admin\Desktop\output_data.csv"
feature_set.sdf.spatial.to_table(location=output_csv_path)


print("sending to feature class")
output_fgdb_path = r"C:\Users\admin\Downloads\USAR_Pro_Template\incident_data\incident_data.gdb"
output_feature_class_name = "NewTestClass"
output_path = f"{output_fgdb_path}\\{output_feature_class_name}"
feature_set.sdf.spatial.to_featureclass(location=output_path)

# print("Publishing to feature layer")
# feature_set.sdf.spatial.to_featurelayer()
print("Done")&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Error in VS Code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-13 101741.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/149835i2832A6B154FC7712/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-13 101741.png" alt="Screenshot 2026-03-13 101741.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Error in Notebooks&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-13 101852.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/149836iDE8C0BA66A37EAB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-13 101852.png" alt="Screenshot 2026-03-13 101852.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 17:35:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1690553#M11878</guid>
      <dc:creator>AFackler_NAPSG</dc:creator>
      <dc:date>2026-03-13T17:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "The coordinates or measures are out of bounds" when doing spatial.to_featureclass()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1690672#M11879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/131210"&gt;@AFackler_NAPSG&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I haven't had a chance to test a similar workflow, but perhaps a different option for creating the feature class might work. The FeatureSet has a &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.FeatureSet.save" target="_blank" rel="noopener"&gt;save()&lt;/A&gt; method you could try.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    feature_set.save(
        save_location=output_fgdb_path,
        out_name=output_feature_class_name
    )&lt;/LI-CODE&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Sun, 15 Mar 2026 09:00:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1690672#M11879</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2026-03-15T09:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "The coordinates or measures are out of bounds" when doing spatial.to_featureclass()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692048#M11891</link>
      <description>&lt;P&gt;Hi Glen,&lt;/P&gt;&lt;P&gt;Looks like that created a File Geodatabase Table that is still completely empty&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-23 142045.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/150150iEC32D0CA770F7E5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-23 142045.png" alt="Screenshot 2026-03-23 142045.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-23 141931.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/150149iEB12EF151AFB0C15/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-23 141931.png" alt="Screenshot 2026-03-23 141931.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2026 19:21:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692048#M11891</guid>
      <dc:creator>AFackler_NAPSG</dc:creator>
      <dc:date>2026-03-23T19:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "The coordinates or measures are out of bounds" when doing spatial.to_featureclass()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692071#M11892</link>
      <description>&lt;P&gt;In my test case, the trick is to set the spatial reference of the FeatureSet before running to_featureclass.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;feature_set = FeatureSet.from_dict({"features": edits[op]})
feature_set.spatial_reference = {"wkid": 3857}

sdf = feature_set.sdf
fc = sdf.spatial.to_featureclass("path/to/gdb")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 23 Mar 2026 21:22:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692071#M11892</guid>
      <dc:creator>KenGalliher1</dc:creator>
      <dc:date>2026-03-23T21:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error "The coordinates or measures are out of bounds" when doing spatial.to_featureclass()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692268#M11893</link>
      <description>&lt;P&gt;Thanks Ken, putting "feature_set.spatial_reference = {"wkid": 3857}" into line 49 of my script above did the trick and I am not seeing that error any more, and I am able to send to feature class and send to feature layer as expected!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for i, edit in enumerate(changes.get("edits")):
    layer_id = edit.get("id")
    print(layer_id)
    features = changes.get("edits")[i].get("features")
    for op in ["adds", "updates", "deletes"]:
        # print(features[op])
        if op in features:
            feature_dict = {
                "features": [
                    {"attributes": feat["attributes"], "geometry": feat["geometry"]}
                    for feat in features[op]
                ]
            }
            feature_set = FeatureSet.from_dict(feature_dict)
            feature_set.spatial_reference = {"wkid": 3857}
feature_set&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 24 Mar 2026 16:05:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/receiving-error-quot-the-coordinates-or-measures/m-p/1692268#M11893</guid>
      <dc:creator>AFackler_NAPSG</dc:creator>
      <dc:date>2026-03-24T16:05:35Z</dc:date>
    </item>
  </channel>
</rss>

