AnsweredAssumed Answered

Creating a formatted JSON feed

Question asked by joel.meier on Mar 6, 2019
Latest reply on Mar 7, 2019 by simo

Hello, I am trying to create a JSON feed from a layer stored in AGO however the coordinates come in as Web Mercator and I need them as WGS84. Using the project function works but is excruciatingly slow


Is there any other way to achieve this?


import json
import time
from arcgis.gis import GIS
from arcgis.geometry import project
gis = GIS(
profile = "AGOL")#credentials stored in windows identity manager
fc = gis.content.get('LayerID')#layer ID
flayer = fc.layers[0]
fset = flayer.query()

for f in fset.features:
    if f.attributes['GPS_Time'] != None:
        geomarray = []
        for coord in geom:
            projectgeom = project(geometries=geomarray, in_sr=3857, out_sr=4326)
            data={"UploadRequest": {"Projection": 1, "DataLayer": 4, "Issues": [{"Locations": [{"Geometry": projectgeom,"Description": f.attributes['Condition']}],
"Type": 1,
"Priority": 3,
"SourceId": "API-TEST:1",
"StartTime": f.attributes['GPS_Time'],
"Url": "",
"Description": "This is a test"