I know it seems this is an idiot idea, but I just want to find a way to support reverse geocoding on an offline map for mobile. Currently, I successfully load pbf files of a specific area that were got from a large mbtiles file on server (using xyz url, e.g. https://myserver.com/data/14/13047/7696.pbf) and then able to render the offline map on a mobile device with these vector tiles. Now, I want to find a way to allow user to save the POI of a specific coordinate which already showed on the map. But the POI was rendered by mapbox gl so I can't get data from it. Is it possible to read information from mbtiles or pbf files? Because I think they have all needed information. Or may you advise some other way to achieve offline reverse geocoding? I found that ArcGis have something similar (https://developers.arcgis.com/android/kotlin/sample-code/offline-geocode/) that they call locator files, but it seems I must use these tiles server instead of my own tiles server. Thank you so much! asked 03 Feb '21, 10:20 bahung1221 |
Yes, it is. Your favourite programming language will probably have a protobuf decoder, which you can use to extract data from the pbf vector tile (https://github.com/mapbox/vector-tile-spec). You can then reconstitute the geometries and the tags from here. I've done this successfully in the past (in Swift for iOS) and it's reasonably easy. But you do need to know your way around the vector tile format. answered 03 Feb '21, 12:31 Richard ♦ Glad to hear it's possible, so I just need to determine the pbf file that contain specific POI from coordinate, and then I will able to get all the tags from it. I will try it, thank you so much!
(04 Feb '21, 07:54)
bahung1221
No problem. Do come back here if you encounter any issues.
(04 Feb '21, 08:43)
Richard ♦
|
https://github.com/mapbox/carmen/ can index data from geojson or mbtiles and use mbtiles as storage. The backend has an abstraction and anything following the https://github.com/mapbox/tilelive#awesome-tilelive-modules API standard can be used, e.g. locally stored mbtile files. answered 03 Feb '21, 13:52 mtmail |