Skip to content

Instantly share code, notes, and snippets.

@getflourish
Last active March 3, 2017 11:22
Show Gist options
  • Save getflourish/e6e25387f01bfb7f7190f21fac486364 to your computer and use it in GitHub Desktop.
Save getflourish/e6e25387f01bfb7f7190f21fac486364 to your computer and use it in GitHub Desktop.
Swiss Topo 2 Mapbox

Requirements

  • brew install gdal
  • brew install tippecanoe

1. Reproject

Shapefiles from Swiss sources might be available in EPSG:2056 (LV95) projection. To use these files in Mapbox, they need to be converted to EPSG:4326:

ogr2ogr -f "ESRI Shapefile" reprojected.shp original.shp -t_srs EPSG:4326 -s_srs EPSG:2056

2. Shapefile to GeoJSON

In order to change zoom levels or other things, we want to use tippecanoe which requires a GeoJSON file. We need to convert our re-projected file:

ogr2ogr GeoJSON output.json reprojected.shp -progress -f

3. Modify Zoom

Now we can use tippecanoe to modify zoom levels. For more options, see: https://github.com/mapbox/tippecanoe

tippecanoe -o final.mbtiles output.json -z 14 -Z 6 -f

4. Upload to Mapbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment