Tuesday, August 30, 2022

Host your own OpenStreetMap Map Tiles

Host Your Own OpenStreetMap Map Tiles

Download The OSM Dataset

First, download JOSM. Then click the downward green button.

Then click the "bounding box" tab. Write it down (left,bottom,right,up order).

Then click download

Then, file -> save as -> OSM server files (.osm)

Convert It To .mbtiles

Download MapTiler, open that .osm file, export, MBTiles, take notes at "layers" (you might have to write it down), continue, render.

Download Tileserver

Install nodejs, then

npm install -g tileserver-gl-light

Then, clone this github repository, open command line from that directory, execute

tileserver-gl-light kpatas.mbtiles -p 8083 -c a.json

Then open this link : http://localhost:8083/styles/rtnf-blue/#16.07/-6.28953/107.002293/-3.2/42


Bounding Box

We can use JOSM bounding box data to a.json bounding box data. But the order should be (left,bottom,right,up). Do not use JOSM's "copy bounds" feature.

Line Width

Adjusting line width is tricky. Open style.json, find "stops".

It means :

  • During zoom level 5.8, the line-width will be 0
  • During zoom level 6, the line-width will be 1
  • During zoom level 20, the line-width will be 1

Filter OSM Tag

Open style.json

This code will filter (highway:secondary) OSM tag.



from Hacker News https://ift.tt/iL9IdJc

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.