Offline osm Map

Hello Community,

i searched in the web and in this forum here, but coulnd't find a real solution.

In my App i have a map, that displays some markers from Open street map (Hydrants for volunteer firefighters). this markers i store on a file, so that they are offline avialiable, during a firefighter alarm.

Now to my point: I want to store the openStreetMap also offline on the device. So that the map loads without an Internet connection. is there any chance of doing this in AppInventor ?

Thanks for your help.

Greetings
_pasi

Welcome.

There is not a way to download a specific set of OpenStreetMap tiles compatible with the Map component. However the Map component does cache the tiles in the app that the user has previously visited. Under some circumstances, the component can access the cached tiles when there is no Internet connection. Try using the app without a WIFI connection (after you have previously used it to work with your hydrants, then see what happens when WIFI is disconnected. Does that work for you? See Map and Marker components with OSM map uploaded on sdcard device - #4 by SteveJG

You could also capture a screenshot of your map that displays the hydrants as a png or jpg file. You will not be able to navigate using the jpg but you can have available a map image that will display the hydrant locations.

The LocationSensor works when there is no Internet. The Map might work if the right tiles are cached in the app.

2 Likes

If I delete the cache files that are for the saved map, does that mean the next time I open the app, the app will have to load the map all over again?

Thanks for your answers.
Just rely on the cache, during a house fire, seams not a very good solution to me.
Working with Images doesen't seam ideal.

Looks like there is no way around for me to leran how to create apps with Android Studio.

Thanks for your help.

If you delete the app's cache of previous map tiles manually, the next time you open the map the map tile you designate (by the zoom factor and geocoordinates) will load again the next time you have WIFI connected. :slight_smile:

Consider, the way the Map control works to access the OSM api, the app seems to reload (load) the required tile anyway.

1 Like

Probably true. App Inventor does not have the necessary tools to use downloaded OSM tiles.

Here is some help downloading OSM tiles and using them with Android Studio

https://medium.com/@asynctaskcoffee/android-openstreetmap-offline-map-setup-8c71eee40088

Did you test how this works using the cache? The map tiles in the cache are 'downloaded OSM tiles). Other than resolution, what's the problem. :cry: It is what is available using AI2.

Of course not ideal, but a screen capdtured image is what is available using AI2 tools. Have you looked at Google's MyMap?

https://www.google.com/maps/d/edit?mid=1FcDNVfaDgI6VRilgYs07iSCIg62U2PSu&ll=29.45688759245959%2C-92.41699249999999&z=4

Good luck finding a suitable solution for your app.

A possible alternative to using map tiles is to use your List of hydrant locations and use it to locate the nearest hydrant to a house or building. Determine the closest hydrant by calculating a straight line distance to all the hydrants and indicating the nearest.

Thanks for the tutorial, this looks pritty helpefull.
I want to do some path calculations, how many fire hose you need to the next hydrant.

Of course App inventer could not provide any feature possible with this dragable boxes :smiley:

I tryed with the cache, and it seams to work where you preloaded it, but it ist not not practical to preload the whole city by hand, on every device.

i will try it with andrioid Studio. Will take a wihle, but then i hopefully have a good result :slight_smile:

Use your List of hydrant coordinates. AI2 can calculate the distance between any two of them. :slight_smile:

I only tested this with Kodular because it has a Google Maps component. The Google Maps app gives you the possibility to store a map offline. So i used the Google Maps component and then was able to use that offline. I didn't test that if you use Google Maps via a Webviewer in App Inventor. But maybe you could try and report back if it works.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.