Mapshaper is a program for simplifying cartographic lines while preserving the topological relationships between adjacent polygons and intersecting polyline paths. It can read and write Shapefile, GeoJSON and TopoJSON files. The current version can be found at mapshaper.org.
This software is loosely based on the original MapShaper program that I wrote at the University of Wisconsin, Madison in 2006-2007. That version is still available here.
The new mapshaper was rewritten from scratch in JavaScript and improves on the original in a few ways. The earlier program sent data to a server to be processed; the new version does all its processing locally, so the program can be used offline and user data stays private. The new version has a better algorithm for topology processing. There is also a command line tool.
Mapshaper requires Node.js.
With Node installed, you can install the latest release version from the npm registry. Install with the "-g" flag to make the executable scripts available systemwide.
npm install -g mapshaper
To install and run the latest development code from github:
git clone git@github.com:mbloch/mapshaper.git
cd mapshaper
npm install
bin/mapshaper-gui # or bin/mapshaper
The mapshaper distribution includes the script mapshaper-gui, which runs mapshaper's web interface locally. You can also visit mapshaper.org to use mapshaper online.
Browser compatibility: mapshaper works well in recent versions of Chrome and Firefox. Large files (say, >200MB) may cause out-of-memory errors in Chrome. Exporting is not supported in Safari. Mapshaper appears to work in Opera 15+ and Internet Explorer 11.
The mapshaper script runs well in OS X and has also been used successfully on Ubuntu 13.04 and Windows 8.
$ mapshaper -p 0.1 counties.shp Retain 10% of removable vertices using default simplification.
$ mapshaper -i 100 states.shp --dp Remove features smaller than ~100 meters using Douglas-Peucker simplification.
$ mapshaper -h Read a help message.
You will need to regenerate mapshaper.js if you edit any of the files in the src/ or lib/ directories. Run $ build to update mapshaper.js (used by the command line tool); run $ build gui to update www/mapshaper.js (used by the web interface).
$ build [gui] -f continuously monitors source files and regenerates mapshaper.js whenever a source file is modified.
Run $ mocha in the project directory to run mapshaper's tests.
This software is licensed under the MPL 2.0
According to Mozilla's FAQ, "The MPL's "file-level" copyleft is designed to encourage contributors to share modifications they make to your code, while still allowing them to combine your code with code under other licenses (open or proprietary) with minimal restrictions."
To suggest additions to this list, add an issue.
- Import Shapefile attribute table (.dbf file)
- Selection and aggregation, using attribute queries and mouse selection
- Ability to heal minor topological problems in source data
- Ability to prevent or remove polygon overlaps and self-intersections
- Update the original "modified Visvalingam" method, add control over degree of smoothing.
- Experiment with new simplification and smoothing methods.