2

I have a linear ring created from points. I would then like to create a multilinestring from that and subsequently split that into segments of 7 metres each.

I tried the following but got 'LinearRing cannot be cast to class org.locationtech.jts.geom.MultiLineString'.

GeometryFactory gf = new GeometryFactory();
LinearRing outer = gf.createLinearRing(coords.toArray(new Coordinate[] {}));
Polygon polygon = gf.createPolygon( outer, null );
MultiLineString mlslr = gf.createMultiLineString(new LineString[]{polygon.getExteriorRing()});

1 Answer 1

1

I developped exactly what you describe here. Feel free to reuse !

I called it "little thumbling densifier", as a reference to this tale. I have proposed to include it as part of JTS (see here) so that it can also appear in GeoTools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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