0

I want to create a WPS Request using the JTS:Buffer (or any other process). I'm using the built in WPS Request Builder from GeoServer.

My Multipolygon looks like this:

52.52735668,12.71762844 52.52633816,12.71518035 
52.52467495,12.71354766 52.52293926,12.7136373 
[..] 52.52154308,12.71439548 

I'm building the request with TEXT and text/gml subtype gml:3.1.1. My input is:

MULTIPOLYGON(((52.52735668,12.71762844 52.52633816,12.71518035 
    52.52467495,12.71354766 52.52293926,12.7136373 52.52154308,12.71439548))) 

Unfortunately the

Process failed during execution Could not convert MULTIPOLYGON(((52.52735668,12.71762844 52.52633816,12.71518035 52.52467495,12.71354766 52.52293926,12.7136373 52.52154308,12.71439548))) to target type com.vividsolutions.jts.geom.Geometry

But when I insert an other Multipolygon as from this Answer

 MULTIPOLYGON(((743238 2967416,743238 2967450,743265 2967450,743265.625 2967416,
        743238 2967416)))

Everything runs fine and I get the buffered Multipolygon returned. Can someone explain me what I am doing wrong?

  • Notice the difference between space comma, and comma space between coordinates and pairs of coordinates? In GML it is the other way round than WKT. This is a source of huge annoyance, but c'est la vie. I usually use the 3 line hack, replace space with @, replace commas with space, repace @ with comma, or something similar. – John Powell Jun 30 '15 at 13:42
  • Thanks for your comment but unfortunately this does not work either: MULTIPOLYGON(((52.52735668 12.71762844,52.52633816 12.71518035,52.52467495 12.71354766,52.52293926 12.7136373,52.52154308 12.71439548))) – Antivist Jun 30 '15 at 13:57
  • OK, next problem, your polygon isn't closed. Try MULTIPOLYGON(((52.52735668 12.71762844,52.52633816 12.71518035, 52.52467495 12.71354766,52.52293926 12.7136373, 52.52154308 12.71439548, 52.52735668 12.71762844))) – John Powell Jun 30 '15 at 13:59
  • If you have access to Postgres, you can always test with SELECT ST_GeomFromText('your multipolygon'); You get an error with the previous one: "<-- parse error at position 137 within geometry", which is a slightly cryptic way of telling you your need to repeat the start point. – John Powell Jun 30 '15 at 14:02
  • Thank you, John. Wasn't that familiar with WPS-requests but I've learned that it has to be closed which will help me alot. Would you mind to post an answer so I can upvote it? – Antivist Jul 1 '15 at 7:49
1

This is caused by the WKT and GML standards using a different convention for separating pair of points and each coordinate of a point.

GML uses comma to separate coordinates and space to separate pairs, eg,

52.52735668,12.71762844 52.52633816,12.71518035

whereas WKT uses the opposite, eg,

52.52735668 12.71762844, 52.52633816 12.71518035

You have a 2nd issue in that you need to ensure that the first point is repeated in your Multipolyon, ie, that the linestring is closed.

To convert from GML to WKT you can use the following pseudo code:

gml = gml.replace(",", "@")
gml = gml.replace(" ", ",");
wkt = gml.replace("@", " ");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.