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.

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 :

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

• where did you get the existing equation to convert? Also curious why you subtract a constant 486.97 from x and then add 1440.45 back to it ? (same for y)
– toms
Commented Aug 6, 2015 at 17:48
• I found it by trying to place my markers. I change the values, and I refresh to see the result. And this process again and again Commented Aug 6, 2015 at 18:17

Another idea: set up a trigger for 'on click' in leaflet. Then you can `console.log()` the Lat Lon coordinates in LatLon. In this way, you can sort of digitise from the map. You can also use the Leaflet Draw plugin to digitise points straight on your map, and can probably work out how to export GeoJSON from that: https://github.com/Leaflet/Leaflet.draw.