标签: gmsmapview

中心的GMSMarker图标(iOS)

我刚从Apple Maps切换到Google Maps.我似乎无法找到答案的问题是如何使GMSMarker的图标从中心开始,而不是从图像的底部开始.

我的意思是当前位置点图标以其要表达的坐标为中心开始.但是,GMSMarkers图标从图标的底部开始.

google-maps center google-maps-markers ios gmsmapview

31
推荐指数
3
解决办法
1万
查看次数

在iOS中的GMSMapView上绘制两个位置之间的路径

我正在开发一个iOS应用程序.在该应用程序中,我有两个字段From和To.我使用谷歌自动完成API输入地址.我也能够获得2个地方的纬度经度,并能够显示标记GMSMapView.

现在我想画这两个地方之间的路线.我们在使用时找到了解决方案MKMapView.但我无法找到解决方案GMSMapView.请帮我画出这两点之间的路线GMSMapView.

如果可能的话,请给我一些重要的链接.

谢谢.

google-maps ios google-polyline ios7 gmsmapview

30
推荐指数
6
解决办法
6万
查看次数

GoogleMaps(GMSView)无法在iOS中显示

我已合并以下内容:

  1. 尝试通过桥接标头 导入GoogleMaps/GoogleMaps.h以及GoogleMapsM4B/GoogleMaps.h文件Obj-C
  2. 在我的AppDelegate.swift (didFinishLaunchingWithOptions)方法中手动输入iOS API密钥.
  3. 清理项目(命令+ shift + k)
  4. 关闭/重新启动Xcode
  5. 卸载/重新安装Xcode

几乎所有其他人都建议的其他东西.我花了两天时间试图解决这个问题.有谁知道这个问题的解决方案?

控制台投诉是:

> "2015-08-17 18:02:19.899 Project[608:10014] ClientParametersRequest
> failed, 3 attempts remaining (0 vs 6). Error
> Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be
> completed. (com.google.HTTPStatus error 400.)" UserInfo=0x790bc050
> {data=<CFData 0x7925cb40 [0x22da9a8]>{length = 145, capacity = 256,
> bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
> 2015-08-17 18:02:19.899 randoPracty[608:10014] Google Maps SDK for iOS
> (M4B) version: 1.10.17867.0 2015-08-17 18:02:19.959
> randoPracty[608:10014] …
Run Code Online (Sandbox Code Playgroud)

xcode google-maps ios gmsmapview swift

27
推荐指数
3
解决办法
2万
查看次数

如何在Google Maps iOS SDK中强制刷新markerInfoWindow的内容

我要回来了 UIImageView in - (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker;

UIImageView将通过URL动态加载图像SDWebImage.

正如文档中描述的标记信息窗口:

注意:每次在地图上显示信息窗口时,信息窗口都会呈现为图像.这意味着在其属性处于活动状态时对其属性的任何更改都不会立即可见.信息窗口的内容将在下次显示时刷新.

关键是在下载图像后,信息窗口不刷新并继续显示占位符图像,直到用户隐藏然后再显示它.

所以我需要强制刷新markerInfoWindow下载的图像块中的内容.

google-maps-markers google-maps-sdk-ios gmsmapview

25
推荐指数
2
解决办法
7060
查看次数

如何在GMSMapView中获取动画折线路径,以便在移动地图时它与地图一起移动?

我已经通过以下代码创建了像CAShapeLayer的动画折线,我已经将CAShapeLayer添加为GMSMapiew的子图层,但是,如果我移动地图,图层将不会移动.在哪里添加图层,以便它与地图一起移动?

   func layer(from path: GMSPath) -> CAShapeLayer {
        let breizerPath = UIBezierPath()
        let firstCoordinate: CLLocationCoordinate2D = path.coordinate(at: 0)
        breizerPath.move(to: self.mapView.projection.point(for: firstCoordinate))
        for i in 1 ..< Int((path.count())){
            print(path.coordinate(at: UInt(i)))
            let coordinate: CLLocationCoordinate2D = path.coordinate(at: UInt(i))
            breizerPath.addLine(to: self.mapView.projection.point(for: coordinate))
        }

        let shapeLayer = CAShapeLayer()
        shapeLayer.path = breizerPath.reversing().cgPath
        shapeLayer.strokeColor = UIColor.green.cgColor
        shapeLayer.lineWidth = 4.0
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.lineJoin = kCALineJoinRound
        shapeLayer.lineCap = kCALineCapRound
        shapeLayer.cornerRadius = 5
        return shapeLayer
    }

    func animatePath(_ layer: CAShapeLayer) {
        let pathAnimation = CABasicAnimation(keyPath: "strokeEnd")
        pathAnimation.duration = 6 …
Run Code Online (Sandbox Code Playgroud)

ios google-maps-sdk-ios gmsmapview swift

19
推荐指数
2
解决办法
1万
查看次数

在面向用户的方向上旋转GMSMarker

我要求在我当前的位置显示一个视图.如果设备旋转或位置将改变它将旋转.我研究很多,但得到所有代码,在某些位置有固定位置或角度但我没有固定位置.任何人都可以朝正确的方向开车.

我还使用了GMSMarker的旋转属性,但它不起作用.

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
    if (newHeading.headingAccuracy < 0){
        NSLog(@"heading accuracy < 0");
        return;
    }

    // Convert Degree to Radian and move the needle
    float oldRad =  (- manager.heading.trueHeading) * M_PI / 180.0f;
    float newRad =  (- newHeading.trueHeading) * M_PI / 180.0f;

    // Compass animation
    CABasicAnimation *theAnimation;
    theAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    theAnimation.fromValue = [NSNumber numberWithFloat:oldRad];
    theAnimation.toValue   = [NSNumber numberWithFloat:newRad];
    theAnimation.duration  = 0.5f;
    [source.layer addAnimation:theAnimation forKey:@"animateMyRotation"];

//    source.transform =  CGAffineTransformMakeRotation(newRad)
//    GMSMarker *source = [googleMap selectedMarker]; …
Run Code Online (Sandbox Code Playgroud)

objective-c google-maps-markers cllocationmanager ios gmsmapview

16
推荐指数
3
解决办法
1万
查看次数

将Google地图相机移动到某个位置

我正在使用谷歌地图视图,我想在地图上添加一个按钮,当点击时,将按钮移动到特定位置.我目前有一个按钮插座和一个连接到该按钮的动作.

@IBAction func locationTapped(_ sender: Any) {
    print("tapped")
    let location = GMSCameraPosition.camera(withLatitude: place.latitude, longitude: place.longitude, zoom: 17.0)

    mapView.camera = location
}
Run Code Online (Sandbox Code Playgroud)

place存在但由于某种原因,相机不会让步.我尝试过不同版本的代码并查看了Google Maps文档,但没有一个选项可以产生结果.谁能告诉我我做错了什么?

location google-maps ios gmsmapview swift

14
推荐指数
2
解决办法
2万
查看次数

从GMSMapView中删除所有GMSMarker?

我在GMSMapView上放置了100个GMSMarkers.如何删除所有GMSMarkers?

在适用于iOS的Google Sdk 1.6版中.

不推荐使用将保存GMSMarkers列表的标记数组(在GMSMapView(Overlays)文件中).通过使用这个我从GMSMapView中删除所有GMSMarker.

有没有其他方法可以从iOS中的GMSMapView中删除所有GMSMarker?

marker ios google-maps-sdk-ios gmsmapview

13
推荐指数
3
解决办法
1万
查看次数

如何移动标记以及在iOS中移动Google Map?

我在特定位置显示标记,并在Google地图上的地址标签中显示当前地址.

现在,我想通过移动谷歌地图来改变位置,但问题是当我移动地图时,我应该同时移动标记和地图,我应该在地址标签中显示该位置的地址.

我怎样才能做到这一点?

我试过这个:

let destinationMarker = GMSMarker(position: self.destinationLocation.coordinate)

let image = UIImage(named:"sourcemarker")
destinationMarker.icon = image
destinationMarker.draggable = true
destinationMarker.map = self.viewMap
//viewMap.selectedMarker = destinationMarker
destinationMarker.title = "hi"
destinationMarker.userData = "changedestination"

func mapView(mapView: GMSMapView, didEndDraggingMarker marker: GMSMarker)
{
    if marker.userData as! String == "changedestination"
    {
        self.destinationLocation = CLLocation(latitude: marker.position.latitude, longitude: marker.position.longitude)
        self.destinationCoordinate = self.destinationLocation.coordinate
        //getAddressFromLatLong(destinationCoordinate)
    }
}
Run Code Online (Sandbox Code Playgroud)

google-maps ios google-maps-sdk-ios gmsmapview swift

12
推荐指数
3
解决办法
2万
查看次数

使用ios中的Google Map sdk从GMSMapview中删除特定的GMSMarker

我正在整合谷歌地图sdk.一切正常.但是当第二个出现时如何删除特定标记(Pin Point).(我不使用Mapkit)

我想要以下内容:

如果我点击地图然后现在在该位置生成一个标记引脚,如果我点击地图上的另一个位置然后显示两个引脚但我想要移除旧的标记引脚.

我也用,

[self.mapView clear];
Run Code Online (Sandbox Code Playgroud)

但很明显GMSMapview中的所有其他标记点.

以下是在地图上添加图钉的代码:

            GMSMapView *mapView;
            GMSMarker *currLocMarker = [[GMSMarker alloc] init];
            currLocMarker.map  = nil;
            [currLocMarker setTitle:NSLocalizedString(@"current_location_title", nil)];
            currLocMarker.icon = [UIImage imageNamed:@"pin_fetch_location.png"];
            currLocMarker.position = CLLocationCoordinate2DMake(pCoordinate.latitude, pCoordinate.longitude);
            currLocMarker.map = self.mapView;
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个问题.. !!

提前致谢..:)

iphone google-maps ios gmsmapview

11
推荐指数
2
解决办法
2万
查看次数