Is it possible that instead, or in addition to, of returning the spatial coordinates could return latitude and longitude? I got this simple result from my query
{ "objectIdFieldName": "OBJECTID", "globalIdFieldName": "", "hasZ": false, "geometryType": "esriGeometryPoint", "spatialReference": { "latestWkid": 32632, "wkid": 32632 }, "fields": [ { "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "ID" } ], "features": [ { "geometry": { "x": 283130.435, "y": 6571673.844 }, "attributes": { "OBJECTID": 4294824 } },
Solved! Go to Solution.
When you query your feature specifiy:
"outSR" : "4326", # 4326 = WGS 1984 lat/lon
See 'outSR' in the request parameters section of this page: Query (Feature Service).
You can also convert after retrieving your data using projectAs:
# 4326: WGS 1984 (Lat/Lon)
# 32631: WGS 84 / UTM zone 31N
ptGeometry = arcpy.PointGeometry(arcpy.Point(x,y),arcpy.SpatialReference(32632)).projectAs(arcpy.SpatialReference(4326))
print ptGeometry.firstPoint.X, ptGeometry.firstPoint.Y
When you query your feature specifiy:
"outSR" : "4326", # 4326 = WGS 1984 lat/lon
See 'outSR' in the request parameters section of this page: Query (Feature Service).
You can also convert after retrieving your data using projectAs:
# 4326: WGS 1984 (Lat/Lon)
# 32631: WGS 84 / UTM zone 31N
ptGeometry = arcpy.PointGeometry(arcpy.Point(x,y),arcpy.SpatialReference(32632)).projectAs(arcpy.SpatialReference(4326))
print ptGeometry.firstPoint.X, ptGeometry.firstPoint.Y
Super, thanks!