GPS Programming in Android for Offline Maps

Most mobile users and several developers may not be aware of the fact that GPS navigation is possible without Internet connectivity, i.e. ‘Offline map usage’ is possible without accessing the Internet!

Given below are a few tips on how to make this work and understand where offline data is stored:

To access maps, offline, i.e. when you are not connected to the Internet, you have to store the map tiles in your device and the code will render the map from the locally stored tiles’ information. ‘Tiles’ is the file which is in .zip or SQL format which will have all the information with respect to routes – latitude and longitude. All the map related files can also be stored in SD Card or device memory based on requirements.

In case you do not want to utilize your device storage for storing entire world map related data, the solution is simple. Download an application which is developed using some libraries that will download tiles and store files in device storage based on your selected region.

If you are an Android app developer and want to understand the process behind offline map application and if you also want to know the most feasible method to develop this kind of application, the answer is, there are a lot of libraries available and most of them are open source.

Given below are a few suggestions on open source libraries:

OSMAndroid :

Osmandroid is a tool which is used to show data from Open Street Maps when on-line, and can use tiles for off-line access. This is a raster-based option, and you can use Mobile Atlas Creator to create tiles from pretty much any WMS service.

Reference: https://github.com/osmdroid/osmdroid

MapsForge :

This is an excellent library for rendering OSM data on-the-fly or when needed, which means it will download the tiles based on the region. It has a special optimized tile format, and the rendering performance is quite good.

Reference: https://github.com/mapsforge/mapsforge

ArcGis Runtime for Android :

ArcGis seems to be oriented towards showing ArcGIS Server’s Mapservices. ArcGis can show data in an offline mode, by storing tiles in the compact cache storage format, or by using tile packages.

Reference: http://resources.arcgis.com/en/page-has-moved/

Nutiteq :

This is a fully featured library and includes several unique features such as support for 3D, various OGC services, custom Map API’s, offline routing and maps in any projection.

Reference: http://www.nutiteq.com/nutiteq-sdk/comparison/

Google Maps Android API :

This is the default mapView in Android, and it uses the data from Google Maps. While the Google map application itself can be used in offline mode, as far as my knowledge goes, it is not possible to use Google Data in the offline mode. However it is possible to show your own tiles in offline mode.

Reference: https://developers.google.com/maps/documentation/android-api/

MapBox :

This company has recently released an Android SDK, which can be used for online and offline maps.

Reference: https://github.com/mapbox/mapbox-android-sdk-legacy

To summarize, I have provided some information on libraries you can use for Android app development. These are the most popular open source libraries/tools for implementing offline maps. There are several other paid libraries and end-to-end solutions for implementing offline maps.

Referral: http://mobac.sourceforge.net/

Listed below are some of the best offline maps available in Google Play Store:

Maps.me

Download: https://play.google.com/store/apps/details?id=com.mapswithme.maps.pro&referrer=utm_source%3DAndroidPIT%26utm_medium%3DAndroidPIT%26utm_campaign%3DAndroidPIT

OsmAnd

Download: https://play.google.com/store/apps/details?id=net.osmand&referrer=utm_source%3DAndroidPIT%26utm_medium%3DAndroidPIT%26utm_campaign%3DAndroidPIT

This blog with basic level information and referral links is for curious developers who want to understand how offline maps work.  If you have any questions, do write to me at: mohammed_n@trigent.com

Author

  • Mohammed Nissar

    Mohammed Nissar C.S. is a Software Engineer with Trigent Software. Nissar has several years of experience in hybrid and native mobile application development for Android and iOS platforms. He holds a Masters Degree in Computer Applications (MCA) from Visvesvaraya Technological University (VTU).