[OpenLayers-Users] Loading in custom Google tiles not working...
Maps-R-us
mlaudon at laudontech.com
Thu Oct 2 14:10:53 EDT 2008
I have some custom Google Maps tiles I created for a city in the Dominican
Republic. I would like to load these into OpenLayers. I have a custom
get_url function to map to my Google Maps tile names. It appears the
function is looking for tiles named differently than the ones I have
created. Has anyone tried this before and had similar results?
Thanks in advance,
Mapper.
The tiles are located here:
http://www.laudontech.com/Dominican/Z
For zoom 10, here are the Google tile names:
457_312.png
457_313.png
457_314.png
458_312.png
458_313.png
458_314.png
Here are the ones OpenLayers expects:
312_203.png
313_203.png
312_204.png
<script type="text/javascript">
var map;
function get_my_url (bounds) {
var res = this.map.getResolution();
//alert (res);
var x = Math.round ((bounds.left - this.maxExtent.left) / (res *
this.tileSize.w));
var y = Math.round ((this.maxExtent.top - bounds.top) / (res *
this.tileSize.h));
var z = this.map.getZoom();
var path = z + "/" + x + "_" + y + "." + this.type;
var url = this.url;
if (url instanceof Array) {
url = this.selectUrl(path, url);
}
return url + path;
}
function init() {
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var mylayer = new OpenLayers.Layer.TMS("Mark Layer",
"http://www.laudontech.com/Dominican/Z", { 'type':'png', 'getURL':get_my_url
});
var gmap = new OpenLayers.Layer.Google(
"Google Streets" // the default
);
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_SATELLITE_MAP}
);
map.addLayers([gmap,gphy,mylayer]);
map.setCenter(new OpenLayers.LonLat(-69.901,18.472 ), 10);
}
</script>
--
View this message in context: http://www.nabble.com/Loading-in-custom-Google-tiles-not-working...-tp19784698p19784698.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list