I have made a custom map type using the Google Maps API.
I have used maptiler to create the different zoomlayers and the 0 layer (really zoomed out) is a 256 x 256 tile. The image only covers 134 x 112 however.
I want to be able to make the map coordinates relative to the whole map and not the default earth coordinates of google maps. For example, the top-left corner should be (0,0) while the bottom-right should be (50,50).
I have received help from Heitor Chang here: https://stackoverflow.com/questions/11192281/can-i-reset-latlng-coordinates-for-a-custom-map-type
The problem lies here:
dayzProjection.prototype.fromLatLngToPoint = function(latlng) {
// pixel size of tile at zoom 0
var max = 134;
// define bottom-right corner as (50, 50)
var x = max * latlng.lng() / 50;
var y = max * latlng.lat() / 50;
return new google.maps.Point(x, y);
};
dayzProjection.prototype.fromPointToLatLng = function(pixel) {
// inverse conversion
var lng = pixel.x / max * 50;
var lat = pixel.y / max * 50;
return new google.maps.LatLng(lat, lng);
};
Can anyone help me transform these coordinates.
This may help: https://developers.google.com/maps/documentation/javascript/maptypes#Projections