amMap 美国地图中的纬度/经度坐标不正确 [英] Latitude/Longitude coordinates are not correct in amMap USA map

查看:35
本文介绍了amMap 美国地图中的纬度/经度坐标不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 usaLow.js 地图构建地图.在 map init 上,我调用了一个返回此数据的 json 方法:

I am building a map using the usaLow.js map. On map init, I call a json method that returns this data:

[{latitude: "40.4258686",longitude: "-86.9080655"}]

我将这些数据添加到地图的数据提供者 (mapData) 中:

With this data I add to the map's data provider (mapData) with this:

mapData.images = [];
for(var i = 0; i < resp.length; ++i){
  mapData.images.push({
    type: "circle",
    color:"#FF0000",
    latitude: parseFloat(resp[i].latitude),
    longitude: parseFloat(resp[i].longitude)
  });
}
map.validateData();

这个位置应该在印第安纳州,但这是我看到标记的地方:

This location should be in Indiana, but this is where I see the marker:

不使用世界地图时需要转换纬度/经度坐标吗?如果是这样,那怎么做?

Do lat/long coordinates need to be converted when not using world maps? If so, how can that be done?

修复了 JSON 字符串拼写错误

推荐答案

您似乎在使用未经校准的美国地图.(usaLow.js) 为了视觉目的,这张地图被扭曲了,因此与真实的纬度/经度坐标不兼容.

It seems like you are using a non-calibrated US map. (usaLow.js) This map is distorted for visual purposes and thus not compatible with real latitude/longitude coordinates.

要解决这个问题,您需要使用经过校准的地图之一.选项如下:

To work around that, you will need to use one of the maps that are calibrated. The options are these:

它是针对美国大陆的墨卡托校准.标记应该可以绘制,除了阿拉斯加和夏威夷,该地区流离失所.

It is Mercator-calibrated for mainland US. The markers should plot OK, except for Alaska and Hawaii, that area displaced.

这张地图完全兼容坐标,包括阿拉斯加和夏威夷.但是,它可能看起来不那么吸引人:

This map is fully compatible with coordinates, including Alaska and Hawaii. However, it might not look as appealing:

这两个地图都与 JavaScript 地图捆绑在一起.

Both of those maps are bundled with JavaScript Maps.

这篇关于amMap 美国地图中的纬度/经度坐标不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆