从Google地图的点击叠加中获取LAT和LONG [英] Get LAT and LONG from tapped overlay in Google Maps

查看:98
本文介绍了从Google地图的点击叠加中获取LAT和LONG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户点击覆盖时,将触发以下代码:

When a user taps an overlay, the following code is triggered:

func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {


    }

我想知道我们是否可以提取出已点击的叠加层的确切LAT和LONG坐标?

I wonder if we can extract the exact LAT and LONG coordinates of the overlay that has been tapped?

谢谢!

推荐答案

您可以将didTapAt委托方法用于相同的方法.

You can use didTapAt delegate method for the same.

@wajih,因为您在点击地标名称或标题时是否调用了didTapAt方法?对我来说,它没有被调用. 对于我来说,地标标题位于多边形上方,并且didTapAt方法没有被调用,但是如果我将tappable设置为true,那么didTap(overlay)会被完美调用.

@wajih, for you did the method didTapAt was called when you tap on landmark names or titles? For me it's not getting called. For my case the landmark title is above the polygon and the didTapAt method is not getting called, but if i set tappable to true then didTap(overlay) is called perfectly.

这篇关于从Google地图的点击叠加中获取LAT和LONG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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