mapshaper 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +5 -3
  2. package/mapshaper.js +363 -62
  3. package/package.json +6 -2
  4. package/www/.nojekyll +0 -0
  5. package/www/assets/jetbrains-mono-regular.woff2 +0 -0
  6. package/www/assets/static-page.css +179 -0
  7. package/www/docs/_assets/cmd-search.js +213 -0
  8. package/www/docs/_assets/docs.css +722 -0
  9. package/www/docs/_assets/docs.js +75 -0
  10. package/www/docs/_assets/highlight.css +10 -0
  11. package/www/docs/essentials/command-line.html +127 -0
  12. package/www/docs/essentials/command-line.html.md +112 -0
  13. package/www/docs/essentials/web-app.html +138 -0
  14. package/www/docs/essentials/web-app.html.md +106 -0
  15. package/www/docs/examples/basics.html +275 -0
  16. package/www/docs/examples/basics.html.md +370 -0
  17. package/www/docs/examples/data/Makefile +31 -0
  18. package/www/docs/examples/data/globe.msx +0 -0
  19. package/www/docs/examples/data/globe.svg +616 -0
  20. package/www/docs/examples/data/globe.txt +21 -0
  21. package/www/docs/examples/data/globe.zip +0 -0
  22. package/www/docs/examples/data/ne_50m_admin_0_countries.geojson +1 -0
  23. package/www/docs/examples/data/ne_50m_admin_1_states_provinces_lakes.geojson +1 -0
  24. package/www/docs/examples/data/us-states.msx +0 -0
  25. package/www/docs/examples/data/us-states.svg +56 -0
  26. package/www/docs/examples/data/us-states.txt +6 -0
  27. package/www/docs/examples/data/us-states.zip +0 -0
  28. package/www/docs/examples/globe.html +108 -0
  29. package/www/docs/examples/globe.html.md +64 -0
  30. package/www/docs/examples/us-states.html +88 -0
  31. package/www/docs/examples/us-states.html.md +44 -0
  32. package/www/docs/formats/csv.html +127 -0
  33. package/www/docs/formats/csv.html.md +97 -0
  34. package/www/docs/formats/dbf.html +87 -0
  35. package/www/docs/formats/dbf.html.md +39 -0
  36. package/www/docs/formats/flatgeobuf.html +85 -0
  37. package/www/docs/formats/flatgeobuf.html.md +41 -0
  38. package/www/docs/formats/geojson.html +107 -0
  39. package/www/docs/formats/geojson.html.md +65 -0
  40. package/www/docs/formats/geopackage.html +87 -0
  41. package/www/docs/formats/geopackage.html.md +42 -0
  42. package/www/docs/formats/json.html +83 -0
  43. package/www/docs/formats/json.html.md +35 -0
  44. package/www/docs/formats/kml.html +82 -0
  45. package/www/docs/formats/kml.html.md +39 -0
  46. package/www/docs/formats/overview.html +191 -0
  47. package/www/docs/formats/overview.html.md +34 -0
  48. package/www/docs/formats/shapefile.html +123 -0
  49. package/www/docs/formats/shapefile.html.md +84 -0
  50. package/www/docs/formats/snapshot.html +87 -0
  51. package/www/docs/formats/snapshot.html.md +39 -0
  52. package/www/docs/formats/svg.html +99 -0
  53. package/www/docs/formats/svg.html.md +51 -0
  54. package/www/docs/formats/topojson.html +102 -0
  55. package/www/docs/formats/topojson.html.md +54 -0
  56. package/www/docs/gallery/index.html +80 -0
  57. package/www/docs/gallery/index.html.md +29 -0
  58. package/www/docs/guides/combining-layers.html +109 -0
  59. package/www/docs/guides/combining-layers.html.md +89 -0
  60. package/www/docs/guides/expressions.html +600 -0
  61. package/www/docs/guides/expressions.html.md +376 -0
  62. package/www/docs/guides/programmatic.html +117 -0
  63. package/www/docs/guides/programmatic.html.md +91 -0
  64. package/www/docs/guides/projections.html +158 -0
  65. package/www/docs/guides/projections.html.md +118 -0
  66. package/www/docs/guides/simplification.html +110 -0
  67. package/www/docs/guides/simplification.html.md +96 -0
  68. package/www/docs/guides/topology.html +90 -0
  69. package/www/docs/guides/topology.html.md +63 -0
  70. package/www/docs/images/cal-counties.png +0 -0
  71. package/www/docs/images/simplification-detail.png +0 -0
  72. package/www/docs/images/simplification-dp.png +0 -0
  73. package/www/docs/images/simplification-mod2.png +0 -0
  74. package/www/docs/images/tiger-counties.png +0 -0
  75. package/www/docs/index.html +101 -0
  76. package/www/docs/index.html.md +59 -0
  77. package/www/docs/reference.html +1302 -0
  78. package/www/docs/reference.html.md +1817 -0
  79. package/www/docs/whats-new.html +77 -0
  80. package/www/docs/whats-new.html.md +59 -0
  81. package/www/index.html +47 -4
  82. package/www/llms-full.txt +4053 -0
  83. package/www/llms.txt +55 -0
  84. package/www/mapshaper-gui.js +299 -5
  85. package/www/mapshaper.js +363 -62
  86. package/www/page.css +189 -11
  87. package/www/privacy.html +1 -112
  88. package/www/sponsor.html +4 -164
  89. package/www/terms.html +1 -112
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Topology and cleaning
3
+ description: How Mapshaper detects shared boundaries between features, and how to fix the common topology errors that creep into Shapefile and GeoJSON datasets.
4
+ ---
5
+
6
+ # Topology and cleaning
7
+
8
+ Shapefile and GeoJSON are non-topological formats — they don't record the spatial relationships between adjacent polygons or intersecting polylines. Each polygon is just a list of coordinates; whether two polygons share an edge has to be detected.
9
+
10
+ Mapshaper detects topology on import by identifying coordinates that are exactly shared between features. This is what makes operations like simplification, dissolving and clipping work correctly: when two polygons share an edge, the shared path (or "arc") is stored once and edited once.
11
+
12
+ But coordinates that "should be" identical often aren't. Source datasets routinely contain misalignments (tiny gaps or overlaps between adjacent polygons) that defeat exact-match topology detection. The result is that what looks like a clean boundary turns into duplicated, slightly-offset arcs — and simplification, dissolving and clipping all start to misbehave.
13
+
14
+ ## Snapping
15
+
16
+ The simplest fix is to ask Mapshaper to snap nearby vertices together at import time.
17
+
18
+ In the **command line**, pass the `snap` flag to `-i`:
19
+
20
+ ```bash
21
+ mapshaper countries.shp snap -dissolve CONTINENT -o continents.shp
22
+ ```
23
+
24
+ In the **web app**, tick "snap vertices" in the import dialog (open the import options with the **with advanced options** checkbox).
25
+
26
+ By default, snapping uses an automatic threshold of about 0.0025× the average segment length, which is designed to catch misalignments caused by floating-point rounding. To set an explicit snapping distance, use `snap-interval=`:
27
+
28
+ ```bash
29
+ mapshaper countries.shp snap-interval=0.0001 -o cleaned.shp
30
+ ```
31
+
32
+ ## Cleaning
33
+
34
+ Snapping handles slightly offset pairs of vertices, but doesn't help much when adjacent polygons have small overlapping regions or gaps along their shared boundaries. The [`-clean`](/docs/reference.html.md#-clean) command repairs these by recomputing the polygon mosaic and snapping geometry that's nearly identical:
35
+
36
+ ```bash
37
+ mapshaper countries.shp -clean -o cleaned.shp
38
+ ```
39
+
40
+ `-clean` accepts a `gap-fill-area=` option to control how aggressively gaps are filled, and a `sliver-control=` setting for handling sliver polygons. [`-dissolve`](/docs/reference.html.md#-dissolve) runs an equivalent repair by default, so explicitly running `-clean` is mainly useful when you want clean output without dissolving anything.
41
+
42
+ In the web app, `-clean` runs from the **Console** the same way as on the CLI — the leading `-` is optional, e.g. just `clean gap-fill-area=100`.
43
+
44
+ ## Dissolving with topology repair
45
+
46
+ [`-dissolve`](/docs/reference.html.md#-dissolve) repairs topology automatically. To skip the repair pass (faster, but only safe when you trust the input topology), pass `no-repair` — Mapshaper will then warn if it detects segment intersections in the input.
47
+
48
+ ```bash
49
+ mapshaper counties.shp -dissolve STATE_FIPS -o states.shp
50
+ ```
51
+
52
+ ## Detecting line intersections
53
+
54
+ The web app can highlight self-intersections in your data: open the **Display** panel and tick "detect line intersections". Intersections often indicate either a topology error in the source data or self-intersections introduced by simplification — the **Repair** button at the top-left of the map attempts to fix the latter.
55
+
56
+ On the command line, [`-clean`](/docs/reference.html.md#-clean) and [`-dissolve`](/docs/reference.html.md#-dissolve) both detect and fix intersections.
57
+
58
+ ## Notes on common sources of topology errors
59
+
60
+ A few patterns to watch out for:
61
+
62
+ - **`.shp` files exported from older GIS tools.** Some pipelines round coordinates inconsistently between adjacent features, producing systematic misalignments. Importing with `snap` is usually enough.
63
+ - **Older versions of ArcGIS's dissolve tool** have been observed to produce topology errors when dissolving a Shapefile that hasn't first been added to a Geodatabase. If you're starting from such output, run it through `mapshaper input.shp -clean -o cleaned.shp` to repair before further processing.
Binary file
@@ -0,0 +1,101 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Mapshaper documentation &middot; mapshaper docs</title>
7
+ <meta name="description" content="Documentation for mapshaper, the command-line tool and web app for editing Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML and CSV data.">
8
+ <link rel="icon" type="image/png" href="/images/icon.png">
9
+ <link rel="stylesheet" href="/docs/_assets/highlight.css">
10
+ <link rel="stylesheet" href="/docs/_assets/docs.css">
11
+ </head>
12
+ <body class="is-home">
13
+
14
+ <header class="page-header">
15
+ <a href="/" class="mapshaper-logo">map<span class="logo-highlight">shaper</span></a>
16
+ <span class="header-section-label">Docs</span>
17
+ <nav class="header-nav">
18
+ <a href="/">Web app</a>
19
+ <a href="https://github.com/mbloch/mapshaper">GitHub</a>
20
+ <a href="/sponsor.html" class="sponsor-link"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg> Become a sponsor</a>
21
+ </nav>
22
+ </header>
23
+
24
+ <div class="docs-layout">
25
+
26
+ <aside class="docs-sidebar">
27
+ <div class="sidebar-inner">
28
+ <nav class="docs-nav"><ul class="top-links"><li><a href="/docs/" class="is-active">Home</a></li><li><a href="/docs/whats-new.html">What&#39;s new</a></li><li><a href="/docs/reference.html">Command reference</a></li><li><a href="/docs/gallery/">Gallery</a></li></ul><h2>Getting started</h2><ul><li><a href="/docs/essentials/command-line.html">The command-line tool</a></li><li><a href="/docs/essentials/web-app.html">The web app</a></li></ul><h2>Guides</h2><ul><li><a href="/docs/guides/simplification.html">Simplification</a></li><li><a href="/docs/guides/expressions.html">JavaScript expressions</a></li><li><a href="/docs/guides/projections.html">Projections</a></li><li><a href="/docs/guides/topology.html">Topology and cleaning</a></li><li><a href="/docs/guides/combining-layers.html">Combining two layers</a></li><li><a href="/docs/guides/programmatic.html">Using Mapshaper from Node.js</a></li></ul><h2>Formats</h2><ul><li><a href="/docs/formats/overview.html">Overview</a></li><li><a href="/docs/formats/shapefile.html">Shapefile</a></li><li><a href="/docs/formats/geojson.html">GeoJSON</a></li><li><a href="/docs/formats/topojson.html">TopoJSON</a></li><li><a href="/docs/formats/geopackage.html">GeoPackage</a></li><li><a href="/docs/formats/flatgeobuf.html">FlatGeobuf</a></li><li><a href="/docs/formats/kml.html">KML / KMZ</a></li><li><a href="/docs/formats/csv.html">CSV / TSV</a></li><li><a href="/docs/formats/dbf.html">DBF</a></li><li><a href="/docs/formats/json.html">JSON records</a></li><li><a href="/docs/formats/svg.html">SVG</a></li><li><a href="/docs/formats/snapshot.html">Mapshaper snapshot</a></li></ul><h2>Examples</h2><ul><li><a href="/docs/examples/basics.html">Basics</a></li><li><a href="/docs/examples/globe.html">Globe</a></li><li><a href="/docs/examples/us-states.html">U.S. state map</a></li></ul></nav>
29
+ </div>
30
+ </aside>
31
+
32
+ <main class="docs-main">
33
+ <article class="docs-article">
34
+
35
+ <h1 id="mapshaper-documentation">Mapshaper documentation</h1>
36
+ <p class="lead">Mapshaper is a tool for editing Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML and CSV data &mdash; available as a command-line program and as a web app at <a href="/">mapshaper.org</a>.</p><div class="section-cards">
37
+ <a class="section-card" href="/docs/essentials/command-line.html">
38
+ <p class="card-title">Getting started</p>
39
+ <p class="card-desc">Introductions to the CLI and the web app.</p>
40
+ </a>
41
+ <a class="section-card" href="/docs/guides/simplification.html">
42
+ <p class="card-title">Guides</p>
43
+ <p class="card-desc">Task-oriented walk-throughs: simplification, topology, joining layers, scripting from Node.</p>
44
+ </a>
45
+ <a class="section-card" href="/docs/formats/overview.html">
46
+ <p class="card-title">File formats</p>
47
+ <p class="card-desc">Read/write details for Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML, CSV and more.</p>
48
+ </a>
49
+ <a class="section-card" href="/docs/examples/basics.html">
50
+ <p class="card-title">Examples</p>
51
+ <p class="card-desc">Short recipes for common GIS tasks, plus a Gallery of full map examples with source data.</p>
52
+ </a>
53
+ </div><h2 id="featured-examples">Featured examples</h2>
54
+ <div class="featured-maps">
55
+ <a class="gallery-tile" href="/docs/examples/globe.html">
56
+ <div class="gallery-tile-image">
57
+ <img src="/docs/examples/data/globe.svg" alt="Globe locator map">
58
+ </div>
59
+ <div class="gallery-tile-caption">
60
+ <div class="gallery-tile-title">Globe locator map</div>
61
+ </div>
62
+ </a>
63
+ <a class="gallery-tile" href="/docs/examples/us-states.html">
64
+ <div class="gallery-tile-image">
65
+ <img src="/docs/examples/data/us-states.svg" alt="U.S. state map">
66
+ </div>
67
+ <div class="gallery-tile-caption">
68
+ <div class="gallery-tile-title">U.S. state map</div>
69
+ </div>
70
+ </a>
71
+ </div><p class="featured-maps-link"><a href="/docs/gallery/">See the full gallery &rarr;</a></p><h2 id="whats-new">What&#39;s new</h2>
72
+ <p>A curated log of recently added features is at <a href="/docs/whats-new.html">What&#39;s new</a>. The full <a href="https://github.com/mbloch/mapshaper/blob/master/CHANGELOG.md">changelog</a> is on GitHub.</p>
73
+ <h2 id="help-and-feedback">Help and feedback</h2>
74
+ <ul>
75
+ <li>Found a bug or want to request a feature? <a href="https://tally.so/r/44Njok">Share feedback</a> or <a href="https://github.com/mbloch/mapshaper/issues">open an issue on GitHub</a>.</li>
76
+ <li>Mapshaper is free software. If it&#39;s useful to you, please consider <a href="/sponsor.html">supporting its development</a>.</li>
77
+ </ul>
78
+
79
+ <div class="edit-link">
80
+ <a href="https://github.com/mbloch/mapshaper/edit/master/docs/index.md">Edit this page on GitHub</a>
81
+ </div>
82
+ </article>
83
+ </main>
84
+
85
+ <aside class="docs-toc">
86
+ <div class="docs-toc-title">On this page</div><ul><li class="lvl-2"><a href="#featured-examples">Featured examples</a></li><li class="lvl-2"><a href="#whats-new">What&#39;s new</a></li><li class="lvl-2"><a href="#help-and-feedback">Help and feedback</a></li></ul>
87
+ </aside>
88
+
89
+ </div>
90
+
91
+ <script src="/docs/_assets/docs.js" defer></script>
92
+
93
+ <footer class="docs-footer">
94
+ <div class="docs-footer-inner">
95
+ <span>mapshaper is free software, licensed under <a href="https://www.mozilla.org/MPL/2.0/">MPL 2.0</a>.</span>
96
+ <span><a href="/privacy.html">Privacy</a> &middot; <a href="/terms.html">Terms</a> &middot; <a href="/sponsor.html">Support mapshaper</a></span>
97
+ </div>
98
+ </footer>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: Mapshaper documentation
3
+ description: Documentation for mapshaper, the command-line tool and web app for editing Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML and CSV data.
4
+ ---
5
+
6
+ # Mapshaper documentation
7
+
8
+ <p class="lead">Mapshaper is a tool for editing Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML and CSV data &mdash; available as a command-line program and as a web app at <a href="/">mapshaper.org</a>.</p>
9
+
10
+ <div class="section-cards">
11
+ <a class="section-card" href="/docs/essentials/command-line.html">
12
+ <p class="card-title">Getting started</p>
13
+ <p class="card-desc">Introductions to the CLI and the web app.</p>
14
+ </a>
15
+ <a class="section-card" href="/docs/guides/simplification.html">
16
+ <p class="card-title">Guides</p>
17
+ <p class="card-desc">Task-oriented walk-throughs: simplification, topology, joining layers, scripting from Node.</p>
18
+ </a>
19
+ <a class="section-card" href="/docs/formats/overview.html">
20
+ <p class="card-title">File formats</p>
21
+ <p class="card-desc">Read/write details for Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML, CSV and more.</p>
22
+ </a>
23
+ <a class="section-card" href="/docs/examples/basics.html">
24
+ <p class="card-title">Examples</p>
25
+ <p class="card-desc">Short recipes for common GIS tasks, plus a Gallery of full map examples with source data.</p>
26
+ </a>
27
+ </div>
28
+
29
+ ## Featured examples
30
+
31
+ <div class="featured-maps">
32
+ <a class="gallery-tile" href="/docs/examples/globe.html">
33
+ <div class="gallery-tile-image">
34
+ <img src="/docs/examples/data/globe.svg" alt="Globe locator map">
35
+ </div>
36
+ <div class="gallery-tile-caption">
37
+ <div class="gallery-tile-title">Globe locator map</div>
38
+ </div>
39
+ </a>
40
+ <a class="gallery-tile" href="/docs/examples/us-states.html">
41
+ <div class="gallery-tile-image">
42
+ <img src="/docs/examples/data/us-states.svg" alt="U.S. state map">
43
+ </div>
44
+ <div class="gallery-tile-caption">
45
+ <div class="gallery-tile-title">U.S. state map</div>
46
+ </div>
47
+ </a>
48
+ </div>
49
+
50
+ <p class="featured-maps-link"><a href="/docs/gallery/">See the full gallery &rarr;</a></p>
51
+
52
+ ## What's new
53
+
54
+ A curated log of recently added features is at [What's new](/docs/whats-new.html.md). The full [changelog](https://github.com/mbloch/mapshaper/blob/master/CHANGELOG.md) is on GitHub.
55
+
56
+ ## Help and feedback
57
+
58
+ - Found a bug or want to request a feature? [Share feedback](https://tally.so/r/44Njok) or [open an issue on GitHub](https://github.com/mbloch/mapshaper/issues).
59
+ - Mapshaper is free software. If it's useful to you, please consider [supporting its development](/sponsor.html).