AnsweredAssumed Answered

Run script with ArcGIS Pro (arcpy) installation and without --> different results syntax

Question asked by gismountains on Feb 18, 2018
Latest reply on Feb 18, 2018 by bixb0012

If a script runs in an environment with ArcGIS Pro (arcpy) or in environment without the results are different. The "extent" result is ones an array and the other one is a string with all values:



import arcgis
from arcgis.gis import GIS
from arcgis.geometry import Polygon
gis = GIS()
webmap_search = = 'title:"World Regions" AND owner:esri', item_type = 'Feature Layer Collection')
layer_region = webmap_search[0].layers[0]
query_result = layer_region.query(where="REGION='Western Europe'")
selected_region = query_result.features[0]
from arcgis.geometry import Polygon
polygon = Polygon({
  "rings" : selected_region.geometry['rings'],
  "spatialReference" : {"wkid" : 3857}
extent = polygon.extent
Result WITHOUT arcpy:
(-533252.171281941, 5066318.40606212, 1910953.15492337, 7372844.99872111)

Result WITH arcpy (ArcGIS Pro):
-533252.171281941 5066318.40606212 1910953.15492337 7372844.99872111 NaN NaN NaN NaN

This behavior is difficult if you would like to use the same script in different environment.