To explain where the map initialize takes place.
It's in the file:
http://nikolajp.dk/ITU/Apollo/includefiles/gplayer_lib.js
The function called initialize();
Basically I do this:
// setup google maps
canvas2 = document.getElementById('map_canvas');
var mapOptions = {
zoom: 2,
center: center,
mapTypeControlOptions: {
mapTypeIds: ['coordinate'],style:
google.maps.MapTypeControlStyle.DROPDOWN_MENU
}, navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
}
};
map = new
google.maps.Map(document.getElementById("map_canvas"),mapOptions);
// Now attach the coordinate map type to the map's registry
map.mapTypes.set('coordinate',coordinateMapType);
// We can now set the map to use the 'coordinate' map type
map.setMapTypeId('coordinate');
I define the coordinate type here:
function CoordMapType() {}
CoordMapType.prototype.tileSize = new google.maps.Size(256,256);
CoordMapType.prototype.maxZoom = 4;
CoordMapType.prototype.minZoom = 2;
CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument)
{
var div = ownerDocument.createElement('DIV');
// document.write("layer"+(4-zoom)+"/"+coord.x+"_"+coord.y+"_"+(4-
zoom)+".png'"+">");
var TileNumbersAtZoomLevel = Math.pow(2,zoom);
var Xpos = coord.x;
var Ypos = coord.y;
// if out-of-X range then adjust value. We only extend map image on
the X-axis.
if(Xpos < 0)
{Xpos = (Xpos%TileNumbersAtZoomLevel)+TileNumbersAtZoomLevel;}
if(Xpos >= TileNumbersAtZoomLevel)
{Xpos = Xpos%TileNumbersAtZoomLevel;}
// if out-of-Y range then show blank image - else show proper image
if(Ypos >= TileNumbersAtZoomLevel || Ypos < 0)
{
div.innerHTML = "<img src='mapimages/minimapimage2/blank.png'>";
}
else
{
div.innerHTML = "<img src='mapimages/minimapimage2/layer"+zoom
+"/"+Xpos+"_"+Ypos+"_"+zoom+".png'"+">";
}
//div.innerHTML = "<img src='mapimages/minimapimage2/
layer4/0_0_4.png'>";
return div;
};
CoordMapType.prototype.name = "Apollo";
CoordMapType.prototype.alt = "Tile Coordinate Map Type";
var coordinateMapType = new CoordMapType();