最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Coordinates to Lat Long in Leaflet - Stack Overflow

programmeradmin4浏览0评论

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.

Example : Thanks in advance.

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.

Example : Thanks in advance.

Share Improve this question edited Aug 5, 2015 at 20:59 Templeton Peck asked Aug 5, 2015 at 20:53 Templeton PeckTempleton Peck 1512 gold badges3 silver badges10 bronze badges 2
  • 1 Maybe this could help you: stackoverflow./questions/10886406/… – gusjap Commented Aug 6, 2015 at 20:06
  • A more recent answer: stackoverflow./questions/34638887/… – ghybs Commented Oct 19, 2017 at 11:39
Add a ment  | 

3 Answers 3

Reset to default 4

I tried this:

var latlng = new L.latLng(-43.1731, 6.6906);
var point = L.Projection.Mercator.project(latlng);
console.log(point);
// o.Point {x: 744794.1851014761, y: -5309112.129212381}

It is not close to your GTA V coordinates, but I'm not sure it were just for example.

Your coordinates are ing from different map projections. The Leaflet ones are most probably standard WGS 84 (SRID 4326). GTA V coordinates are obviously based on a different projection.

Coordinates can be transformed from one projection to anothers. But you need to know, which projection your coordinates are ing from, to do the math. Here is an online converter provided with some mon projections, and i tried your coordinates, but had no luck in ing close with these projections.

You can use L.latlng function

http://leafletjs./reference.html#latlng

发布评论

评论列表(0)

  1. 暂无评论