(英国)裁剪地图上 x 和 y 的墨卡托经度和纬度计算

Mercator longitude and latitude calculations to x and y on a cropped map (of the UK)((英国)裁剪地图上 x 和 y 的墨卡托经度和纬度计算)
本文介绍了(英国)裁剪地图上 x 和 y 的墨卡托经度和纬度计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有这张图片.这是英国的地图(不包括南爱尔兰):

I have this image. It's 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.

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

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.

我不知道该怎么做.我找到的所有例子都在解释如何为全世界做这件事.This 是一个很好的示例资源,用于解释如何实现投影,但我没有能够让它工作.

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!

谢谢

推荐答案

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

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 的墨卡托经度和纬度计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)