{ "lastLocations" : [{ "driverID" : 83886089, "driverEmployeeId" : null, "vehicleID" : 83886595, "vehicleName" : "PVLV1139", "head" : 5, "speed" : 0, "time" : "2013-08-07T13:33:01Z", "location" : { "lat" : 45.443727, "lng" : -129.978607 } }, { "driverID" : 83886089, "driverEmployeeId" : null, "vehicleID" : 83886596, "vehicleName" : "PVLV1219", "head" : 3, "speed" : 0, "time" : "2013-10-03T00:14:50Z", "location" : { "lat" : 41.920233, "lng" : -175.161255 } } ] }
I have tried to set "JSON Object Name" to "lastLocations" but then the input adapter fails to collect anything.
For version 10.2, if I set "JSON Object Name" to "location", then the output is the two geoevents as defined in the JSON source. If I don't define a "JSON Object Name" then it seems the whole collection is treated as one event rather than multiple events. Not sure if that is a feature or bug.
I know this thread is 2 years old, but I'm facing the same issue and I can't get the geometry data into the output feature class. This is some json output straight from the input connector:
The data is being delivered in an array called "Updates". When I add "Updates" to the JSON Object Name setting in the input connector, the data is parsed into separate geoevents. At this point, I can get all the attributes into the feature class except for Geometry. That shows up in the new GeoEvent definition as a group.
This is the output json data after adding "Updates" to the JSON Object Name setting in the input connector:
This is the new GeoEvent definition showing the grouped geometry attributes:
I tried the 'Construct Geometry from Fields' option as shown below...
...but when I did, the input connector was no longer streaming any data through. I have tried various processor options to construct a new geometry field including the Projector processor. Nothing works. Can anyone tell me what I'm missing?
Hello James -
I tried the 'Construct Geometry from Fields' option as shown below...
...but when I did, the input connector was no longer streaming any data through.
I think the reason that the input stopped showing data records being received (when you toggled its 'Construct Geometry from Fields' to 'Yes') is that the GeoEvent structure already has a field named 'Geometry' which is preventing the input's adapter from creating a field it wants to name 'Geometry' into which it can place the value it has created.
Assuming that you have no influence over the data provider's choice of naming the group element, here's something you can do to work around the issue.
When configuring the 'Push JSON to an External Website' output, I elected to clear the parameter field 'Header Parameter Name:Value List' (since I wasn't actually providing a list of name:value pairs...)
What I ended up doing was placing both the rest-json-in and rest-json-in-repost inputs in the same GeoEvent Service. This might lead to some confusion with your event counts on the Monitor page as every event received increments the GeoEvent Service's event count by 2 (since it has two inputs and is essentially sending a copy of the event record to itself).
My solution uses three GeoEvent Definitions ... an original matching the data provider's structure, a remap of that structure, and a copy of the remapped structure with a Geometry field added (used by the rest-json-in-repost input constructing the Geometry, so it has somewhere to place the Geometry it constructs).
Please let me know how this works for you -
RJ
That's an interesting solution that didn't occur to me. What I ended up doing is similar and uses two GeoEvent services. The first one uses Field Calculator processors to calc the geometry data to the fields longitude, latitude, and wkid. Then there's a Field Reducer that strips out the Geometry attribute and the resulting stream is output to cache. The second service inputs from the cache, creates the geometry from the longitude, latitude and wkid fields and outputs to the appropriate service. I'd prefer to have only one GeoEvent service, but this works. I'm gonna give your approach a try just to check it out, but what I've done is working and that's what I needed. Thanks for looking into this for me.