Fork me on GitHub

All about osmdroid-thirdparty

This library provides the following features as an add on for osmdroild

  • Show OSM tiles on Google Maps
  • Wrappers for using osmdroid API's with the Google Maps engine
  • Tile source for using Bing Maps with osmdroid (since v5.6.3, it is now in osmdroid-android)

Google Wrapper

The osmdroid Google wrapper allows you to easily switch between a Google MapView and an osmdroid MapView by letting the application refer to the IMapView interface instead of the specific implementation.


In your code you could get the map view preference and then instantiate a view of the preferred type. This will be assigned to an IMapView variable. From then on the rest of the code can use the map view without regard to what type it is.

// member variable 
IMapView mMapView;

// create the required type of 
MapView mMapView = googleView ? new : new org.osmdroid.views.MapView(...);

// you can then use it regardless of which type it is, for example 

For some operations you may need to do more than simply instantiation, for example adding overlays.

if (googleView) {
   mapView = new;
   myLocationOverlay = new
            mMapView = mapView;
        } else {
            org.osmdroid.views.MapView mapView = new org.osmdroid.views.MapView(...);
            org.osmdroid.views.overlay.MyLocationOverlay myLocationOverlay = org.osmdroid.views.overlay.MyLocationOverlay(...)
            mMapView = mapView;

There's also more ways of instantiating the MapView, for example

mMapView = (IMapView) findViewById(;

Hopefully these samples make the idea of the Google wrapper clear