Skip to first unread message

Evgeny Churaev

unread,
Sep 3, 2015, 5:03:30 AM9/3/15
to MIT App Inventor Forum
Can I used in my app offline Google maps or OSM with GPS tracking?
Thank you.

SteveJG

unread,
Sep 3, 2015, 8:34:20 AM9/3/15
to mitappinv...@googlegroups.com
You can use an App Inventor app offline with GPS and a "home made"  'flat' map.  Load the 'map' as a Canvas background image. You need to know the geocoordinates of two opposite corners of the map (so you can 'calibrate' the map).  Develop a procedure to convert GPS coordinates to Canvas screen coordinates (so you can plot the GPS location on the Canvas).  Both Google and OSM use Mercator map projections, if you do not use a flat map, you will probably want to correct for the distortion of a Mercator map mathematically. Plotting on a Canvas 'map' is not very precise.  Factors to consider are the map scale, the Android screen pixel density, the number of pixels on the screen and how precise this mapping must be.

 I am not aware of any simple method that will allow you to use an offline Google Map or an OSM map stored on the Android.  There are technical and legal reasons why this is not possible.  To use a Google map with out Google Maps developers must seek permission from Google (  https://groups.google.com/forum/#!topic/google-maps-js-api-v3/sALpJq12HjQ  ).   Working with Google Map Tiles is very difficult using a computer, there might be a way to do so on an Android. The tiles on OSM maps are similar and it appears there are few if any restrictions on their use.  Read OSM's terms of use for the details.

You may be able to 'capture' a Google Map on your PC screen, then use that.with a Canvas.. you must follow the Google terms of use here  http://www.google.com/permissions/geoguidelines.html     and  https://developers.google.com/maps/faq?hl=en  

You can find out a lot more by googling something like     using Google Map Tiles offline                     I hope this information is useful.

Also you might look at John's gallery app search for AppinventorDynamicMapsv1   . His description says it can use various maps but you might have to have an online connection.  Try it.

Regards,
Steve


James H

unread,
Sep 3, 2015, 10:18:47 AM9/3/15
to MIT App Inventor Forum
How big an area are you hoping to cover ?
If it's a small area you could modify the file that Steve suggested and as the map loads onto the canvas( from (my) memory 300 x 300 images) and then save these on the sdcard, store the centre lat/lng of each image and the filename of the image to the database. make the lat/lng the db key. searching for the nearest coordinate pair for the right image might be a bit slow and the handover between the two images would be a bit clunky as you would have to reach the edge of one map before switching to the middle of the next.
If its a big area you want to cover it's going to be you'll need to use high altitude images else you will end up with a truly massive set of images.

 AI extension idea : that could pull OSM or mapnik maptiles and store them in the OSM directory and read them back onto the canvas based on location parameters :) 
Reply all
Reply to author
Forward
0 new messages