Trailmap Generator
You might have seen my other blog post about the homemade trailmap I created in Mapbox Studio with data from OpenStreetMap. I have now finally created a static website that will generate and export these maps for any location in the world! The website is available at https://mathiash98.github.io/trail-map-generator and the source code is available on GitHub. The general implementation details: In Mapbox studio I created a plain style with close to zero data and labels, since I would like to render these myself with custom styling not accessible from Mapbox on low zoom levels. The user input the name of a relation that exists in OpenStreetMap. For example Eidfjord or Vestland. Then the site iterates through a list of predefined layers with their corresponding Overpass turbo queries. For example all peaks are downloaded with nwr[natural=peak]. Each layer is then downloaded from Overpass Turbo and converted to GeoJSON using osmtogeojson. Then each layer is added to the MapboxGL map as a source and layer with a specified style. Success! To enable export of data I installed the great package @watergis/mapbox-gl-export which enables exporting map to SVG, PNG, JPG in quite good resolution. ...