Skip to content

Instantly share code, notes, and snippets.

@joshuapowell
Last active August 29, 2015 14:11
Show Gist options
  • Save joshuapowell/c7b93dda9e4d274d21b9 to your computer and use it in GitHub Desktop.
Save joshuapowell/c7b93dda9e4d274d21b9 to your computer and use it in GitHub Desktop.
Creating high density (1M+ Map Markers) map using a SHP file and Mapbox.com
#YOUR_LAYER_ID {
marker-opacity: 0.50;
image-filters: colorize-alpha(#00dfff, #00c9ff, #FFFFFF);
marker-allow-overlap: true;
marker-ignore-placement: true;
marker-width: 2;
[zoom < 15] {
marker-width: 2;
}
[zoom >= 10] {
marker-width: 4;
}
[zoom >= 15] {
marker-width: 6;
}
[zoom >= 16] {
marker-width: 8;
marker-opacity: 0.75;
}
[zoom >= 17] {
marker-width: 10;
marker-opacity: 0.75;
}
[zoom >= 18] {
marker-width: 12;
marker-opacity: 0.75;
}
[zoom >= 19] {
marker-width: 16;
marker-opacity: 0.75;
}
[zoom >= 20] {
marker-width: 24;
marker-opacity: 0.75;
}
[zoom >= 21] {
marker-width: 32;
marker-opacity: 0.75;
}
[zoom >= 22] {
marker-width: 48;
marker-opacity: 0.75;
}
}
## Convert your SHP File to a GeoJSON File
1. Download and Unzip your SHP file
2. Change to the SHP file directory
3. Convert the SHP file to a GeoJSON file
````
ogr2ogr -f "GeoJSON" my_file.geojson my_file.shp
````
## Convert your GeoJSON File to Mapbox Vector Tiles
To convert a GeoJSON Feature Collection to a Mabpox Vector Tiles file, use Tippecanoe.
````
tippecanoe -o my_file.mbtiles my_file.geojson
````
Alternately you can adjust the density of the pins using the `-r` option, lower number for density (0) for no drop, higher for sparser (2+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment