bash /path/to/shp2geojson.sh /path/to/input.shp unique_column /path/to/output-dir
/path/to/shp2geojson.sh
- the relative or full path to theshp2geojson.sh
script/path/to/input.shp
- the relative or full path to the shapefile that contains multiple featuresunique_column
- the column in the attribute table of the shapefile which contains unique entries that can serve as identifiers such as IDs. If your shapefile does not contain a column with unique IDs, I would suggest not to use this literature and use the alternative guide instead./path/to/output-dir
- the relative or full path to the directory/folder where you want the GeoJSON files to be stored. You don't need to create this folder beforehand. The script can create the folder if it currently does not exist.
bash shp2geojson.sh /Users/john/Downloads/input.shp id /Users/john/Desktop/geojsons
-
Download the shp2geojson.sh script 😋
-
Open the Terminal app 🤓
-
Issue the command 😎
bash /Users/john/Downloads/shp2geojson.sh /Users/john/Downloads/input.shp id /Users/john/Desktop/geojsons
Replace the certain parts of the command depending on your case. See the Parameters section for reference.
- Using GeoJSON with Leaflet, Leaflet Tutorials, leafletjs.com
- Data Layer, Maps JavaScript API, developers.google.com