OSM:转换在球墨卡托投影坐标关系“EPSG:900913”到“EPSG:4326”坐标
openlayers openstreetmap coordinate-transformation epsg
我的地图上一层(从实例):
var lonLat = new OpenLayers.LonLat(40.4088576, -86.8576718)
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
在位移结束我的get中心坐标:
map.getCenter();
map.getZoom();
和缩放级别:4925535.4503328,-9668990.0134335,12 使用算法
public PointF TileToWorldPos(double tile_x, double tile_y, int zoom)
{
PointF p = new Point();
double n = Math.PI - ((2.0 * Math.PI * tile_y) / Math.Pow(2.0, zoom));
p.X = (float)((tile_x / Math.Pow(2.0, zoom) * 360.0) - 180.0);
p.Y = (float)(180.0 / Math.PI * Math.Atan(Math.Sinh(n)));
return p;
}
我取得Y?90和X?432662 但我需要在border坐标:-180 .. 180 像:40.4088576,-86.8576718 什么是错?
-------------------------------------------------------------------------------------------------------------------------
1. 为什么不干脆让OpenLayers项目回来的吗?所以,如果你想要的中心点为WGS84然后就去做:
var center = map.getCenter().transform(map.getProjectionObject(),
new OpenLayers.Projection("EPSG:4326"));
我想你会发现,会做你想要什么,无论如何,至少如果我理解正确的问题... 顺便说一句,EPSG:4326是你似乎在寻找自然的WGS84纬度/经度值-大型数字投影的坐标是EPSG:900913。
本文标题 :OSM:转换在球墨卡托投影坐标关系“EPSG:900913”到“EPSG:4326”坐标