2

I am still a beginner to GIS.

I have a polygon and I want to draw a large border inside the that polygon (see fig A and B below).

With the library I am using, I have to do this with a polygon with "holes" (inner rings).

I use JTS to buffer the polygon with a negative value, which works most of the time.

The issue is that is some situations, the buffered geometry is self intersecting (fig C, red circles) and the rendering library does not like it (not one bit).

How can I go from fig. C to fig. D with JTS ?

enter image description here

The code is really simple (insetDeg is a negative value) :

Geometry innerPoly = polygon.buffer(insetDeg);

I then add my innerPoly as an inner ring for the renderer

This is not a code related question, and to me it is more about geometry manipulation know-how.

"Do an intersection of the polygon with itself" is the tip I was looking for.

closed as off-topic by Vince, PolyGeo Jul 22 '16 at 12:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – Vince, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you tried using a negative buffer distance? Generally, code is required for coding questions. – Vince Jul 22 '16 at 12:16
  • Yes, I am getting at C currently and it works in most situation. I am after the trick to transform C into D for those polygons with "neck". – jmc34 Jul 22 '16 at 12:20
  • Sounds like a library defect to me (which would be off-topic). You still need to provide code. – Vince Jul 22 '16 at 12:22
  • I have provided the relevant code, but I am really doing not much. – jmc34 Jul 22 '16 at 12:24
  • It's not an MCVE unless it can be used to reproduce the issue. You have undefined variables. – Vince Jul 22 '16 at 12:26