确定给定地图中的投影

发布于 2024-08-12 14:45:36 字数 352 浏览 10 评论 0原文

我意识到这可能不是一个编程问题,但这是我作为程序员不断遇到的问题,所以我认为这里的其他人可能有有用的知识可以分享。

我有一张地球某个区域的地图(可以是任何区域,但这里是 示例)我应该如何确定地图中使用的投影,然后如何以编程方式将纬度和经度坐标转换为图像上的像素位置。

目前我有 matlab 代码来打开图像并绘制结果 (x,y) 坐标,但我不知道如何将纬度/经度转换为 x,y!

任何帮助将不胜感激。

I realise this is potentially not a programming question, however its a problem I keep bumping into as a programmer, so I figure others here might have useful knowledge to share.

I have a map of a region of the earth (it could be any, but here's an example) how should I determine the projection used in the map and then how should I programatically transform latitude and longitude coordinates into pixel positions on the image.

At the moment I have matlab code to open the image and plot the resulting (x,y) coord, but I can't figure out how to convert lat/longs to x,y!

Any help at all would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

年少掌心 2024-08-19 14:45:36

地理坐标是球坐标的变体。您可以将它们转换为正常坐标:

x = r * sin(90 - lat) * cos(lon)
y = r * sin(90 - lat) * sin(lon)
z = r * cos(90 - lat)

这并不准确,因为地球并不完全是一个球体。根据地图的类型,有多种方法可以从中获取 2D 坐标。图像可以从球体投影到圆柱体或两个平面。

这些链接可能会有所帮助:

Geographic coordinates are a variation of spherical coordinates. You can transform them to normal coordinates:

x = r * sin(90 - lat) * cos(lon)
y = r * sin(90 - lat) * sin(lon)
z = r * cos(90 - lat)

This is not really accurate because Earth is not exactly a sphere. Depending on the type of the map there are several ways to obtain 2D coordinates from these. The image may be projected from the sphere to a cylinder or two planes.

These links might help:

猫七 2024-08-19 14:45:36

事实证明,以编程方式计算地图的投影是一项复杂的图像处理任务。我设法解决这个问题的方法是简单地使用具有明确定义的投影的地图 - 例如,谷歌地图使用墨卡托投影,英国的大多数地图也是如此(因为我们的英国参考网格基于通用横轴墨卡托投影)。

我希望这可以帮助别人!

It turns out that programatically calculating the projection of a map is a complex task of image processing. The way I managed to get around this problem is simply using maps that have well defined projections - for example Google maps use the Mercator projection, as do most maps of the UK (as our British Reference Grid is based on the Universal Transverse Mercator).

I hope this helps someone else out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文