Converting osm maps to mbtiles

217 views Asked by At

I am working on an project which is completely offline (windows), the frontend is in react where i display a base map using react-leaflet library, and i serve the base map through a node backend from XYZ directory files stored locally. I'm trying to find a better solution to serve the map files for my frontend. The XYZ directory files stored locally are huge and its a pain when my end user need a new map displayed in the frontend. As of right now, i create new maps using QGIS as XYZ directory and send it to them, and they would have to copy the entire folder to the project directory. I'm looking for a solution where they can upload the map file (like osm or any other readily available format) from the frontend and the node backend do the conversion. This way my clients don't have to access the project directory directly.

So i guess what i am looking for is a solution to convert osm file to mbtiles format or xyz directory files format in my node backend so that it can be served to my react app. Is this possible ?

PS: I'm a beginner and new to GIS.

I tried using tilerser-gl and i was able to use mbtiles, which is a better option than xyz files because of smaller size. But i would rather have the user download the osm file from geofabrik and upload it from the frontend whenever they need a new map.

1

There are 1 answers

0
ianthetechie On

If you're wanting to generate your own map tiles, check out planetiler, which is specifically designed for generating MBTiles (or similar container formats) for the planet from OSM data. This takes some rather significant resources, but it's possible if you really want to do this yourself and understand what schema you want.

You can also check out protomaps for a readily downloadable version if the tile schema suits you.

Finally, you could also go with a commercial offering like Stadia Maps or Mapbox (full disclosure, I'm a cofounder of Stadia Maps).

I see in your comment that you're also looking for satellite imagery. OSM indeed is just the "vector" info on the planet in database form (roads, points of interest, etc.). For imagery, the only free options are relatively low resolution. If you want reasonably up-to-date high-res cloudless imagery, you'll probably need to pay either for a hosted solution or buy imagery from a vendor like Maxar, SI Imaging, Airbus, or Planet. Buying imagery is not cheap, but could make sense for an offline solution if you have a fairly small area of interest.