Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Polygon empty as a result of small buffer

Thank you Martin,

You are right, I meant to use  a scale factor of 10000. I'll start taking into account keeping consistency with the scale factor!

On Tue, Sep 28, 2021 at 7:22 PM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Are you sure that you are using the correct scale factor for the PrecisionModel?  Don't forget that scale factors are the reciprocal of the grid size.  So the specified scale factor of 0.00001 actually results in the *input* Polygon being collapsed completely to (0,0).  Also, it is the client's responsibility to ensure that coordinates for geometries are consistent with the PrecisionModel scale, which in this case they are not.

Perhaps you meant to use a scale factor of 10000?  (The input coordinates are still not consistent with that scale factor, but in this case it probably doesn't affect the result).

When I use a scale factor of 10000 to load:

POLYGON((72.0 254.374516,  72.0 394.253883,  216.0 394.253883,  216.0 254.374516,  72.0 254.374516))

and run buffer(-0.001) I get the expected result of:

POLYGON ((72.001 254.3755, 72.001 394.2529, 215.999 394.2529, 215.999 254.3755, 72.001 254.3755))





On Tue, Sep 28, 2021 at 6:46 AM Meyer Montagner Murcian <mmontagner@xxxxxxxxxxxxxx> wrote:
Dear JTSers,

since updating to version 1.18.2, I've found a behaviour that wasn't present on the previous version and I'm not sure how to handle. When applying a small negative buffer to a valid polygon, I'm sometimes receiving an empty polygon as a result.  The following test replicates the problem:

@Test
void jtsSmallBuffer() {
PrecisionModel precisionModel = new PrecisionModel(0.00001d);
GeometryFactory jtsGeometryFactory = new GeometryFactory(precisionModel);

Coordinate[] shell = new Coordinate[5];
int i = 0;
shell[i++] = new Coordinate(72.000000, 254.374516);
shell[i++] = new Coordinate(72.000000, 394.253883);
shell[i++] = new Coordinate(216.000000, 394.253883);
shell[i++] = new Coordinate(216.000000, 254.374516);
shell[i] = new Coordinate(72.000000, 254.374516);

Polygon polygon = jtsGeometryFactory.createPolygon(shell);

Geometry bufferedPolygon = BufferOp.bufferOp(polygon, -0.001);

Assertions.assertFalse(bufferedPolygon.isEmpty());

}

This tests passes on version 1.18.1  or when the scae value passed to the precision model is reduced. Digging a bit, the cause of the empty polygon is OffsetCurveSetBuilder::192, wich determines that the resulting curve "isTooClose"  (a value of 9.830507833896718E-4 in maxDist, wich is lowe than 9.9E-4).

What is the intention when returning an empty polygon in the new version? 

May this be a bug or is it caused by an incorrect use of the PrecisionModel?

Any help or insights are very appreciated. Thank you all.

Kind regars,

Meyer M

_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jts-dev


--

Meyer Montagner Murcian

Algorithms and Software Engineer

mmontagner@xxxxxxxxxxxxxx

ratedpower.com

Calle de Génova, 9, 1st floor, 28004, Madrid (Spain)

Request your free pvDesign demo

The information contained in this message and/or file(s) enclosed, sent from RATED POWER, SL is confidential/privileged and is intended to be read only by the person(s) to whom it is addressed. The personal data will be processed by the Data Controller: RATED POWER, SL, with TAX ID NIF B87769709 and address in CALLE GENOVA, 9 PRIMERA PLANTA, CP: 28004 - MADRID (MADRID). Purpose: The contact information and where applicable, the information related to the function or position held by the people that are providing services in the company, will be processed in order to locate and contact them. Legitimate basis: Legitimate interests. Recipients. The personal data won´t be transferred to third parties, unless it is strictly necessary or under legal obligation. The personal data will be kept for as long as the relationship between the parties is still binding. Rights: You are entitled to exercise your rights of access, to rectification, erasure, restriction, data portability and object. Moreover, you own the right to lodge a complaint with a supervisory authority (AEPD). If you are reading this message and you are not the addressee, the employee or responsible agent to deliver this message to the addressee, or has received this message by error, we inform you that it is completely forbidden, and could be illegal, any disclosure, distribution or reproduction of this communication and we request you to notify us immediately and return the original message to the

above mentioned address. Thank you


Back to the top