Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bradbrowne/ac2228f57d6f0736ef6a953c692b4b4a to your computer and use it in GitHub Desktop.
Save bradbrowne/ac2228f57d6f0736ef6a953c692b4b4a to your computer and use it in GitHub Desktop.
🎗Convert MapInfo TAB file to MapBox Vector Tiles by using OGR to create GeoJSON and then Tippecanoe to create MBTiles SQLite database containing MapBox Vector Tiles.

Convert MapInfo TAB file to MapBox Vector Tiles

Install GDAL

OSGeo4Mac

brew tap osgeo/osgeo4mac

brew link autoconf automake

brew install gdal2

export PATH=$PATH:/usr/local/opt/gdal2/bin
export LDFLAGS=-L/usr/local/opt/gdal2/lib
export CPPFLAGS=-I/usr/local/opt/gdal2/include

Convert TAB file to GeoJSON

ogr2ogr -f GeoJSON STATE_ASSEMBLY_2013.json STATE_ASSEMBLY_2013.tab

Convert GeoJSON to MapBox Vector Tiles

Tippecanoe

brew install tippecanoe

tippecanoe -f -pp -o STATE_ASSEMBLY_2013.mbtiles STATE_ASSEMBLY_2013.json

The -pp argument is necessary to ensure that large polygons that cross tile boundaries are do not create vertical and horizontal visual artifacts.

View MapBox Vector Tiles

MBView

npm install -g mbview

export MAPBOX_ACCESS_TOKEN='pk.0000.1111' # a mapbox public token

mbview STATE_ASSEMBLY_2013.mbtiles

@bradbrowne
Copy link
Author

bradbrowne commented Jan 29, 2017

Below is an example of the vertical and horizontal visual artifacts caused by large polygons that cross tile boundaries:

tippecanoe-pp

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