I have a requirement for building an Android mapping application onto which I will plot archaeological POIs (Points of interest). The requirement is to have aerial photographs much like Google Maps Satellite view. However, the other requirement is offline mapping capability when data connectivity is unavailable, so that rules out using Google Maps.
So I have two questions.
-
Does OSMDroid have free access to tile sources supporting Arial Photography or Satellite without using Bing?.
-
I know OSM can support Bing which does have an Ariel Photography map, but I can’t get it to work. Are there any bing specific tutorials you can point me to, or a simple example of how to get a bing map to show in OSMDroid as I’ve been looking for some hours and pulling my hair out.
In eclise I have been able to build a simple app to show the default maps of OSMDroid (Mapink). To try and use Bing I added into my project source three classes. BingMapTileSource.Java, ImageryMetaData.Java and ImageryMetaDataResouce.Java. I got these from the Bing sub folder of the TileProvider directory on the OSMDroid SVN (Link here)
However, when I use this in the onCreate as follows, I get null pointer errors in the BingMapTileSource.java class.
MapView mapView = new MapView(this, 256);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
String m_locale=Locale.getDefault().getISO3Language()+"-"+Locale.getDefault().getISO3Language();
mapView.setTileSource(new BingMapTileSource("Bing",m_locale));
mapView.getController().setZoom(10);
mapView.getController().setCenter(new GeoPoint(39.461078, 2.856445));
setContentView(mapView);
I beleive the cause of this problem is that the following class variables are never initialised before they are first used.
s_roadMetaData = null;
s_aerialMetaData = null;
s_aerialwithLabelsMetaData = null;
The only place I can see them being initialised is in a static method called InitMetaData which never gets called.
public static synchronized void initMetaData(final Context aContext)
Though some clue as to its purpose is provided in its Javadoc which states.
/**
* Initialize BingMap tile source.<br>
* This method should be invoked before class instantiation.<br>
* It get dynamically the REST service url to be used to get tile in each supported map view mode.
* @param a_BingMapKey The user's BingMap key.
* @throws Exception
*/
However, I’ve no idea how to use this. Any advice or pointers to tutorials, examples, or some code would be greatly appreciated.
Ok well I figured the problem with getting the Bing maps to work. What was needed was to precede the instantiation of the BingMapTileSouce with the following static method that instantiates the three Meta Data objects discussed earlier.