WGS84 到 Google 地图位置和返回的 Java 代码
搜索一些示例代码,用于将 WGS84 坐标系中的点转换为 Google 地图中的地图位置(像素位置),还支持缩放级别。
如果代码有很好的注释,那么它也可以采用其他语言。
您还可以向我指出一个开源 Java 项目:)
找到的一些资源:
OpenLayer 实现。
JOSM 项目
优秀 来自 JH LABS 的 Java 地图投影库 。 这是一个纯 java PROJ.4 端口。 从 WGS84 投影到米。 从这里开始,将米转换为平铺像素就非常简单了。
Searching for some sample code for converting a point in WGS84 coordinate system to a map position in Google Maps (pixel position), also supporting zoom levels.
If the codes is well commented, then it can also be in some other language.
You can also point me to a open source Java project :)
Some resources found:
OpenLayer implementation.
JOSM project
Excellent Java Map Projection Library from JH LABS. This is a pure java PROJ.4 port. Does projection from WGS84 to meters. From there it's quite straightforward to convert meters to tile pixels.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有人从 Google 地图中获取了 javascript 代码并将其移植到 python 中: gmerc.py
我用过这个,效果很好。
Someone took the javascript code from Google Maps and ported it to python: gmerc.py
I've used this and it works great.
mapki 上的 Java 平铺实用程序代码。 com(谷歌地图开发人员的重要资源)
Tile utility code in Java on mapki.com (great resource for google map developers)
以下是 JavaSCript 中的函数...从 OpenLayers 中
提取 转换为 Java 相当简单
Here are the functions in JavaSCript ... As extracted from OpenLayers
Fairly straightforward to convert to Java
GeoTools 有代码可以转换为从你能想象到的任何坐标系,其中也包括谷歌地图的坐标系。 它也是开源的。 然而,还应该指出的是,GeoTools 是一个大型库,因此,如果您正在寻找小型、快速且简单的东西,那么它可能不是最佳选择。
如果您还打算进行其他 GIS/坐标转换等,我会强烈推荐它。
如果您使用 GeoTools 或类似工具,您可能还会有兴趣了解 Google 地图坐标系称为 EPSG 3785。
GeoTools has code to transform to and from about any coordinate system you could imagine, and among them also Google Map's. It's also open source. However, it should also be pointed out that GeoTools is a large library, so if you're looking something small, quick and easy, it's likely not the way to go.
I would highly recommend it though if you're going to do other GIS/coordinate transformations, etc. as well.
If you use GeoTools or something similar, you might also be interested in knowing that the Google Map coordinate system is called EPSG 3785.
我将其移植到 PHP - 这是代码,如果有人需要的话:
到 Mercator:
从 Mercator:
I ported this to PHP - here's the code, if anyone would need it:
To mercator:
From mercator: