谷歌地图坐标透视地图图像坐标 [英] Google Maps coordinates to perspective map image coordinates

查看:157
本文介绍了谷歌地图坐标透视地图图像坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个使用图片作为地图的android应用程序。



我有一个透视图像,需要放置一些图钉并向用户显示他是。



如何将Google地图坐标转换为图片中的位置?



谢谢



解决方案

这里没有代码可以共享,因为它取决于你如何显示图像(我假设你没有使用GoogleMap对象和地面覆盖图。 ..你必须创建你的特定函数重新映射图像坐标(你可以尝试在0和1之间归一化)和世界坐标(这取决于哪里如果您使用的是GoogleMap对象,则可以将该图像放置在Google地图上,然后使用常规坐标;此处的页面为: https://developers.google.com/maps/documentation/android/groundoverlay



您可以添加它:

  LatLng NEWARK =新LatLng(40.714086,-74.228697); 
GroundOverlayOptions newarkMap = new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922))
.position(NEWARK,8600f,6500f);
map.addGroundOverlay(newarkMap);

显然,您必须找到您的位置并查看关于使用哪种方法的文档,因为您可以使用以上一个或几个:

  position(LatLng位置,浮动宽度,浮动高度)
位置(LatLng位置,float width)
positionFromBounds(LatLngBounds界限)

PS:如果您未使用GoogleMap对象这个问题不是谷歌地图相关,但与地理信息系统相关(我建议 https://gis.stackexchange.com/在这种情况下)。


I'm creating an android app that uses a image as a map.

I have a image in perspective and need to put some pins and show the user where he is.

How can I convert the google maps coordinates to the position in the image?

Thank you

解决方案

there is no code to share here since it it dependent on how you show the image (I assume you are not using GoogleMap object and ground overlay...

You have to create your specific function for reprojecting the image coordinates (that you can try to normalize between 0 and 1) and the world coordinates (which depends on where in the world is that place).

If you are using instead GoogleMap object, you can place that image over google maps and then use the normal coordinates; here the page: https://developers.google.com/maps/documentation/android/groundoverlay

you can add it by:

LatLng NEWARK = new LatLng(40.714086, -74.228697);
GroundOverlayOptions newarkMap = new GroundOverlayOptions()
        .image(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922))
        .position(NEWARK, 8600f, 6500f);
map.addGroundOverlay(newarkMap);

Obviously you have to find your position and check the documentation on which method use, because you can use the above one or a few others:

position(LatLng location, float width, float height)
position(LatLng location, float width)
positionFromBounds(LatLngBounds bounds)

PS: If you are not using GoogleMap objects this question is not "google-maps" related but GIS-geopositioning related (I would suggest https://gis.stackexchange.com/ in this case).

这篇关于谷歌地图坐标透视地图图像坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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