Deconstruct polygon
mofada opened this issue · comments
Please provide the following when reporting an issue:
-
"@turf/turf": "^6.5.0"
- GeoJSON data as a gist file or geojson.io (filename extension must be
.geojson
). - Snippet of source code or for complex examples use jsfiddle.
how can i deconstruct polygon
I want to disassemble the polygon and disassemble the complete polygon below into polygons with multiple shaded parts. Is there any good way?
This means removing the parts where they overlap
example one
the code show with svg
<path stroke-linejoin="round" stroke-linecap="round" fill-rule="evenodd" stroke="#394381" stroke-width="5" stroke-dasharray="none" fill="#394381" stroke-opacity="1" fill-opacity="0.15" style="cursor: pointer; user-select: none;" d="M 455 350 L 447 472 631 469 632 457 607 421 603 399 531 402 529 477 535 505 536 572 575 558 612 553 789 549 825 544 825 494 819 440 797 370 764 377 738 375 755 499 755 535 745 581 721 588 622 594 622 562 616 530 617 517 624 513 673 504 724 503 911 480 903 423 891 416 791 415 735 422 695 419 695 376 688 316 586 316 582 367 482 373 479 427 398 423 395 356 455 350"></path>
geojson
{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[120.19970162302431,30.257965153582777],[120.19941416526112,30.254159311796954],[120.20602569381455,30.254252899856724],[120.20606162603495,30.254627251195146],[120.20516332052497,30.25575029656396],[120.20501959164338,30.256436595682302],[120.20243247177464,30.256343009724105],[120.20236060733384,30.25400333149719],[120.20257620065624,30.253129837195207],[120.20261213287664,30.251039658268134],[120.2040134894722,30.25147641578633],[120.20534298162697,30.251632400138938],[120.21170298463761,30.2517571874409],[120.21299654457198,30.251913171343205],[120.21299654457198,30.253472996606657],[120.21278095124958,30.25515757979106],[120.2119904424008,30.25734125530119],[120.21080467912763,30.25712288995689],[120.20987044139726,30.257185280105304],[120.21048128914404,30.253317015206104],[120.21048128914404,30.252193941736916],[120.21012196694005,30.25075888454217],[120.20925959365047,30.25054050441716],[120.20570230383096,30.250353321062605],[120.20570230383096,30.251351628124123],[120.20548671050857,30.252349924938734],[120.20552264272897,30.252755480092652],[120.20577416827176,30.252880265953618],[120.20753484707132,30.253161033555376],[120.20936739031167,30.253192229905533],[120.2160867155263,30.253909743197248],[120.21579925776311,30.255687905494828],[120.21536807111832,30.255906274061633],[120.21177484907841,30.25593746953114],[120.20976264473606,30.255719101034405],[120.2083253559201,30.255812687593053],[120.2083253559201,30.257154085036102],[120.2080738303773,30.25902577147406],[120.2044087438966,30.25902577147406],[120.204265015015,30.257434840298636],[120.20067179297509,30.257247670213683],[120.20056399631389,30.255563123236495],[120.19765348646156,30.255687905494828],[120.19754568980036,30.257777984518633],[120.19970162302431,30.257965153582777]]]}}
example two
the code show with svg
<path stroke-linejoin="round" stroke-linecap="round" fill-rule="evenodd" stroke="#394381" stroke-width="5" stroke-dasharray="none" fill="#394381" stroke-opacity="1" fill-opacity="0.15" style="cursor: pointer; user-select: none;" d="M 560 70 L 555 79 552 106 550 201 564 212 733 209 810 201 978 202 982 192 977 160 958 119 895 110 892 129 901 190 905 304 882 314 830 315 808 302 800 280 782 143 767 126 747 124 737 130 731 152 723 256 706 289 676 292 664 278 643 236 638 187 609 123 605 100 574 86 560 70"></path>
the code of geojson
{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[120.18832458374015,30.26042000341602],[120.18814492263816,30.260139256773105],[120.18803712597696,30.259297011980273],[120.18796526153616,30.25633350008231],[120.18846831262175,30.255990350764787],[120.1945408578692,30.256083937062385],[120.19730763883993,30.25633350008231],[120.20334425186698,30.25630230473984],[120.20348798074858,30.256614257714126],[120.20330831964658,30.257612500506582],[120.202625607459,30.25889148410748],[120.20036187757385,30.259172234353407],[120.20025408091266,30.258579538439],[120.20057747089625,30.256676648188886],[120.20072119977785,30.253120327239188],[120.19989475870867,30.252808363056616],[120.19802628324791,30.25277716658332],[120.19723577439913,30.253182719955618],[120.19694831663594,30.253869037194452],[120.19630153666876,30.258142812821777],[120.19576255336277,30.258673122244634],[120.19504390895479,30.25873551139834],[120.1946845867508,30.25854834381711],[120.1944689934284,30.25786205960343],[120.19418153566521,30.254617741385548],[120.19357068791842,30.253588271636715],[120.19249272130645,30.25349468293734],[120.19206153466166,30.253931429430533],[120.19130695803328,30.255241657141553],[120.19112729693128,30.256770233825982],[120.19008526253971,30.258766705960184],[120.18994153365811,30.25948417812031],[120.18882763482574,30.25992089771259],[120.18832458374015,30.26042000341602]]]}}