Mapnav Geolocation Toolkit
Unity

Frequently Asked Questions

1. Can I use a maps provider other than MapQuest(OSM) with the MapNav Geolocation Toolkit?
Yes, MapNav is compatible with most maps providers, as long as you follow the "center,zoom and size" format to build your map tile request. In order to implement any of them, you will need to edit the corresponding bits of code in the MapNav.cs and MapNavInspector.cs scripts as in the following examples:
Mapnav.cs
MAPQUEST (Default)
//Add possible values to maptype, mapSize and mapFormat arrays (MAPQUEST)
maptype = new string[]{"map","sat","hyb","light","dark"};
mapSize = new int[]{640,960,1280,1920}; //in pixels
mapFormat = new string[] {"jpg70", "jpg80", "jpg90", "png"};
//MAPQUEST ==============================================================================
//Build a valid MapQuest OpenMaps tile request for the current location
multiplier=mapSize[indexSize]/640.0f; //Tile Size= 640*multiplier
url="http://open.mapquestapi.com/staticmap/v4/getmap?key="+key+"&size="+mapSize[indexSize].ToString()+","+mapSize[indexSize].ToString()+"&zoom="+zoom+"&format="+mapFormat[indexFormat]+"&type="+maptype[indexType]+"&center="+fixLat+","+fixLon+"&scalebar=false";
tempLat = fixLat;
tempLon = fixLon;

GOOGLE MAPS
//Add possible values to maptype, mapSize and mapFormat arrays (GOOGLE)
maptype = new string[]{"satellite","roadmap","hybrid","terrain"};
mapSize = new int[]{640}; //in pixels
mapFormat = new string[] {"png","gif","jpg"};
//GOOGLE ================================================================================
//Build a valid Google Maps tile request for the current location
multiplier=1;
url= "http://maps.googleapis.com/maps/api/staticmap?center="+fixLat+","+fixLon+"&zoom="+zoom+"&scale=2&size=640x640&format="+mapFormat[indexFormat]+"&maptype="+maptype[indexType]+"&sensor=false&key="+key;
tempLat = fixLat;
tempLon = fixLon;

BING MAPS
//Add possible values to maptype, mapSize and mapFormat arrays (BING)
maptype = new string[]{"Aerial","AerialWithLabels","Road"};
mapSize = new int[]{834,834}; //in pixels
mapFormat = new string[] {"png","gif","jpeg"};
//BING MAPS ==============================================================================
//Build a valid Microsoft Bing tile request for the current location
multiplier=mapSize[indexSize]/640.0f;
url = "http://dev.virtualearth.net/REST/v1/Imagery/Map/"+maptype[indexType]+"/"+fixLat+","+fixLon+"/"+zoom+"?mapSize="+mapSize[indexSize].ToString()+","+mapSize[indexSize].ToString()+"&format="+mapFormat[indexFormat]+"&key="+key;
tempLat = fixLat;
tempLon = fixLon;
MapNavInspector.cs
MAPQUEST (Default)
//MAPQUEST ==============================================================================
private string[] mapTypes = new string[]{"map","sat","hyb","light","dark"};
private string[] mapSizes = new string[]{"640x640","960x960","1280x1280","1920x1920"};
private string[] mapFormat = new string[]{"jpg70","jpg80","jpg90","png"};

GOOGLE MAPS
//GOOGLE ================================================================================
private string[] mapTypes = new string[]{"satellite","roadmap","hybrid","terrain"};
private string[] mapSizes = new string[]{"640x640"};
private string[] mapFormat = new string[]{"png","gif","jpg"};

BING MAPS
//BING MAPS ==============================================================================
private string[] mapTypes = new string[]{"Aerial","AerialWithLabels","Road"};
private string[] mapSizes = new string[]{"834x834"};
private string[] mapFormat = new string[] {"png","gif","jpeg"};

2. Location Services not working on iOS10: MapNav unable to initialize location services
Apple now requires to set the 'NSLocationWhenInUseUsageDescription' field in your application's info.plist file when trying to use location services. In order to fix this issue within Unity, simply set a value for the 'Location Usage Description' in iOS Player Settings. You can use something like "We need to access location services in order to set your position on the map"

iOS Location Usage Description