【问题标题】:X,Y image coordinate to Latitude and Longitude with rotationX,Y 图像坐标到纬度和经度与旋转
【发布时间】:2013-09-04 08:38:17
【问题描述】:

好的,我有这些来自 Google 地球的图像叠加数据,如下所示:

North: -7.340917
South: -7.34100
East: 112.751217
West: 112.751167
Rotation: 25.0000

我已经成功地将我的图像点 (x,y) 转换为 Lat, Lng 使用这些函数:

static Double DEGREES_PER_RADIAN = 180 / Math.PI;
static Double RADIAN_PER_DEGREES = Math.PI / 180;

public static double Gudermannian(double y)
{
    return Math.atan(Math.sinh(y)) * DEGREES_PER_RADIAN;
}

public static double GudermannianInv(double latitude)
{
    double sign = Math.signum(latitude);
    double sin = Math.sin(latitude * RADIAN_PER_DEGREES * sign);
    return sign * (Math.log((1.0 + sin) / (1.0 - sin)) / 2.0);
}

Double mapLatNorth = -7.340917;
Double mapLatSouth = -7.34100;
Double mapLonWest = 112.751167;
Double mapLonEast = 112.751217;

Double ymax = GudermannianInv(mapLatNorth);
Double ymin = GudermannianInv(mapLatSouth);                 
Float latPoint = (float) Gudermannian(ymax - ( ((double) pointY / imgHeight) * (ymax - ymin) )) ;

Double mapLonDelta = mapLonEast - mapLonWest;
Float lngPoint = (float) (mapLonWest + pointX / imgWidth * mapLonDelta);

我从中得到的价值

latPoint

和

lngPoint

是正确的,但尚未旋转。 我的问题是:如何将这些 Lat/Lng 值旋转 25 度?

我未能从 Ewan Todd 在Calculate lat/lng of corners of ground overlay from kml-file 的回答中获得纬度/经度值

【问题讨论】:

    标签: android google-maps maps google-maps-android-api-2


    【解决方案1】:

    这应该可以通过简单的 2D 旋转来实现,应该是这样的:

    public Float rotateLatitudeAround(Float lat, double angle, Point center) {
        lat = center.lat + (Math.cos(Math.toRadians(angle)) * (lat - center.lat) - Math.sin(Math.toRadians(angle)) * (lon - center.lon));
        return lat;
    }
    
    public Float rotateLongitudeAround(Float lon, double angle, Point center) {
        lon = center.lon + (Math.sin(Math.toRadians(angle)) * (lat - center.lat) + Math.cos(Math.toRadians(angle)) * (lon - center.lon));
        return lon;
    }
    

    但是改变

    center.lat 
    

    到

    center.getLatitudeE6()/1E6 
    

    什么的。

    编辑:我确实忘记了这仅适用于点 x,y。但是您可以先获取与地图投影中心相关的纬度、经度点,然后再从投影反向地图中获取经度、经度值?

    【讨论】:

    • 嗯,你能解释一下什么是“中心”吗?它是图像的中心吗?
    • 应该是你旋转的中心。
    猜你喜欢
    • 2013-02-23
    • 1970-01-01
    • 2011-12-05
    • 2016-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    相关资源
    最近更新 更多