我正在开发一个iOS应用程序。在那个应用程序中,我有2个字段,从和到。我使用Google Auto Complete API输入了地址。我也能够获取2个地方的纬度和经度,并能够在上显示标记GMSMapView
。
现在,我想在这两个地方之间绘制路线。我在使用时找到了解决方案MKMapView
。但是我无法找到解决方案GMSMapView
。请帮我在中画出这两个点之间的路线GMSMapView
。
如果可能的话,请给我一些重要的链接。
谢谢。
`first get all points coordinates which are coming in route then add these points latitude and longitude in path in will draw path according to that`
GMSCameraPosition *cameraPosition=[GMSCameraPosition cameraWithLatitude:18.5203 longitude:73.8567 zoom:12];
_mapView =[GMSMapView mapWithFrame:CGRectZero camera:cameraPosition];
_mapView.myLocationEnabled=YES;
GMSMarker *marker=[[GMSMarker alloc]init];
marker.position=CLLocationCoordinate2DMake(18.5203, 73.8567);
marker.icon=[UIImage imageNamed:@"aaa.png"] ;
marker.groundAnchor=CGPointMake(0.5,0.5);
marker.map=_mapView;
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(@(18.520).doubleValue,@(73.856).doubleValue)];
[path addCoordinate:CLLocationCoordinate2DMake(@(16.7).doubleValue,@(73.8567).doubleValue)];
GMSPolyline *rectangle = [GMSPolyline polylineWithPath:path];
rectangle.strokeWidth = 2.f;
rectangle.map = _mapView;
self.view=_mapView;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句