我在数据库中有一组以EPSG 3857格式存储的坐标列表。 我需要将它们转换为EPSG 4326格式。 我尝试使用DotSpatial,但我的代码总是返回一个无限大的双精度数组。
public double[] ConvertCoodinates()
{
double[] xy = new double[2];
xy[0] = 5085240.8300000000;
xy[1] = 1530088.9600000000;
//An array for the z coordinate
double[] z = new double[1];
z[0] = 0;
ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
pStart.AuthorityCode = 3857;
ProjectionInfo pEnd = KnownCoordinateSystems.Geographic.World.WGS1984;
pEnd.AuthorityCode = 4326;
Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);
return xy;
}
这个xy数组总是包含无限大; 有人能帮忙吗?
private double[] ConvertCoordinate(double lat, double lng) { double x = lng * 20037508.34 / 180; double y = Math.Log(Math.Tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180); y = y * 20037508.34 / 180; return new double[] { x, y }; }
- Sethlans