gpt4 book ai didi

ios - 根据用户的地址限制用户看到的 Google map 区域?

转载 作者:行者123 更新时间:2023-11-30 13:05:23 24 4
gpt4 key购买 nike

我正在使用 Google Maps API,但有几个问题。我想让我当前的用户在每个方向上只能看到距其家庭住址 10 英里的范围。

我已经显示了用户的家庭地址。我只需要知道如何制作它,使其只在 map 上显示 10 英里的有限区域。

这是我显示用户家庭住址的方式:

func getCurrentUsersHomeAddress() {
let userID = currentUser?.uid
ref.child("users").child(userID!).observeSingleEventOfType(.Value, withBlock: { (snapshot) in
// Get user value
let username = snapshot.value!["fullName"] as! String
let homeAddress = snapshot.value!["homeAddress"] as! [Double]
let email = snapshot.value!["email"] as! String
let lat = homeAddress[0] as Double
let long = homeAddress[1] as Double
let coords = CLLocationCoordinate2D(latitude: lat as CLLocationDegrees, longitude: long as CLLocationDegrees)
self.mapView.camera = GMSCameraPosition(target: coords, zoom: 15, bearing: 0, viewingAngle: 0)
let marker = GMSMarker(position: coords)

请记住,我只想显示 10 英里的 map 。任何帮助将不胜感激。

最佳答案

编辑

一个similar question有您可能正在寻找的答案。然而,他们中的大多数都使用覆盖层来限制它。希望这有帮助!

关于ios - 根据用户的地址限制用户看到的 Google map 区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39439136/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com