How to build vector tiles from scratch
6 days ago
- #geojson
- #map-optimization
- #vector-tiles
- The NYC Chaos Dashboard is optimizing map rendering by switching from GeoJSON to vector tiles for better performance.
- Vector tiles are binary files representing geographic data in small, manageable chunks (tiles) for efficient loading.
- The process involves converting coordinates from EPSG:4326 to Web Mercator (EPSG:3857) and determining the correct tile for each feature.
- Vector tiles use Protobuf for binary encoding, making them more efficient than human-readable GeoJSON.
- The implementation in Go includes utility functions for coordinate conversion, tile identification, and MVT file generation.
- Properties in vector tiles are stored as tags in layers, reducing redundancy compared to GeoJSON.
- Performance improvements include reduced file size (3.7Mb vs. 4.5Mb) and faster paint times (200ms decrease).
- Future work includes handling lines and polygons, migrating to AWS for faster tile delivery, and open-sourcing the Go code.