The slippymap tile naming convention is used by many (many) maps including
OpenStreetMap.
And the wiki link in my previous email explains it:
- Tiles are 256 × 256 pixel PNG files
- Each zoom level is a directory, each column is a subdirectory, and each tile in that column is a file
- Filename(url) format is /zoom/x/y.png
So a typical url to a tile on OpenStreetmap might be:
http://b.tile.openstreetmap.org/16/32840/21422.png
Some tileservers swap the x and y parameters so the url is slightly different, and some tileservers use a completely different tile naming scheme.
If you want to get a better idea of how the standard coordinate system works then you'll find a good explanation here:
https://developers.google.com/maps/documentation/javascript/maptypes#CustomMapTypes, the section titled
Tile coordinates explains it well.
So if you have a tile server or access to a tile server and that tile server serves tiles based on zoom, x and y parameters then you should be able pass a url template to the UrlTileProvider Initialize method that will work.
Take a look at a bit of the relevant source code:
private String mUrlTemplate;
@Override
public synchronized URL getTileUrl(int pX, int pY, int pZoom){
try {
return new URL(String.format(mUrlTemplate, pX, pY, pZoom));
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
mUrlTemplate is the String that you passed to the UrlTileProvider Initialize method.
Each time the map requires a tile it calls the getTileUrl method passing the zoom level and x and y coordinates of the required tile.
return new URL(String.format(mUrlTemplate, pX, pY, pZoom));
This line takes your url template String and replaces %1$d with the tile x coordinate, $2$d with the tile y coordinate and %3$d with the zoom level.
So if the url template is http://b.tile.openstreetmap.org/%3$d/%1$d/%2$d.png then you display tiles from the OpenStreetMap tile server.
If your tile server requires the tile request url to be in a different format then you should be able to create a url template that will work, there's a free tile server at
http://www.maps-for-free.com/ but this tile server does not use the slippy map tile naming convention.
A typical url for a tile might be:
http://www.maps-for-free.com/layer/relief/z8/row83/8_128-83.jpg
And a url template for this tile server would be:
http://www.maps-for-free.com/layer/relief/z%3$d/row%2$d/%3$d_%1$d-%2$d.jpg
(That's untested by the way).
The GroundOverlay object is passed a single image to display on the map.
You need to tell the GroundOverlay what geographical bounds the image cover and the libray size the image as required and display it.
A GroundOverlay object can display just one image.
So if you currently have a KML file and are using Google Earth to export that KML file and the exports consists of more than one image then a GroundOverlay is of no use.
Is Google Earth exporting a small set of map tiles and naming them with any recognisable convention?
If so then a TileOverlay sounds like it would display those tiles for you.
Can you keep this thread updated with your use of the TileOverlay and GroundOverlay?
if you find it all works well then i'll start a new thread or post on the existing Google Maps Tutorial thread so that others can find and use the library.
Martin.