peterstace / simplefeatures

Simple Features is a pure Go Implementation of the OpenGIS Simple Feature Access Specification
MIT License
130 stars 19 forks source link

geom.Union failed at some cases #573

Open dongzhou77 opened 10 months ago

dongzhou77 commented 10 months ago

Hey,

geom.Union failed at some cases.

Input geometries: geometry a: MULTIPOLYGON(((144.14852129205005 -36.60216120134051,144.1498935327475 -36.88032819802394,144.15040812300904 -36.887324318786426,144.1526380141424 -36.887324318786426,144.15280954422957 -36.88801017847503,144.15503943536294 -36.88787300703022,144.15538249553728 -36.88938187936745,144.15778391675784 -36.88910754116068,144.1582985070194 -36.89102788790482,144.16138604858864 -36.89089072188227,144.16121451850145 -36.89418263839662,144.16344440963482 -36.894319798503766,144.16361593972198 -36.895279912352436,144.16653195120406 -36.89541707048774,144.2114728340455 -36.89637717053346,144.2114728340455 -36.895142753970624,144.2126735446558 -36.89500559534236,144.2126735446558 -36.89637717053346,144.2152464959635 -36.89651432669692,144.31902219870804 -36.89884594376332,144.32193821019013 -36.89884594376332,144.32210974027728 -36.89829733439166,144.32228127036447 -36.89884594376332,144.32519728184656 -36.89898309549001,144.50976365565342 -36.90309753267125,144.53223409707417 -36.87429181406224,144.53309174751004 -36.87223384684748,144.53309174751004 -36.86962700878087,144.53480704838185 -36.86948980431315,144.53497857846904 -36.87045023041224,144.53566469881775 -36.86990141697698,144.59655787976703 -36.79165520168818,144.58455077366435 -36.61193608998413,144.5713429569514 -36.61166075796511,144.57117142686425 -36.61262441573086,144.57031377642832 -36.612762080142936,144.56756929503345 -36.61234908616945,144.5670547047719 -36.61152309158697,144.55213158718715 -36.61124775809338,144.55196005709996 -36.61179842409749,144.54904404561788 -36.61166075796511,144.54870098544353 -36.61207375562499,144.54750027483325 -36.61179842409749,144.54767180492044 -36.61111009097795,144.54578497396145 -36.61097242361676,144.52863196524333 -36.61097242361676,144.51542414853037 -36.61028408312449,144.50667611408414 -36.61055942005868,144.5063330539098 -36.61138542496305,144.50358857251487 -36.61124775809338,144.50307398225334 -36.61179842409749,144.5018732716431 -36.61152309158697,144.5018732716431 -36.61083475600983,144.4963843088533 -36.60987107588005,144.39432390698053 -36.60753065971684,144.39243707602154 -36.60753065971684,144.39243707602154 -36.608632040875996,144.39140789549847 -36.60876971241501,144.39140789549847 -36.60794367949463,144.38763423358048 -36.60753065971684,144.3864335229702 -36.60849436909124,144.38626199288302 -36.607806006481134,144.3821452707907 -36.60725531196955,144.35795952849816 -36.60670461352599,144.35298515596992 -36.60711763772727,144.35281362588273 -36.60876971241501,144.35041220466218 -36.608632040875996,144.350240674575 -36.609320396113546,144.34938302413912 -36.60904505475579,144.34955455422627 -36.60725531196955,144.34372253126213 -36.60642926282975,144.30958804391307 -36.605603204843085,144.3068435625182 -36.605603204843085,144.306672032431 -36.60629158711301,144.3058143819951 -36.60629158711301,144.30564285190792 -36.605603204843085,144.2987816484207 -36.60546552765187,144.2986101183335 -36.60670461352599,144.2975809378104 -36.606842288505504,144.29740940772322 -36.60532785021491,144.2648186911588 -36.60463945934398,144.26464716107165 -36.605603204843085,144.26361798054856 -36.60574088178856,144.263103390287 -36.60463945934398,144.24286283999965 -36.604088742223894,144.2416621293894 -36.604088742223894,144.2414905993022 -36.60505249460376,144.23908917808166 -36.60491481642958,144.23874611790728 -36.60725531196955,144.2378884674714 -36.60697996323927,144.23840305773294 -36.604088742223894,144.23685928694832 -36.603951062329536,144.1768237564349 -36.602711932221936,144.1768237564349 -36.604501780432564,144.17630916617338 -36.60463945934398,144.17545151573748 -36.60367570180357,144.17270703434258 -36.603400340294655,144.17270703434258 -36.60257424987018,144.15332413449113 -36.60216120134051,144.15315260440394 -36.603813382189415,144.15229495396804 -36.603951062329536,144.1500650628347 -36.60367570180357,144.15040812300904 -36.60216120134051,144.14852129205005 -36.60216120134051),(144.1498935327475 -36.603951062329536,144.1500650628347 -36.60670461352599,144.1492074123988 -36.60711763772727,144.1490358823116 -36.60697996323927,144.1498935327475 -36.603951062329536)))

geometry b: MULTIPOLYGON(((144.14852129205005 -36.60216120134051,144.1498935327475 -36.88032819802394,144.15040812300904 -36.887324318786426,144.1526380141424 -36.887324318786426,144.15280954422957 -36.88801017847503,144.15503943536294 -36.88787300703022,144.15538249553728 -36.88938187936745,144.15778391675784 -36.88910754116068,144.1582985070194 -36.89102788790482,144.16138604858864 -36.89089072188227,144.16121451850145 -36.89418263839662,144.16344440963482 -36.894319798503766,144.16361593972198 -36.895279912352436,144.16653195120406 -36.89541707048774,144.2114728340455 -36.89637717053346,144.2114728340455 -36.895142753970624,144.2126735446558 -36.89500559534236,144.2126735446558 -36.89637717053346,144.2152464959635 -36.89651432669692,144.31902219870804 -36.89884594376332,144.32193821019013 -36.89884594376332,144.32210974027728 -36.89829733439166,144.32228127036447 -36.89884594376332,144.32519728184656 -36.89898309549001,144.50976365565342 -36.90309753267125,144.53223409707417 -36.87429181406224,144.53309174751004 -36.87223384684748,144.53309174751004 -36.86962700878087,144.53480704838185 -36.86948980431315,144.53497857846904 -36.87045023041224,144.53566469881775 -36.86990141697698,144.59655787976703 -36.79165520168818,144.58455077366435 -36.61193608998413,144.5713429569514 -36.61166075796511,144.57117142686425 -36.61262441573086,144.57031377642832 -36.612762080142936,144.56756929503345 -36.61234908616945,144.5670547047719 -36.61152309158697,144.55213158718715 -36.61124775809338,144.55196005709996 -36.61179842409749,144.54904404561788 -36.61166075796511,144.54870098544353 -36.61207375562499,144.54750027483325 -36.61179842409749,144.54767180492044 -36.61111009097795,144.54578497396145 -36.61097242361676,144.52863196524333 -36.61097242361676,144.51542414853037 -36.61028408312449,144.50667611408414 -36.61055942005868,144.5063330539098 -36.61138542496305,144.50358857251487 -36.61124775809338,144.50307398225334 -36.61179842409749,144.5018732716431 -36.61152309158697,144.5018732716431 -36.61083475600983,144.4963843088533 -36.60987107588005,144.39432390698053 -36.60753065971684,144.39243707602154 -36.60753065971684,144.39243707602154 -36.608632040875996,144.39140789549847 -36.60876971241501,144.39140789549847 -36.60794367949463,144.38763423358048 -36.60753065971684,144.3864335229702 -36.60849436909124,144.38626199288302 -36.607806006481134,144.3821452707907 -36.60725531196955,144.35795952849816 -36.60670461352599,144.35298515596992 -36.60711763772727,144.35281362588273 -36.60876971241501,144.35041220466218 -36.608632040875996,144.350240674575 -36.609320396113546,144.34938302413912 -36.60904505475579,144.34955455422627 -36.60725531196955,144.34372253126213 -36.60642926282975,144.30958804391307 -36.605603204843085,144.3068435625182 -36.605603204843085,144.306672032431 -36.60629158711301,144.3058143819951 -36.60629158711301,144.30564285190792 -36.605603204843085,144.2987816484207 -36.60546552765187,144.2986101183335 -36.60670461352599,144.2975809378104 -36.606842288505504,144.29740940772322 -36.60532785021491,144.2648186911588 -36.60463945934398,144.26464716107165 -36.605603204843085,144.26361798054856 -36.60574088178856,144.263103390287 -36.60463945934398,144.24286283999965 -36.604088742223894,144.2416621293894 -36.604088742223894,144.2414905993022 -36.60505249460376,144.23908917808166 -36.60491481642958,144.23874611790728 -36.60725531196955,144.2378884674714 -36.60697996323927,144.23840305773294 -36.604088742223894,144.23685928694832 -36.603951062329536,144.1768237564349 -36.602711932221936,144.1768237564349 -36.604501780432564,144.17630916617338 -36.60463945934398,144.17545151573748 -36.60367570180357,144.17270703434258 -36.603400340294655,144.17270703434258 -36.60257424987018,144.15332413449113 -36.60216120134051,144.15315260440394 -36.603813382189415,144.15229495396804 -36.603951062329536,144.1500650628347 -36.60367570180357,144.15040812300904 -36.60216120134051,144.14852129205005 -36.60216120134051),(144.1498935327475 -36.603951062329536,144.1500650628347 -36.60670461352599,144.1492074123988 -36.60711763772727,144.1490358823116 -36.60697996323927,144.1498935327475 -36.603951062329536)))

Error message: internal error extracting geometry: no rings to extract

Thanks!

peterstace commented 8 months ago

As discussed offline, I wasn't ever able to reproduce this error (there seems to be a copy/paste error with the geometries -- input A and input B are the same).

simoncochrane commented 4 months ago

Hi Pete,

Here are two geometries I encountered this issue on while unioning:

MULTIPOLYGON(((-84.68833861614341 33.586881506063484,-84.69297198085386 33.58116806479595,-84.69314358695425 33.58002533114709,-84.69417322355658 33.57959680212774,-84.71356471290028 33.55516713116744,-84.71373631900066 33.55373828152835,-84.71476595560297 33.553595395264594,-84.71631041050647 33.5517378523297,-84.86389165683904 33.36492286730951,-84.02061927953866 33.34788067611323,-84.01787358193248 33.3506019220889,-84.01787358193248 33.351461245252004,-84.01684394533015 33.3516044649545,-84.01547109652708 33.352893431673934,-83.96776460061955 33.400285501397065,-83.9672497823184 33.401430609399185,-83.96587693351529 33.402146294237056,-83.79856098563825 33.5681685767283,-83.79856098563825 33.569740047434045,-83.80422398695102 33.56988290698898,-84.68833861614341 33.586881506063484),(-84.2308367525124 33.4876996684837,-84.22860587320739 33.48784266364406,-84.22740463050468 33.48669869575038,-84.22912069150854 33.48555471274636,-84.2310083586128 33.48598370814359,-84.23169478301435 33.48727068158603,-84.2308367525124 33.4876996684837),(-84.14554852062021 33.495135103738065,-84.1443472779175 33.494849137265035,-84.14572012672059 33.49399123217892,-84.1469213694233 33.49413421695025,-84.1469213694233 33.495135103738065,-84.14554852062021 33.495135103738065),(-84.14846582432678 33.49913853518449,-84.1443472779175 33.4984236502898,-84.14383245961633 33.49742280151938,-84.14486209621866 33.49556405167663,-84.14812261212599 33.49542106926658,-84.14983867312988 33.496135978955564,-84.14846582432678 33.49913853518449),(-84.43590604247454 33.501426127175165,-84.43521961807299 33.5011401814824,-84.43539122417339 33.50042531311787,-84.43401837537029 33.4998534141756,-84.43453319367146 33.49856662774103,-84.43693567907687 33.499281511454996,-84.4377937095788 33.500282338736525,-84.43727889127763 33.5011401814824,-84.43590604247454 33.501426127175165),(-84.35713884239703 33.51643694937166,-84.35696723629664 33.516579897065206,-84.35679563019626 33.51629400144192,-84.35696723629664 33.516151053275976,-84.35713884239703 33.51643694937166)))

and

POLYGON((-84.91779342802035 33.944641723933344,-84.8848339500958 33.84748446314561,-84.8848343784715 33.84747361663,-84.88437073489857 33.84611900705978,-84.88229142057187 33.83998964770643,-84.88222714480544 33.83985616244309,-84.88125822370353 33.837025302976684,-84.88126237687771 33.83699770204221,-84.85536477724138 33.761309422514195,-84.85534194530501 33.76130671052121,-84.85449468317503 33.758831297387545,-84.85450724082959 33.75874254545525,-84.81368850762794 33.639440725461384,-84.81364280754319 33.63943194420541,-84.813631809119 33.6393995771171,-84.81245474992689 33.63920365933259,-84.8092293182866 33.63858389372383,-84.80916438043222 33.638655987723595,-84.80841510657781 33.63853127345728,-84.8083717818748 33.63844108760532,-84.79629514127976 33.63651549182358,-84.78394716531548 33.6344387969546,-84.7839497741841 33.6344018854751,-84.78350448493246 33.63432738751653,-84.78350322593263 33.634299607151,-84.75514064693321 33.62957592907422,-84.74704761565542 33.62822806594716,-84.7156639365883 33.6229775012537,-84.7156482619808 33.623012293828445,-84.71102277801262 33.62225009809144,-84.71102219943961 33.62225000275312,-84.71102210848343 33.622249987765194,-84.701763091656 33.62072426998016,-84.7017665676303 33.6206924426037,-84.69137613551851 33.61887890940932,-84.68574407498753 33.59073059778281,-84.6885541839693 33.587218663264146,-84.6885542340275 33.587218600703885,-84.68855451712274 33.58721824690553,-84.68855455244871 33.58721820275688,-84.69431943910551 33.580013533978004,-84.69424890091736 33.579543341019956,-84.69738559738585 33.57558565245055,-84.69863491361976 33.57402573125029,-84.70667667404871 33.56388161091509,-84.71550795902019 33.55280561973021,-84.77318683091957 33.48046612680534,-84.779117011864 33.4799318239731,-84.799023055071 33.4593348340223,-84.85210310244086 33.38149118368702,-84.8616600590725 33.36950507206812,-84.8616600589832 33.3695050720681,-84.86044709861349 33.369473606293106,-84.86389165683013 33.36492286730951,-84.86389165676792 33.36492286730951,-84.85608672289517 33.36476404808989,-84.8568535426636 33.3347906275748,-84.7156235981867 33.3312091337486,-84.7087594453567 33.3299197599267,-84.7053273689417 33.330063024627,-84.7048125574795 33.3292034328914,-84.6114600789917 33.3130128714351,-84.5967021504072 33.3128695787046,-84.5965305465864 33.3104335662518,-84.5670146894175 33.3052747269735,-84.5440197774371 33.302981811551,-84.40155431850484 33.300961131709805,-84.44207668304443 33.26879753476913,-84.37753200531006 33.12479312032584,-84.37375545501709 33.12234910903114,-84.24037456512451 33.119689372392806,-84.16698932647705 33.12119896253218,-84.03944492340088 33.223072176711646,-83.95395755767822 33.221707944680595,-83.76710414886475 33.369208714244394,-83.7661600112915 33.40102923261309,-83.87138859428424 33.493634468317246,-83.81152280628423 33.55489126855177,-83.80353783116196 33.554698369639816,-83.80353783116196 33.56317098221176,-83.80261577856116 33.564085642231284,-83.8021656961152 33.56413252691967,-83.8021656961152 33.56453211612927,-83.79907591409109 33.567597125743774,-83.79905058771362 33.567744715646896,-83.79718785744615 33.569597025871445,-83.79718769453356 33.569597187642735,-83.79718769476483 33.569597187642735,-83.79719087268145 33.56959725026669,-83.79718760387247 33.569600479883945,-83.79838932427909 33.56962378359338,-83.79838932427909 33.569740047434045,-83.79990208203515 33.569766842039066,-83.8021656961152 33.569827630003665,-83.8021656961152 33.57585231701821,-83.80422389868532 33.57599523146829,-83.8033663142811 33.588999455846874,-83.80559603373209 33.58928524096701,-83.80559603373209 33.60085874271436,-83.80490996620871 33.601430233425845,-83.8033663142811 33.623715416663686,-83.80782575318308 33.62385825181623,-83.80834030382562 33.61228783729619,-83.80872638072529 33.61225210854396,-83.80877375697825 33.61374537703404,-83.80873745211973 33.61978823044128,-83.80748271942139 33.63399894237652,-83.80748271942139 33.634427395972715,-83.80864866822309 33.63456608921711,-83.8080883026123 33.7278375514204,-83.7866306304931 33.7321204874728,-83.7862873077392 33.7326915294623,-83.7861156463623 33.7322632483265,-83.7843990325927 33.7325487693212,-83.7323856353759 33.7426841490739,-83.732213973999 33.7442543120441,-83.7310123443603 33.74468253332,-83.7227725982666 33.7445397931323,-83.6676692962646 33.7552446479486,-83.6669826507568 33.7568145809432,-83.6649227142334 33.756957300699,-83.6647510528564 33.7561009786006,-83.6633777618408 33.7561009786006,-83.6475849151611 33.7592407844763,-83.6482715606689 33.8513856127035,-83.8275754226885 33.85513355791846,-83.8275501944802 33.85536729056149,-83.83129565682832 33.8557561295505,-83.78336906433105 33.88659122617693,-83.76688957214355 33.88587870592943,-83.76603126525879 33.98699697606636,-83.76931058875978 33.987022872220784,-83.7490430439492 34.00267818454505,-83.64711284637451 33.915478908148366,-83.64737033843994 33.9032981198015,-83.63123416900635 33.88299293807057,-83.55510234832764 33.8499956195856,-83.54068279266357 33.81491754086023,-83.5376787185669 33.809854272019145,-83.44995975494385 33.77461703628178,-83.44695568084717 33.77426030996451,-83.44704151153564 33.77347550683796,-83.431077003479 33.77725676486296,-83.42747211456299 33.779254343232445,-83.42764377593994 33.780253114947854,-83.42498302459717 33.78089517632915,-83.42506885528564 33.78167991148108,-83.42343807220459 33.78146589351633,-83.4171724319458 33.784961453304234,-83.38687419891357 33.7968024933337,-83.38550090789795 33.79808636311057,-83.38352680206299 33.79815768864465,-83.38318347930908 33.7991562398809,-83.3812952041626 33.799013590417516,-83.36799144744873 33.80422014179627,-83.30533504486084 33.836949966753664,-83.2505750656128 33.87893132165219,-83.23984622955322 33.89004686495183,-83.22971820831299 33.902514500728934,-83.22980403900146 33.90386802005763,-83.22825908660889 33.90429544274963,-83.22774410247803 33.90564893380339,-83.22611331939697 33.906931168663235,-83.20448398590088 33.93356879543034,-83.18628787994385 33.96446939658514,-83.1791639328003 33.985466855532835,-83.17221164703369 34.062294647776454,-83.17229747772217 34.06329010689234,-83.19590091705322 34.085827015146165,-83.2084321975708 34.095422931402005,-83.34893703460693 34.14700897818791,-83.3549451828003 34.15375688963505,-83.40016880669104 34.2758303445348,-83.3948564529419 34.28002078078785,-83.41331005096436 34.286970795241245,-83.65500926971436 34.287254457092466,-83.66779804229736 34.31306367686605,-83.68427753448486 34.342266740026,-83.74110848004483 34.29797689604221,-83.74019610452991 34.35426286075068,-83.74021213701118 34.35426506565391,-83.74019610013654 34.35526011593728,-83.74234899568803 34.35804422266522,-83.74277009895376 34.35865228381865,-83.75673750028577 34.376651317852854,-83.75924341504098 34.37989194609645,-83.75926101895718 34.37990323976539,-83.76078779192514 34.38187070944423,-83.76078779192514 34.38187350268598,-83.7611859990874 34.38238385745909,-83.78000721828539 34.406637743837614,-83.78025195195042 34.40681937989462,-83.78187253060538 34.40889636426392,-83.78189481419624 34.409043370162216,-83.78767406169894 34.41633178824798,-83.78772858868186 34.416401671737376,-83.78812134410857 34.41641153210681,-83.89028598851462 34.41907023133361,-83.8438367843628 34.4557218032159,-83.84907245635986 34.45579257605265,-84.04588222503662 34.455155618362454,-84.12012577056885 34.4543771079208,-84.24123287200928 34.360478065560066,-84.25857067108154 34.34977850540455,-84.26389217376709 34.34744000908005,-84.29745197296143 34.336455290073765,-84.42319393157959 34.34850297004076,-84.4279146194458 34.350345403781446,-84.45383548736572 34.3710345708007,-84.4707441329956 34.37974799906729,-84.58592891693115 34.376347744669054,-84.65811252593994 34.32100337957915,-84.6710729598999 34.30292528635627,-84.6710729598999 34.30164903857466,-84.67210292816162 34.301436328725515,-84.67321872711182 34.29994734469774,-84.7406816482544 34.20544930169491,-84.66401968871665 34.14012064778763,-84.67060928893602 34.13279527622302,-84.67078088856428 34.13180147295538,-84.67163888670557 34.13165950010613,-84.69119534965195 34.10966154253311,-84.74514070447981 34.110667743702116,-84.74671109181762 34.10990574958218,-84.79917532247262 34.110810185410706,-84.79917532247262 34.110806892155296,-84.79934698383909 34.11080987193478,-84.79934698383909 34.08436540087182,-84.80160005800013 34.083272148766966,-84.80341416254085 34.076002429774626,-84.81043107648884 34.04788332668517,-84.81790291084036 34.017941206551576,-84.80353483436086 33.999542448512706,-84.80339109812107 33.999358389894894,-84.80314453879552 33.99904266319485,-84.82699818663541 33.977723470613775,-84.82768462254448 33.97701273875627,-84.82768462254448 33.97516480812015,-84.82905749436262 33.97573340643993,-84.8311168020898 33.97402760007304,-84.84524080534064 33.961194578554384,-84.8510205396477 33.95594313153772,-84.86171282535385 33.94622815695766,-84.86345885103923 33.944641723933344,-84.91779342802035 33.944641723933344))

Are you happy to reopen this issue or should I create a new one?

peterstace commented 4 months ago

Hey @simoncochrane , I'll reopen, thanks for reporting these!