-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android offline maps, load vector tiles/geoson from local storage #626
Comments
I have achieved offline map tiles by storing simple .json map files into phone storage, instead of requesting htttpHandler, and reading and sending bytesArray data to Its an inefficient way but some how it works. Waiting for a proper solution! |
Nice tip! I agree that we can make it simpler and more efficient to load tiled data from a file system. @nomizodiac Do you have vector tiles in a specific directory structure on your device? If you can write the tile locations like a url template, then with a small change to the tangram-es code, we could redirect |
@blair1618 yes i got the point. I can load offline tiles now. I have deployed vectors tiles in same format z/x/y at phones local storage and in method |
@nomizodiac can you give me the sorce code to me i'm very need it thank you !!! |
Here is the hack we did for offline map data. In MapController class
The method |
@hak-tpl thank you very much for sharing! I'm working on a similar line, and am curious to learn a bit more about what you ended up doing. You mentioned you're using a "simple .json map files into phone storage" which I've been trying to replicate prior to coming across this thread here. I'm curious, for your scene.yaml then, are you just putting something to the effect of:
where citymap.geojson is a dump directly from Metro Extracts, for instance? I'm running into inexplicable crashes at the moment, perhaps due to memory overflows in trying to load the file in all at once, and am wondering if you've run into anything of the sort. Any more insights would be greatly appreciated! |
@msgrasser I didn't make any changes in |
@hak-tpl Thanks so much - after your comment here and reviewing your code above, that makes a lot more sense now. How do you go about generating each local json file in the first place then? Are you basically just hitting your server for every z/x/y combo, saving each tile as its own json file, and putting them all on Android's disk? And yes, I definitely understand this is a hack. I'm putting this together for a proof of concept, and am hoping by the time I need to scale this will be added as a feature to the Android SDK itself (like it is on iOS and OSX, for instance), which it sounds like Mapzen has in their roadmap [and really shouldn't take too much effort to redirect "file://" urls]. |
@msgrasser I had my vector tiles stored on my phone storage in z/x/y format. I had my server access, so I copied generated vector data from it and stored into phone storage manually. And yes it takes a lot of size on your storage. |
Have you considered storing your offline data in SQLite? This would keep everything together in one file. |
If i have vector tiles in Android local storage. How can i load those Tiles/GeoJson as datasource? In this link it is discussed before but there is no further discussion about how it could be implemented. Is there any further development in it? Loading geojson string is mentioned here that
The way to add something like a "marker" right now is through the MapData class. You would add some geometry and properties, either as a complete string of GeoJSON or as a point geometry and a map of properties. That data will then be styled according to the scene file
But how to load vector tiles directly?
The text was updated successfully, but these errors were encountered: