Linestring from Polygon

Feb 17, 2011 at 2:33 PM


now i reached a time where i can´t imagine another way to get the linestrings of a polygon.

I always get the Linearring from the polygon, also when i convert to NTS i can´t get the linestrings out of the polygon. I also converted to WKB, but the linearring is not supported...

Do I have to draw a new linestring manually? I thought the best would be to convert to multilinestrings, but... i think thats not possible form the linearring i get with the exteriorRing-Method!?

Has anybody an idea how to do that?

Thanks for help!

Feb 17, 2011 at 2:41 PM

Hello cdplxa,

a LinearRing is a special form of a LineString. It must have at least four vertices, and the last and the first are equal.

You should be able to treat it as if it were a LineString, e.g. any function taking a LineString as an argument will also take a LinearRing.

If you want it to be a LineString you can code

LinearRing linearRing; //Should be set to something.
var lineStringFromLinearRing = new LineString(linearRing.Vertices);

Hth FObermaier

Feb 17, 2011 at 3:02 PM

mh, ok! that´s great, thanks for the fast reply... think i couldn´t see the wood for the forest...

Thanks a lot :)!