This tutorial assumes you have either a SHP file or GeoJSON file with your data ready to go and project at WGS1984 (i.e., 4326). It also assumes you are operating under a Unix environment.
- OGR
- Brew
- Tippecanoe
- Mapbox.com Account
- Mapbox Studio
Unzip and change into the Shapefile directory into terminal
ogr2ogr -f "GeoJSON" my_file.geojson my_file.shp
tippecanoe -r 1.1 -o my_file.mbtiles my_file.geojson
Finally, you'll want to login to your Mapbox.com account, visit the Data page, and upload your newly created my_file.mbtiles file.
===
Work in Progress:
Alternatively, you can accomplish the same results by converting a CSV to GeoJSON if you do not have a Shapefile.
You will need to install Mapbox's csv2geojson
tool
Once installed you will be able to run the folowing command:
csv2geojson --lat='Latitude' --lon='Longitude' data.csv > data.geojson
For files larger than a few thousand lines, you will need to convert the CSV into a Shapefile with ogr2ogr
ogr2ogr -f "Esri Shapefile" ./ ./data.csv
This will generate a .dbf
file. You will then need to create a new VRT file to convert the .dbf
into the final Shapefile.
Create a file called dataSource.vrt
with the following content:
<OGRVRTDataSource>
<OGRVRTLayer name="mylayer1">
<SrcDataSource relativeToVRT="1">/my_dir</SrcDataSource>
<SrcLayer>sample1</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="long" y="lat"/>
</OGRVRTLayer>
</OGRVRTDataSource>
After you have the .dbf
and .vrt
file available, you can convert the results into your final Shapefile.