Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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 * / 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:

share|improve this question

It is actually possible to place your top left corner at 0,0 and your bottom right at 50,50, if you want this. Of course you can place bottom right corner at 10,10, too, or whatever, within the limits: -90/+90 for latitude and -180/+180 for longitude.

The proportion should be:

Custom Projection - CARTESIAN

function CartesianProjection() {
    // map size at zoom 0 is equal to tile size
    this.tileSize = 256;

CartesianProjection.prototype.fromLatLngToPoint = function(latLng) {
    var x = (latLng.lng() / 50) * this.tileSize;
    var y = ( / 50) * this.tileSize;
    return new google.maps.Point(x, y);

CartesianProjection.prototype.fromPointToLatLng = function(point, noWrap) {
    var lng = (point.x / this.tileSize) * 50;
    var lat = (point.y / this.tileSize) * 50;
    return new google.maps.LatLng(lat, lng, noWrap);

Then you should place the center of the map to LatLng(25,25) in the Map options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.