Converting Lat/Long Coordinates in JSON Feed to Geometry

10693
2
05-13-2014 11:40 AM
TomFlahive
New Contributor III
I have a JSON feed which contains the Latitude/Longitude coordinates of a point feature in a format that makes it harder to get at.  The part of the JSON record that has the Lat/Long looks like this:

{
    "location": {
        "type": "point",
        "coordinate": [
            34.854503,
            -117.087665
        ]
    }
}
 

And the GeoEvent Definition File that is auto-generated looks like this:

[ATTACH=CONFIG]33786[/ATTACH]

Does anyone know how these coordinates can be extracted to create the Geometry for this event?  My end goal is to generate a feature service from the JSON data.

Thanks.
Tom
0 Kudos
2 Replies
RJSunderman
Esri Regular Contributor
Hello Tom -

The screenshot you took of the GeoEvent Definition generated by the inbound connector is indicating that location is a group containing two elements. The first element type is a String, the second element coordinate is a list of Double values. The "infinity" is how GEP indicates an element whose cardinality is "many".

When coordinates are in a list, you need to specify the list index from which the coordinate value can be obtained. In your example you would retrieve the X Geometry Field from location.coordinate[1] and the Y Geometry Field from location.coordinate[0]. Note that I'm assuming the value 34.854503 is "latitude" and the value -117.087665 is "longitude". The list index is zero-based.

Please refer also to the forum thread Is" rel="nofollow" target="_blank">http://forums.arcgis.com/threads/109508-Is-there-an-expression-fo... there an expression for converting values of longtitude and latitude into a point.

Hope this information helps -
RJ
0 Kudos
TomFlahive
New Contributor III
That worked, thanks!  I added the coordinates to my "Poll an external website for JSON" input.

[ATTACH=CONFIG]33887[/ATTACH]

I am now able to generate features from the JSON feed to an "Update a Feature" output.  Works nicely.

Tom
LSA Associates
0 Kudos