Saturday, 13 June 2015

leaflet - GTA V coordinates to LatLng


I'm here because I'm trying to create a GTA V map with Leafletjs API. In deed, I've got my tiles that are ready. But the aim is to put markers on the map by using GTA V in-game coordinates. To achieve it, I need to convert the coordinates to LatLong but after many researches, I can't find a solution.


At Stackoverflow, they advise me to ask my question here.


For now, I have a simple function that help me to try to "calibrate" my coordinates :


function GTAVConverter(x,y)
{
var ex = 0.01255;
var ey = -0.01260;


var x = ex * x;
var y = ey * y;

var x = x - 486.97;
var y = y + 408.9;

return map.containerPointToLatLng(new L.Point(x+1440.45,y+127.45));
}


But I think there is a better way to achieve my aim. This function isn't really accurate, and if the browser window is resized, all the coordinates are moved.


Example that I want to convert :


enter image description here


I know that Leaflet API has a coordinates system but I don't know how it works.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...