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 »

Earth doesn't wrap in cloudmade maps

2 replies [Last post]
Kallin
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 09/14/2009

I've noticed that the earth doesn't wrap in either x or y when u reach the extent of the map using cloudmade. Using open street map it wrapped in x but not y. Is there any way to change this? If not, is there an easy way to set custom paint the areas outsides the map? I could manually calculate when the outside is showing and paint over but would rather not.

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

Custom paint outside map coverage would be a bit bigger new feature. Currently you can set custom paint only for missing tiles.

Wrapping in Y direction would be something I have not seen yet anywhere.

CloudMade map service class with wrappable X is following:

import com.nutiteq.maps.projections.EPSG3785;
import com.nutiteq.ui.Copyright;
import com.nutiteq.ui.StringCopyright;

/**
* Map for using CloudMade maps (with tile size 64 and 256).
*/
public class CloudMade extends EPSG3785 implements GeoMap, UnstreamedMap {
private static final String BASEURL = "http://tile.cloudmade.com/";
private final String licenseKey;
private final int mapLayout;

public static final int TILE_SIZE_64 = 64;
public static final int TILE_SIZE_256 = 256;

private static final int MIN_ZOOM = 0;
private static final int MAX_ZOOM_256 = 18;
private static final int MAX_ZOOM_64 = 20;

/**
* Constructor for CloudMade map.
*
* @param licenseKey
* license key issued by CloudMade
* @param tileSize
* used tile size (64 or 256)
* @param mapLayout
* used map layout (currently only 1 is supported by CloudMade)
*/
public CloudMade(final String licenseKey, final int tileSize, final int mapLayout) {
this(new StringCopyright("CloudMade"), licenseKey, tileSize, mapLayout);
}

public CloudMade(final Copyright copyright, final String licenseKey, final int tileSize,
final int mapLayout) {
super(copyright, tileSize, MIN_ZOOM, tileSize == TILE_SIZE_64 ? MAX_ZOOM_64 : MAX_ZOOM_256);
this.licenseKey = licenseKey;
this.mapLayout = mapLayout;
}

public String buildPath(final int mapX, final int mapY, final int zoom) {
final StringBuffer result = new StringBuffer(BASEURL);

result.append(licenseKey);
result.append("/");
result.append(mapLayout);
result.append("/");
result.append(getTileSize());
result.append("/");

result.append(zoom);
result.append('/');
result.append(mapX / getTileSize()& ((1 << zoom) - 1));
result.append('/');
result.append(mapY / getTileSize());
result.append(".png");
return result.toString();
}
}

/JaakL

Kallin
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 09/14/2009

awesome thx, i'll give that a shot