Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] MultiPolygon Result from Buffer on Simple Valid Polygon

Ah, that's nasty.  It's even worse than it appears, because the output is invalid, due to the sliver polygon artifact overlapping the buffer polygon.

This is unfortunately a robustness issue in the buffer algorithm.  The cause is a couple of points which are very close together:

Ring-CW  Vert[0 48]  POINT ( 0.7668779968808073 3.564681338871528 )
Ring-CW  Vert[0 49]  POINT ( 0.7668779968807771 3.564681338871527 )

One way to avoid this is to weed the input geometry to remove points which are so close together they will have very little impact on the output.  This can be done with one of the JTS simplification functions, or maybe even better with a simple distance-based scan weeder.

There is some provision in the buffer algorithm to do this automatically - I'm not sure why it failed in this case.  Perhaps because the error occurs at an endpoint of the ring.


On Mon, Sep 26, 2016 at 9:53 AM, Kay, Jim <Jim.Kay@xxxxxxxxxxxxxx> wrote:

Please help! Any advice or solutions gratefully received!

I have a simple valid polygon that produces a MultiPolygon after buffering, when I was just expecting another single simple Polygon.

Why is this happening?

Can it be predicted?

 

The buffer value is 0.005

 

Input =

 

POLYGON ((0.7668779968807771 3.564681338871527, -1.0790828879893206 3.501372751894663, -1.079372080977487 3.501359499764618, -1.0833137671830821 3.5011789030229563, -1.083633604054462 3.5011642513988437, -1.0948412046245983 3.501085737978757, -1.1035044526606603 3.5021750503003943, -1.1092779718019103 3.5043887609190154, -1.11193159005958 3.507638616178024, -1.1120870871650812 3.509266015629815, -1.1101726804479204 3.513752590267064, -1.105102703636879 3.518902003217866, -1.0970792807081766 3.5245089636377847, -0.8470251304228252 3.6903184283228097, -0.8383719872228549 3.695350891964352, -0.8270067697589224 3.7004612010159508, -0.8133825733862969 3.7054456235822317, -0.7980425518207173 3.7101054464647314, -0.7815982633137657 3.7142548972300466, -0.7647052897552612 3.7177285503705133, -0.7480371006921206 3.720387922297167, -0.7322582042227791 3.722126992243426, -0.7179976551562821 3.722876428978485, -0.717673261034114 3.7228829968397594, -0.713675455243893 3.7229639258667513, -0.7133821481068161 3.722969862463567, 0.409576015592515 3.7581984475865715, 0.4098997218464772 3.7582121751813182, 0.4138890938107309 3.7583813392173036, 0.4141817853445169 3.758393749282287, 0.4303753274802963 3.758309035355792, 0.4474831462576271 3.7574083282297925, 0.4648232069287013 3.7557275362550553, 0.4817042159942887 3.753333667303568, 0.4974531808940492 3.750322157376136, 0.5114422400961618 3.7468130658701964, 0.5231136939552675 3.7429462891905128, 0.5320022384374061 3.738875983520985, 0.8013745195980979 3.584413508988408, 0.8066688985032548 3.5798475649267116, 0.8086879717166704 3.5756280309670485, 0.8073512451608796 3.57192312661288, 0.8027120099053775 3.568880554709305, 0.7949552176198473 3.5666216129967294, 0.7843901071347398 3.5652363583527293, 0.7714378760649617 3.564780016508538, 0.7711481034342423 3.564773744187111, 0.7671984806856584 3.5646882725991955, 0.7668779968808073 3.564681338871528, 0.7668779968807771 3.564681338871527))

 

Output=

 

MULTIPOLYGON (((0.7670177667522091 3.559683192752515, -1.0788827511919128 3.4963766761038007, -1.0791431985620081 3.4963647412279233, -1.0830849216142129 3.4961841427979197, -1.0834047956185886 3.496169489472618, -1.0835985780499513 3.496164374082448, -1.0948061786200876 3.4960858606623613, -1.0954649902182996 3.4961248014206974, -1.1041282382543616 3.4972141137423347, -1.1052945051628429 3.497506462501131, -1.111068024304093 3.4997201731197523, -1.1118462598986802 3.5000987846659353, -1.1125475498547859 3.500605923444823, -1.1131508835998414 3.501226395632486, -1.1158045018575111 3.5044762508914946, -1.116347370341116 3.5052932197285513, -1.116720294116688 3.5062004529559117, -1.116908920925257 3.507163035003481, -1.117064418030758 3.5087904344552716, -1.1170745151972197 3.5096203623868756, -1.1169471823230535 3.5104405261897735, -1.116685928102913 3.511228326010087, -1.114771521385752 3.515714900647336, -1.1143260868590648 3.5165363314877713, -1.1137355887084566 3.5172605362083527, -1.1086656118974152 3.522409949159155, -1.107966779707328 3.523000425873313, -1.0999433567786256 3.5286073862932317, -1.0998424669828828 3.5286760731409386, -0.8497883166975315 3.6944855378259636, -0.8495388174490363 3.6946406242385748, -0.8408856742490659 3.699673087880117, -0.8404224628749387 3.6999111057312946, -0.8290572454110062 3.7050214147828933, -0.8287246654020657 3.7051568196715987, -0.8151004690294402 3.7101412422378797, -0.8148358467970112 3.7102297636714967, -0.7994958252314315 3.7148895865539964, -0.799265876091629 3.7149534850091532, -0.7828215875846775 3.7191029357744685, -0.7826053286054429 3.719152429210371, -0.7657123550469384 3.7226260823508377, -0.7654930648756366 3.7226661014193345, -0.748824875812496 3.7253254733459884, -0.7485848584795459 3.7253578278703463, -0.7328059620102044 3.727096897816605, -0.7325206078513746 3.727120101929353, -0.7182600587848776 3.7278695386644123, -0.7180988671555387 3.7278754044866473, -0.7177744730333706 3.7278819723479217, -0.7137766513177277 3.7279629016973233, -0.7135111317744486 3.7279682758675468, 0.4093916967563248 3.7631951250579414, 0.4096878744178587 3.7632076852320524, 0.4136772657864812 3.7633768500908924, 0.4139699766054192 3.7633892609735997, 0.4142079416871592 3.7633936808663933, 0.4304014838229386 3.7633089669398982, 0.4306382076846225 3.7633021199733583, 0.4477460264619533 3.7624014128473586, 0.4479655410864408 3.7623850033476933, 0.4653056017575151 3.760704211372956, 0.4655252254187507 3.7606780079537554, 0.4824062344843381 3.758284139002268, 0.4826432991180261 3.758244687858067, 0.4983922640177866 3.7552331779306347, 0.4986697175516882 3.75517190361286, 0.5126587767538007 3.7516628121069204, 0.5130146993400074 3.751559366737866, 0.5246861531991132 3.7476925900581826, 0.52519544135618 3.7474923124811257, 0.5340839858383186 3.7434220068115978, 0.5344894300494842 3.743213480251221, 0.803861711210176 3.588751005718644, 0.804639966114085 3.5881999134902047, 0.8099343450192419 3.5836339694285084, 0.8106410650144498 3.582884321948164, 0.811179138816105 3.582005742936131, 0.8131982120295206 3.577786208976468, 0.81353479784346 3.5768561500560097, 0.8136817177338558 3.5758780323987334, 0.8136332224338748 3.574890131689376, 0.8133912096608308 3.5739311064429136, 0.81205448310504 3.570226202088745, 0.8115849902836264 3.569263163786896, 0.8109211065316004 3.5684222567504267, 0.8100933138398786 3.5677420909326147, 0.8054540785843765 3.56469951902904, 0.8048051077588819 3.564339746259739, 0.8041100385816038 3.564079980179059, 0.7963532462960736 3.561821038466483, 0.795605233904561 3.561664045162639, 0.7850401234194534 3.560278790518639, 0.7845661613091248 3.560239458821252, 0.7716139302393468 3.5597831169770604, 0.771546079046851 3.5597811874341736, 0.7712563064161316 3.5597749151127465, 0.7673066575760012 3.5596894429601305, 0.7670177667522091 3.559683192752515)), ((0.7670231773825333 3.559745201812444, 0.767023177382545 3.5597452018124445, 0.7670249921388167 3.559683500099206, 0.7670249921387865 3.5596835000992053, 0.7670231773825148 3.5597452018124436, 0.7670231773825333 3.559745201812444)))

 

 

Jim Kay

 

From: jts-dev-bounces@locationtech.org [mailto:jts-dev-bounces@locationtech.org] On Behalf Of Martin Davis
Sent: 23 September 2016 17:36
To: JTS developer discussions
Subject: Re: [jts-dev] Struggling with polygon topology again. Overlapping inner polygons.

 

 

 

On Thu, Sep 22, 2016 at 2:45 PM, Phil Scadden <p.scadden@xxxxxxxxxx> wrote:



>1. For polygons which have "loops" in their shell, buffer(0) may FAIL because it keeps only one of the loops (and may choose the smaller one).

>2. For polygons with rings that touch but do not cross, buffer(0) should produce VALID output


That is excellent information. What about the more common case of internal rings that overlap?

 

Hole rings that overlap should also produce valid output, but perhaps not in the way you might expect.  The entire area covered by the holes will be merged into a single hole (which makes topological sense, since the hole areas were exterior to the polygon to begin with). 

 

 

 


_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.locationtech.org/mailman/listinfo/jts-dev



Back to the top