{ "iss_position": { "coordinates": [ -127.632425, 44.163747 ] }, "message": "success", "timestamp": 1400010196 }
Hi RJ.
I have just upgraded to 10.3.
I have a GEP service which uses a Field Calculator to convert coordinates from minute degrees to decimal degrees and then use a Field Mapper to to cast the the string to a Geometry type, like explained in the "Using a Field Calculator Processor to compute a Geometry" example. Like this:
longitude and latitude are converted coorinates.
'{' + ' "x":' + longitude + ',' + ' "y":' + latitude + ',' + ' "spatialReference":{"wkid":4326} }'
This worked just fine in 10.2.2, but now this is not working. I get the follwing error:
com.esri.ges.adapter.genericJson.JsonInboundParser | Json parser could not find the field 'location.longitude' in the incoming data. This field is needed to populate the 'x' value in the Geometry. |
com.esri.ges.adapter.genericJson.JsonInboundParser | Json parser could not find the field 'location.latitude' in the incoming data. This field is needed to populate the 'y' value in the Geometry. |
So something have changed in 10.3, I guess it's trying to read the String with nested fields as a Geometry type, and not just converting the string to a geometry object?
How can I fix this?
Best regards
Sindre
I fugured this one out.
In 10.3 when you calculate the geometry with the Field Calculator the New Field Type should be Geomtry, not String. This have changed from 10.2.2. When you then Field Map it to the Shape field of the output Feature Class it works!
I've just verified for the 10.3.1 product release that this has been fixed. You will again be able to use a Field Calculator to produce a JSON String representation of a Geometry and write the result to a New Field Type: String.
When using the 10.3.0 product release, you will need to write your Field Calculator output to a Geometry field of type Geometry as illustrated above. You will probably also have to use a Field Mapper to make sure the 'Geometry' the processor has calculated is cast to a proper Geometry before attempting to update features through a feature service.
The workflow outlined in the appendix of the product introduction tutorial works as documented for the 10.3.1 product release. Apologies for the frustration over this issue.
- RJ
Hi All,
I'm trying the opposite. I have a geometry tag but I'm trying to use the x or y value in the field calculator expression. Anyone know how to to this?
Hello David -
If the field type within your GeoEvent is already of type Geometry, then no, you cannot use a Field Calculator processor (for example) to reach into the Geometry object and extract out coordinate values.
You might want to take a look at the Extent Enricher Processor available on the Gallery. The source code for this custom processor is available on GitHub here.
As I understand it, the processor allows you to enrich an event with fields providing the minimum and maximum X and Y values. The processor can optionally enrich the event with a second Geometry representing the center point of the original geometry.
I believe the processor, given a Point geometry, will return to you identical minimum X and maximum X values ... the minimum Y and maximum Y would likewise be the same.
Hope this information helps -
RJ
Thanks for the response RJ. I was hoping for an easier solution than a custom processor. I'll have to rethink my approach.
Cheers,
David