2: Lines

Global rail lines

Back to home

This map uses Leaflet to display global 10m railroad data from Natural Earth. The map is loading a raster tileset, which I created by uploading the data to Mapbox Studio, creating a map style, and using Mapbox's Static Tiles API. A cool thing: the style has a style across a zoom range, starting as a salmon color at zoom 3 and becoming purple by zoom 8. When raster tiles are created from this data, each zoom's tiles have a different color: closer to 3 and the color is salmon, closer to 8 and the color is purple. So neat!

A note: I used Leaflet here to load a Mapbox style as a raster tileset to show how to do it. In most other cases, if I really wanted to create a map to show railroad data I would do it with Mapbox GL JS so the data could be interactive. Loading a Mapbox style as a raster tileset is useful if you're locked into using a web mapping library that requires raster tiles, but for the most part you can make complex data interactive by using Mapbox GL JS or another library that consumes vector tiles and allows for interactions. But for this challenge I'm trying to broaden my horizons and use lots of different tools, and "lines" seemed like a good prompt to show off an example that I might not make in real life but demonstrates the concept.