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.
awesome thx, i'll give that a shot
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