<?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 ManageMapServerCacheTiles ERROR 001431: Invalid geometry found after projecting to service's spatial reference in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560751#M73210</link>
    <description>&lt;P&gt;I have a script that recreates the map server cache tiles that uses a shape file for the area of interest.&amp;nbsp; I am getting this error, even though both shape file and map service are in the same spatial reference:&lt;/P&gt;&lt;P&gt;ERROR 001431: Invalid geometry found after projecting to service's spatial reference&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here's the script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.SignInToPortal(portal_url, "user name", "password")
mapserviceURL = r"url to map service/MapServer"
scales = [120000, 60000, 30000, 15000, 7500, 3750, 1875, 938, 469, 235]
numOfCachingServiceInstances = 3
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = "path to my shapefile.shp"
waitForJobCompletion = "WAIT"
updateExtents = ""
result = arcpy.ManageMapServerCacheTiles_server(mapserviceURL, scales, updateMode, numOfCachingServiceInstances, areaOfInterest, updateExtents, waitForJobCompletion)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The script runs and cache tiles are recreated if I use coordinates for the updateExtents.&amp;nbsp; Any ideas why this will not work with a shapefile area of interest?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2024 15:04:41 GMT</pubDate>
    <dc:creator>Jamie_Leitch_CNF</dc:creator>
    <dc:date>2024-11-20T15:04:41Z</dc:date>
    <item>
      <title>ManageMapServerCacheTiles ERROR 001431: Invalid geometry found after projecting to service's spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560751#M73210</link>
      <description>&lt;P&gt;I have a script that recreates the map server cache tiles that uses a shape file for the area of interest.&amp;nbsp; I am getting this error, even though both shape file and map service are in the same spatial reference:&lt;/P&gt;&lt;P&gt;ERROR 001431: Invalid geometry found after projecting to service's spatial reference&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here's the script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.SignInToPortal(portal_url, "user name", "password")
mapserviceURL = r"url to map service/MapServer"
scales = [120000, 60000, 30000, 15000, 7500, 3750, 1875, 938, 469, 235]
numOfCachingServiceInstances = 3
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = "path to my shapefile.shp"
waitForJobCompletion = "WAIT"
updateExtents = ""
result = arcpy.ManageMapServerCacheTiles_server(mapserviceURL, scales, updateMode, numOfCachingServiceInstances, areaOfInterest, updateExtents, waitForJobCompletion)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The script runs and cache tiles are recreated if I use coordinates for the updateExtents.&amp;nbsp; Any ideas why this will not work with a shapefile area of interest?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:04:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560751#M73210</guid>
      <dc:creator>Jamie_Leitch_CNF</dc:creator>
      <dc:date>2024-11-20T15:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: ManageMapServerCacheTiles ERROR 001431: Invalid geometry found after projecting to service's spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560760#M73211</link>
      <description>&lt;P&gt;error indicates that the shapefile contains invalid geometries that cannot be accurately projected into the spatial reference of the map service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Verify the map service spatial reference.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;service_spatial_ref = arcpy.SpatialReference("url to map service/MapServer")
print(service_spatial_ref.name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Project the service to ensure there are no discrepancies.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;map_service_spatial_ref = arcpy.SpatialReference(102100)  # Example: Web Mercator (Auxiliary Sphere)
arcpy.Project_management(
    "path to my shapefile.shp",
    "path to reprojected_shapefile.shp",
    map_service_spatial_ref
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;repair the shapefile.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.RepairGeometry_management("path to reprojected_shapefile.shp")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:22:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560760#M73211</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-11-20T15:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: ManageMapServerCacheTiles ERROR 001431: Invalid geometry found after projecting to service's spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560765#M73212</link>
      <description>&lt;P&gt;I recreated the shapefile (not a copy) with new geometry and same spatialRef as the cache service&amp;nbsp; still get same error, which seems odd.&amp;nbsp; I'll try your script and report back.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/managemapservercachetiles-error-001431-invalid/m-p/1560765#M73212</guid>
      <dc:creator>Jamie_Leitch_CNF</dc:creator>
      <dc:date>2024-11-20T15:29:34Z</dc:date>
    </item>
  </channel>
</rss>

