Android Question GoogleMaps - Saving map for offline use?

rossco_pb

Member
Licensed User
Longtime User
Hi, after reviewing many posts and tutorials about the use of the GoogleMaps library within B4a I have been unable to determine if it is possible to open a map fragment, add a bunch of markers to it and then save the map so that it may be opened as an offline map through the standard Google Maps app. Can anyone give me a simple yes (it is possible) or no it is not (but can be achieved through the use of (perhaps 3rd party) other libraries/code) answer and if possible then an example of the save process? If this is something simple that in spite of my efforts I cannot resolve, then apologies in advance...
 

rossco_pb

Member
Licensed User
Longtime User
It is not possible to save the map for offline usage with GoogleMaps library.

Cheers Erel, I suspected as much. With the current implementation of the Google Maps API in B4a is it possible to save a map with markers and then view it offline with the same (or another) B4a app? My impression thus far is that is not possible either but that other software (OSMDroid or the like) can be used to provide the functionality.
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
Not sure that I understand the question. As I wrote you cannot save a Google map for offline viewing.

Yes sorry, my question was badly worded, I understand Google maps is not an option. I am having a play with the OSMdroid library to see if that will suit my purpose. Basically all I am trying to achieve is have a map available offline that when opened is preloaded with a couple of hundred predefined markers. Not sure if this is possible but will persevere ;-)
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
Is all good. I am working my way through the posts and tutorials which hold lots of useful info but some are very long and cover a significant period in time with versions etc changing along the way but will get there in the end as we always do eh :)
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
With MapsForgeTileProvider by Warwound, you can use the GoogleMap library and show also offline maps from the open source project OpenStreetMap.
Marco
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
Thanks for the advice Marco. Will have a look at the MapsForgeTileProvider option if the OSMdroid option does not work out.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
You can use either GooleMaps or OSMDroid offline if you have an offline source of tiles.
That source of tiles could be MapsForge or a zip archive containing image files.

Martin.
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
You can use either GooleMaps or OSMDroid offline if you have an offline source of tiles.
That source of tiles could be MapsForge or a zip archive containing image files.

Martin.

Cheers Martin, from what I have seen looks like you are the master of mapping so any assistance appreciated. I live in rural NZ and a member of the local volunteer fire brigade and just trying to put together a little offline map that will show all our water sources so when we on a call we will know where the closest useful supply (pond or whatever) is for refilling the tanker :) Has to work offline as cell coverage problematic... All good fun and keeping my brain alive which is important at my age ;-)
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
if it is for viewing only and simple.. then you can write a script, save the map as bitmap, and save the markers in SQLite database (the coordinates) ,
the when you run the app your script will place the markers in place in scale of the bitmap.

my two cents.
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
if it is for viewing only and simple.. then you can write a script, save the map as bitmap, and save the markers in SQLite database (the coordinates) ,
the when you run the app your script will place the markers in place in scale of the bitmap.

my two cents.

Yes that is the plan, currently the data is a csv file but if the SQLite option is faster to load then might go that route but want to keep data input easy as well. Will try both and see how they work. Appreciate your input.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
You are right, csv is much smaller than database and faster.
I am sure you notice the coordinates are relative to the new bmp image and not the original values.
 
Upvote 0

rossco_pb

Member
Licensed User
Longtime User
You are right, csv is much smaller than database and faster.
I am sure you notice the coordinates are relative to the new bmp image and not the original values.

Sorry could you please clarify "the coordinates are relative to the new bmp image and not the original values"? thanks
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
If the image is saved as bmp, then I thought you keep the original values of the coordinates for consistency, but map them to the physical XY coordinates of the new bitmap.
This way the coordinates of your bmp and that of the online googlemaps will read the same values for the same location. But under the hood, you are drawing the marks
on the bmp image coordinates which are and must be different.
Please note this is a theory and I didn't test it.
 
Upvote 0
Top