如何在屏幕上绘制纬度/经度坐标?
我试图弄清楚如何在位图上绘制 WGS84 纬度/经度点,但无法弄清楚将纬度/经度点转换为可绘制坐标所需的数学。谁能给我一些关于如何做到这一点的指示或例子?
谢谢科林
I am trying to figure out how to plot WGS84 latitude/longitude points on a bitmap but cannot figure out the math required to turn lat/lon points into coordinates that would be plottable. Could anyone give me some pointers or examples on how to do this?
thanks
Colin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将纬度经度转换为 x, y 以在平面 2d 表面(如位图)上绘图是一个庞大而复杂的主题。
有关此内容的一般信息,请参阅维基百科上的地图投影。
一般来说,谷歌地图和 bing 等网站通过在完美球体上使用墨卡托投影来解决这个问题,该投影可以轻松覆盖地球的大部分地区(除了北极/南极),并且对于大多数用途来说“足够好”。然而,这些都是一些大的假设,这实际上取决于您的照片需要有多准确以及它们需要保留什么。
不幸的是,我不太了解delpi,无法提供源代码,但是墨卡托投影的数学有详细记录这里< /a>.
如果精度根本不是问题并且您的点“靠近”,最简单的方法是简单地使用常数因子和偏移量将纬度/经度转换为适合位图的 x 和 y 值。
这可能会使您的图片在北/南方向上稍微挤压,但通常会产生类似于墨卡托的图片,而没有自然对数和正弦/正切调用。
Turning latitude longitude into x, y for plotting on a flat 2d surface like a bitmap is a large and complicated topic.
For general information about this see map Projections on wikipedia.
In general websites like google maps and bing solve this problem by using a mercator projection on a perfect sphere which can easily cover most of the earth (except the north/south pole) and be 'good enough' for most purposes. However, those are some big ifs and it really depends on how accurate your pictures need to be and what they need to preserve.
Unfortunately I don't know delpi well enough to provide source code but the math for mercator projections is well documented here.
If accuracy is not an issue at all and your points are 'close together', the simplest method would be to simply use a constant factor and offset to shift latitude/longitude into x and y values that fit onto your bitmap.
This might make a slightly squish your pictures in the north/south direction but in general will produce pictures much like mercator without the natural logarithms and sin/tangent calls.
您可以查看带有 Delphi 源代码的墨卡托投影演示:
http://delphiforfun.org/程序/MercatorDemo.htm
You might have a look at the Mercator Projection Demo, with Delphi source code:
http://delphiforfun.org/programs/MercatorDemo.htm
正如 MerickOWA 已经提到的,这个问题没有正确的答案,因为它取决于您正在工作的规模以及您所需的准确性。这很大程度上取决于您正在讨论的 .bmp 上的内容。如果它是墨卡托投影的全球地图,那么格雷格的回答会给你一些指示。如果它是本地地图,那么它将取决于地图使用的基准以及使用的投影(并且基准将在很大程度上由相关国家的国家当局确定)。
话虽如此,如果您想要做的只是将 GPS 提供的经纬度(GS84 基准)投影到覆盖区域 <1 的本地地图上。 6° 纬度,那么您可能会比将 WGS84 Lat Lon 投影到 WGS84 UTM 投影,然后缩放(并且可能)旋转地图以适应 2 个已知坐标更糟糕。
这里的链接应该提供一些帮助 http://www.uwgb.edu/dutchs/usefuldata /utmformulas.htm
As already mentioned by MerickOWA, there is no right answer to the question as it depends on the scale you are working at, and the accuracy you require. This will largely be determined by what is on the .bmp you are discussing. If it is a global map in Mercator projection, then Greg's answer will give you some pointers. If it is a local map, then it will depend on the datum the map is using, and the projection used (and the datum will largely be determined by the national authority of the country in question).
Having said all that, if what you want to do is just project a GPS provided Lat Lon (GS84 datum) onto a local map covering an area < 6° of Latitude, then you could do worse than projecting the WGS84 Lat Lon to a WGS84 UTM projection, then scaling (and possibly)rotating the map to fit at 2 known coordinates.
The link here should give some help http://www.uwgb.edu/dutchs/usefuldata/utmformulas.htm
您是否尝试过世界坐标转换器:http://twcc.free.fr?
Did you try The World Coordinate Converter: http://twcc.free.fr ?