Select to view content in your preferred language

ARCGIS Rest API with python addfeatures question

3101
10
Jump to solution
01-31-2019 09:08 AM
Larry
by
Occasional Contributor

I am uploading some Points and Lines into ArcGIS Online hosted feature services using a python program the ArcGIS Rest Api. The points work fine but I am having trouble getting the correct format for adding the lines.

For the Points:

{
    "features":

            "geometry": {

                  "x": x,
                  "y": y
             },
            "attributes": {
                "RECORD_ID": RECORD_ID,
                "DEVICE_ID": DEVICE_ID,
                "DATE_TIME": DATE_TIME,
                "LONGITUDE": LONGITUDE,
                "LATITUDE": LATITUDE,
            }

 }

Works.

For the lines If have tried:

{
     "features":
            "paths":[
                [x,y],[x1,y1]],
                "spatialReference": {"wkid" : 4326},
                
            "attributes": {
                "RECORD_ID": RECORD_ID,
                "DEVICE_ID": DEVICE_ID,
                "DEVICE_NAME": DEVICE_NAME,
                "DATE_TIME": DATE_TIME,
                "SPEED": SPEED,
                "HEADING": HEADING,
            }
 }

FAILS.

The error I get is:

"No JSON object could be decoded"

Any idea what I am doing wrong?

Thanks

Larry

Tags (1)
0 Kudos
10 Replies
Larry
by
Occasional Contributor

Thanks to both of you. I thought I had created a wgs84 lat/long projection but AGOL turned it into web mecator. It is inserting the coordinates correctly when I set the projection to 4236 on the input so I assumed AGOL was doing the conversion. I am getting lines now but AGOL still complains about there was no json object to decode. Thanks for all your help