提问者:小点点

如何获取世界地图图像的纬度和经度信息


在此处输入图像描述您好,我正在尝试查找此号码

从这个问题:将经度和纬度坐标转换为地图像素X和Y坐标的图像Java

 int mapWidth = 614, mapHeight = 1141;
    double mapLongitudeStart = 33.5, mapLatitudeStart = 33.5;//longitude vertical, latitude horizontal
    // length of map in long/lat
    double mapLongitude = 36.5 - mapLongitudeStart,
    // invert because it decreases as you go down
    mapLatitude = mapLatitudeStart - 29.3;

如何从世界地图图像中找到此数字


共1个答案

匿名用户

试试这个:

int mapWidth = 614, mapHeight = 1141;
double mapLongitudeWidth = 36.5, mapLatitudeHeight = 29.3;
double mapLongitudeStart = 33.5, mapLatitudeStart = 33.5;//longitude vertical, latitude horizontal
// length of map in long/lat
double mapLongitude = mapLongitudeWidth - mapLongitudeStart;
// invert because it decreases as you go down
double mapLatitude = mapLatitudeStart - mapLatitudeHeight;

int xImagePos = (int) (mapWidth * (mapLongitude/mapLongitudeWidth));
int yImagePos = (int) (mapHeight * (mapLatitude/mapLatitudeHeight));

System.out.println("x: " + xImagePos + ", y: " + yImagePos);

mapLongitudeStart和mapLatitudeStart都是33.5似乎很奇怪。打字错误?