Last active
March 9, 2021 20:07
-
-
Save joshuapowell/1fb8f9feff0a3e607c8c to your computer and use it in GitHub Desktop.
Revisions
-
joshuapowell revised this gist
Feb 3, 2016 . 1 changed file with 13 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,18 @@ This tutorial assumes you have either a SHP file or GeoJSON file with your data Unzip and change into the Shapefile directory into terminal ogr2ogr -f "GeoJSON" my_file.geojson my_file.shp #### Convert your GeoJSON to MBTILES 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: #### Alternative: CSV to GeoJSON Alternatively, you can accomplish the same results by converting a CSV to GeoJSON if you do not have a Shapefile. @@ -54,10 +65,4 @@ After you have the `.dbf` and `.vrt` file available, you can convert the results ``` ``` -
joshuapowell revised this gist
Feb 3, 2016 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,28 @@ For files larger than a few thousand lines, you will need to convert the CSV int 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. ``` ``` #### Convert your GeoJSON to MBTILES tippecanoe -r 1.1 -o my_file.mbtiles my_file.geojson -
joshuapowell revised this gist
Feb 3, 2016 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,24 @@ This tutorial assumes you have either a SHP file or GeoJSON file with your data Unzip and change into the Shapefile directory into terminal ogr2ogr -f "GeoJSON" my_file.geojson my_file.shp #### Alternative: CSV to GeoJSON 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](https://github.com/mapbox/csv2geojson) 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 ``` #### Convert your GeoJSON to MBTILES -
joshuapowell revised this gist
Jan 5, 2015 . No changes.There are no files selected for viewing
-
joshuapowell created this gist
Jan 5, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # Import Millions of Features Into Mapbox 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. #### Prerequisites 1. OGR 2. Brew 3. Tippecanoe 4. Mapbox.com Account 5. Mapbox Studio #### Convert your Shapefile (SHP) to GeoJSON Unzip and change into the Shapefile directory into terminal ogr2ogr -f "GeoJSON" my_file.geojson my_file.shp #### Convert your GeoJSON to MBTILES 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.