如何处理大的,WGS84点坐标?
我认为,我能做的是将世界(WGS84)点转换为屏幕上像素的点。这是一种好方法吗?它仍然不能正确地工作,因为需要大变焦,并且我必须将单位从米更改为毫米(但如何呢?只需将点的x和y相乘?)。
发布于 2014-03-30 20:17:16
对于这个映射问题,这里有一个非常简单的方法。地理学家可能会对此叫苦连天,但只要坐标低于大约70°纬度,并且窗口大小不太大,它在实践中就能很好地工作。此外,不要试图仅使用大对象的起点和终点来直接映射大对象(例如非常长的线)。
public PointF GeoCoordToPixel(IGeographicPosition geoPos)
{
double tempLong = geoPos.Longitude;
if (tempLong > CenterPos.Longitude && (tempLong - CenterPos.Longitude) > 180)
{
// the position is to the left, over the antimeridian
tempLong = tempLong - 360;
}
if (tempLong < CenterPos.Longitude && (CenterPos.Longitude - tempLong) > 180)
{
// the position is to the right, over the antimeridian
tempLong = tempLong + 360;
}
PointF pt = new PointF(
(float)((tempLong - LongitudeOfOrigin) / LongitudeIncrement),
(float)((-geoPos.Latitude + LatitudeOfOrigin) / LatitudeIncrement));
return pt;
}其中CenterPos =窗口中心;LatituteOfOrigin / LongitudeOfOrigin =窗口左上位置;LongitudeIncrement / LatitudeIncrement =视图比例。它们的关系是:
LatitudeOfOrigin = CenterPos.Latitude + (m_drawingBuffer.Height / 2.0 * LatitudeIncrement);
LongitudeOfOrigin = CenterPos.Longitude - (m_drawingBuffer.Width / 2.0 * LongitudeIncrement);反之亦然:
public CGeographicPosition PixelToGeoCoord(PointF pt)
{
double latitude = -(pt.Y * LatitudeIncrement) + LatitudeOfOrigin;
double longitude = (pt.X * LongitudeIncrement) + LongitudeOfOrigin;
if (longitude > 180)
{
longitude -= 360;
}
return (new CGeographicPosition(latitude, longitude, 0));
}不是很难,不是吗?
https://stackoverflow.com/questions/22743069
复制相似问题