简体   繁体   English

小册子中经纬度的坐标

[英]Coordinates to Lat Long in Leaflet

I'm here because I'm trying to create a GTA V map with Leafletjs API.我来这里是因为我正在尝试使用 Leafletjs API 创建 GTA V 地图。 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.但目的是通过使用 GTA V 游戏内坐标在地图上放置标记。 To achieve it, I need to convert the coordinates to LatLong but after many researches, I can't find a solution.为了实现它,我需要将坐标转换为 LatLong,但经过多次研究,我找不到解决方案。

Example :例子 : 在此处输入图片说明 Thanks in advance.提前致谢。

Your coordinates are coming from different map projections.您的坐标来自不同的地图投影。 The Leaflet ones are most probably standard WGS 84 (SRID 4326). Leaflet 最有可能是标准的 WGS 84 (SRID 4326)。 GTA V coordinates are obviously based on a different projection. GTA V 坐标显然基于不同的投影。

Coordinates can be transformed from one projection to anothers.坐标可以从一种投影转换为另一种投影。 But you need to know, which projection your coordinates are coming from, to do the math.但是您需要知道您的坐标来自哪个投影,才能进行数学计算。 Here is an online converter provided with some common projections, and i tried your coordinates, but had no luck in coming close with these projections.是一个提供一些常见投影的在线转换器,我尝试了您的坐标,但没有运气接近这些投影。

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.它与您的 GTA V 坐标并不接近,但我不确定它是否只是举例。

You can use L.latlng function您可以使用L.latlng函数

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM