在英国的裁剪地图上墨卡托经度和纬度计算到x和y [英] Mercator longitude and latitude calculations to x and y on a cropped map (of the UK)

查看:193
本文介绍了在英国的裁剪地图上墨卡托经度和纬度计算到x和y的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这张图片: http://imgur.com/99tSz.png 。英国地图(不包括南爱尔兰)。

我已成功设法获取经纬度,并将其绘制到此地图上,方法是将最左边的经度和最右边的英国的经度,并使用它们来确定将点放在地图上的位置。



这是代码(用于Processing.js,但可用作js或任何东西):

  //地图大小
int width = 538;
int height = 811;
// X和Y边界
float westLong = -8.166667;
float eastLong = 1.762833;
float northLat = 58.666667;
float southLat = 49.95;

void drawPoint(float latitude,float longitude){

fill(#000000);

x = width *((west long long)/(west Long-east Long));
y =(height *((northLat-latitude)/(northLat-southLat)));

console.log(x +,+ y);
ellipseMode(RADIUS);
椭圆(x,y,2,2);

}

然而,我还没有能够实现墨卡托对这些值的投影。这些情节是相当准确的,但他们不够好,这个预测会解决它。



我无法弄清楚如何去做。我发现的所有例子都解释了如何为整个世界做到这一点。 这是一个很好的解释如何实现投影的例子资源,但我还没有能够得到它的工作。



另一个资源是英国极端点,我得到了英国边界框的经度和纬度值。他们也在这里:

  northLat = 58.666667; 
northLong = -3.366667;
eastLat = 52.481167;
eastLong = 1.762833;
southLat = 49.95;
southLong = -5.2;
westLat = 54.45;
westLong = -8.166667;

如果有人可以帮我解决这个问题,我将非常感激!



谢谢

解决方案

我认为值得记住的是,并非所有的平面地图都是墨卡托投影。特别是在不了解该地图的情况下,很难确定。您可能会发现,世界上一小部分地区的大多数地图更可能是一种圆锥形型投影,其中地图上的感兴趣区域比全球墨卡托投影上的平坦 。这一点尤其重要的是你离开赤道越远越远(而英国距离它足够遥远)。



你也许能够接近足够,使用你正在尝试的计算,但为了获得最佳准确性,你可能想要使用定义明确的投影的地图,或创建自己的地图。


I have this image: http://imgur.com/99tSz.png. A map of the UK (not including Southern Ireland).

I have successfully managed to get a latitude and longitude and plot it onto this map by taking the leftmost longitude and rightmost longitude of the UK and using them to work out where to put the point on the map.

This is the code (for use in Processing.js but could be used as js or anything):

// Size of the map
int width = 538;
int height = 811;
// X and Y boundaries
float westLong = -8.166667;
float eastLong = 1.762833;
float northLat = 58.666667;
float southLat = 49.95;

void drawPoint(float latitude, float longitude){

 fill(#000000);

 x = width * ((westLong-longitude)/(westLong-eastLong));
 y = (height * ((northLat-latitude)/(northLat-southLat)));

 console.log(x + ", " + y);
 ellipseMode(RADIUS);
 ellipse(x, y, 2, 2);    

}

However, I haven't been able to implement a Mercator projection on these values. The plots are reasonably accurate but they are not good enough and this projection would solve it.

I can't figure out how to do it. All the examples I find are explaining how to do it for the whole world. This is a good resource of examples explaining how to implement the projection but I haven't been able to get it to work.

Another resource is the Extreme points of the United Kingdom where I got the latitude and longitude values of the bounding box around the UK. They are also here:

northLat = 58.666667; 
northLong = -3.366667; 
eastLat = 52.481167; 
eastLong = 1.762833; 
southLat = 49.95;
southLong = -5.2; 
westLat = 54.45;
westLong = -8.166667;

If anyone could help me with this, I would greatly appreciate it!

Thanks

解决方案

I think it's worthwhile to keep in mind that not all flat maps are Mercator projections. Without knowing more about that map in particular, it's hard to be sure. You may find that most maps of a small area of the world are more likely to be a conical type projection, where the area of interest on the map is "flatter" than would be on a global Mercator projection. This is especially more important the further you get away from the equator (and the UK is far enough away for it to matter).

You may be able to get "close enough" using the calculations you're trying, but for best accuracy you may want to either use a map with a well-defined projection, or create your own map.

这篇关于在英国的裁剪地图上墨卡托经度和纬度计算到x和y的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆