Skip to main content

Hello... What transformers would I need to extract the Well-known text (WKT) from the following oData entry? Thanks!

{
"id":"97051464","GeoInstance":{
"Geography":{
"CoordinateSystemId":4326,"WellKnownText":"POLYGON ((-111.854 54.5259, -111.738 54.0571, -111.738 54.0571, -111.086 54.219, -111.086 54.219, -111.145 54.4751, -111.145 54.4751, -111.854 54.5259))","WellKnownBinary":null
}
}

Hello @gerardbrazil, please check out the GeometryExtractor . It has the option for WKT


I couldn't get the GeometryExtractor to work in this case, but the following worked for me:

To get to the geometry part, use a JSONExtractor with the following query:

jsonÂ"GeoInstance"]e"Geography"]""WellKnownText"]

Send the result of the JSONExtractor to the GeometryReplacer set to "OGC Well Known Text"


It looks like you need to flatten the oData (it's json) first and then expose the GeoInstance.Geography.WellKnownText. That holds the WKT and that can be used by the GeometryReplacer, like this:

I did have to add a } at the end of that oData string to make it valid though. Can you doublecheck your data to see whether or not it's just a matter of missing one character when copying it into your original post.

As an added suggestion: if you expose the GeoInstance.Geometry.CoordinateSystemId and then use an AttributeManager to turn that into an EPSG coordinate system identifyer you can put that in to a CoordinateSystemSetter:


@gerardbrazil

You can alos use a stringsearcher with the regexp

(?=Wellkn).+":"(.+)\\,

Then in advanced enter a listname for the subexpression list and use a GeometryReplacer choosing WKT and listname{0}.part as geometry source


Thanks everyone for your help! I was able to extract the WellKnownText geometries from an oData feed and translate them into KML.


Reply