Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Latest news

Last at Tue, 6 Dec 2011 18:37:53
Topic: New BlackBerry sample app
See more news »

Cloud Made API KEY doesn't work, any special request?

5 replies [Last post]
xger86x
User offline. Last seen 1 year 44 weeks ago. Offline
Joined: 02/11/2010

I'm developing an application for Android, so i use the service provided for www.nutiteq.com for using your api maps.
But the problem is the following:

when i use the code proposed by nutiteq:

mapComponent = new BasicMapComponent("115f89503138416a242f40fb7d7f338e4b73e583e8e343.19717285",
"TouristEye", "TouristEye", 1, 1,
new WgsPoint(mCenter.getLong(), mCenter.getLat()), 10);
mapComponent.setMap(new CloudMade(" 24c1c76c612248f7acd23978088bfb3a", 64, 1));

the API Key i ask for Cloud Made doesn't work correctly and i can't use the maps. Is there any special request that i have to do when i ask for API KEY in Map Cloud?
Hope you can help me.

Thank you

jaak
User offline. Last seen 1 day 11 hours ago. Offline
Joined: 06/19/2008

CloudMade has now token-based authentication. It is not yet built in in the library, it will be in the next version. So far you can use following workaround: make HTTP POST request to get token and then use TMSMap service to get map images. Note: (1) following code is tested only in emulator, (2) instead of "123" you should use some proper unique end-user id value (username in your service, for automatic one some are using e.g. Bluetooth device physical address, in some devices you get IMEI or other unique value from phone API):

String CMToken = null;

 try {
  CMToken = getCloudMadeToken("24c1c76c612248f7acd23978088bfb3a","123");
  } catch (IOException e1) {
   // TODO Auto-generated catch block
   e1.printStackTrace();
  }
		
  map.setMap(new TMSMap("http://tile.cloudmade.com/24c1c76c612248f7acd23978088bfb3a/1/64/", 64, 0,
            19, ".png?token="+CMToken,"CloudMade")); 

// method to request CloudMade token
   public String getCloudMadeToken(String apiKey, String userId)
			throws IOException {

		HttpConnection httpConn = null;
		String url = "http://auth.cloudmade.com/token/" + apiKey + "?userid="
				+ userId;
		InputStream is = null;
		OutputStream os = null;

		try {
			httpConn = (HttpConnection) Connector.open(url);
			httpConn.setRequestMethod(HttpConnection.POST);

			httpConn.setRequestProperty("User-Agent",
					"Profile/MIDP-1.0 Confirguration/CLDC-1.0");
			httpConn.setRequestProperty("Accept_Language", "en-US");
			httpConn.setRequestProperty("Content-Type",
					"application/x-www-form-urlencoded");

			os = httpConn.openOutputStream();

			// Read Response from the Server

			StringBuffer sb = new StringBuffer();
			is = httpConn.openDataInputStream();
			int chr;
			while ((chr = is.read()) != -1)
				sb.append((char) chr);

			return sb.toString();

		} finally {
			if (is != null)
				is.close();
			if (os != null)
				os.close();
			if (httpConn != null)
				httpConn.close();
		}
}

/JaakL

xger86x
User offline. Last seen 1 year 44 weeks ago. Offline
Joined: 02/11/2010

i'll try now and i tell you if it works.

thanks you

xger86x
User offline. Last seen 1 year 44 weeks ago. Offline
Joined: 02/11/2010

thanks it worked!

dribuschc
User offline. Last seen 1 year 41 weeks ago. Offline
Joined: 03/09/2010

I had the same issue and the work-around works, but I still have a problem: With the TMS map the user cannot zoom in as far as with the previous solution. This is a problem since the map is for pedestrians and it is very detailed. Any suggestions?

jaak
User offline. Last seen 1 day 11 hours ago. Offline
Joined: 06/19/2008

When you define TMS map, then there are parameters minZoom and maxZoom. Have you tried to increase maxZoom (19 in the sample) ? From client side there should not be practical limits how large value you can use there.

/JaakL