r/reactnative • u/Infamous_Start_1438 • 19h ago
Help me to implement offline maps
Is anyone here who has experience in implementing offline maps in a react native app while keeping app size minimum.
2
Upvotes
1
u/ChristophBuilds 18h ago
you could use maplibre react native with vector tiles, they're way smaller than raster.
i wouldnt bundle the map data in the app, better to let users download offline regions when they need them. if you host it yourself, pmtiles might be worth a look, its just one file on a cdn
1
u/Careless_Cycle5991 12h ago
+1 on maplibre. the setting that decides download size the most is max zoom on the offline pack. every extra zoom level is roughly 4x the tiles, and vector tiles usually stop at z14 and just overzoom after that, so cap the pack at 14 and keep the bounds tight to the area people actually need.
1
u/anarchos 6h ago
I’ll join in and say maplibre as well. A little more detail, though. You can generate vector tiles in the mbtile format. It’s tiles and a small SQLite db (the db is internal use only, no need to even think about it) zipped up into one file. Then you can just embed that file into your bundle. This is the way to go for having the map in your app without a separate download. If you want to have user-defined arbitrary offline maps with coverage of the whole world (or a large area) this isn’t the best method.