如何获得长& android中地图视图中四个角的纬度值?
我正在处理地图视图。我想将覆盖项目放在地图视图上。覆盖项目全部取决于当前显示的地图视图和缩放级别。如何获取当前地图视图四个角的经度和纬度以及如何分析其中有多少覆盖项。我们还必须检查缩放级别。有什么想法吗?怎么办呢?
i working on map view. i want to put overlay item on the map view. that overlay items are all depends on currently showing map view and zoom level. how to get current map view's longitude and latitude of that four corner and how to analyze how many overlay item inside it. also we have to check thee zoom level.Any Idea? how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你必须使用
屏幕的 4 个角(你可以通过 mapView 上的 getwidth 和 getheight 获取它们的坐标,并从 (0,0), (getwidth(),0), (0,getheight() 开始) 和 (getwidth(), getheight())
这将为您提供 4 个地理点,您可以从中提取纬度和经度
I think you have to use
For the 4 corners of your screen (you can get their coordinates by getwidth and getheight on your mapView, and starting with (0,0), (getwidth(),0), (0,getheight()) and (getwidth(), getheight())
This will give you 4 geopoints from which you can extract latitude and longitude
如果您使用
google-play-services
库,尤其是SupportMapFragment
。this.getMap()
将为您提供GoogleMap
的实例(它包装MapView
),然后只需:
map.getProjection()。 getVisibleRegion();
If you're using the
google-play-services
library and theSupportMapFragment
in particular.this.getMap()
will give you the instance ofGoogleMap
(which wrapsMapView
)Then just:
map.getProjection().getVisibleRegion();
您在寻找这样的东西吗?
希望有帮助!
Are you looking for something like this?
Hope it helps!