1

I am wondering if there is a way, algorithm, tools, to create, from a geometry, another one that is the border with a certain thickness.

The idea is to get something similar to that : enter image description here

This looks quite feasible with square or very simple shape, but with complex polygon I am a bit lost.

I am using geotools to manipulate the geometries.

I tried to scale the geometry and intersect the original and the expanded one but this does not work when the anchor point of the scale is not in the right place and I cannot figure out get it nice with all kind of shape.

Looks fine to me with geotools:

polygon.getExteriorRing().buffer(50);
0

You could extract the exterior ring of your polygon. I'm not sure GeoTools can do this, but I'm quite sure it can.

Postgis can (http://postgis.net/docs/ST_ExteriorRing.html ), so JTS should contain something similar.

Got the exterior ring, you can apply a buffer on it.

  • "I'm not sure GeoTools can do this, but I'm quite sure it can" Huum? Can it do it or not? – HimBromBeere Feb 29 '16 at 14:18
  • The question asks for "way, algorithm, tools", so I think it's ok to suggest something else from GeoTools. – fradal83 Feb 29 '16 at 14:20
2

In the simplest case (a projected geometry) you can just do:

 Geometry buffer = geom.buffer(dist);

where geom is a com.vividsolutions.jts.geom.Geometry and dist is the distance to buffer in projection units (meters etc).

If your geometry is in an unprojected state (i.e. lat/lon or lon/lat degrees) then you need to reproject it to a local projection. See this question for a detailed example of how to do that.

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.