Skip to main content
Solved

oData and Well-known text (WKT)

  • August 9, 2017
  • 5 replies
  • 37 views

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 } }

Best answer by redgeographics

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:

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • August 9, 2017

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


david_r
Celebrity
  • August 10, 2017

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"]["Geography"]["WellKnownText"]

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


redgeographics
Celebrity
Forum|alt.badge.img+62
  • Celebrity
  • Best Answer
  • August 10, 2017

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:


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • August 10, 2017

@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.