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

苏雷什·佩迪斯蒂

我正在开发一个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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Mkmapview中两个位置之间的多条路线

如何使用mapView和CLLocationManager在iOS Swift中绘制两个位置之间的方向

获取两个位置之间的路线点

如何使用GMSMapView在两个位置之间找到最短路径并绘制锯齿形路径?

无法使用ReactJS在OpenLayers中的两个位置之间绘制默认线

如何使用Android在Google Map中的两个位置之间绘制折线?

在ggplot2中的两个位置之间绘制曲线

如何在Flutter上的两个地理位置之间绘制路线?

在 Kotlin 中查找两个位置之间的距离

iOS中两个位置之间的估计时间

R中地球上两个位置之间的距离

在两个位置之间绘制单元格

在两个位置之间获取路径

快速计算两个位置之间的距离

bing映射两个位置之间的直线

寻找两个位置之间的距离

如何在两个位置之间的两种不同颜色的Google地图上绘制折线

获取java android中两个位置之间的距离

mysql中的ST_Distance_Sphere无法提供两个位置之间的准确距离

计算Excel工作表中两个位置之间的地理坐标距离

谷歌地图xamarin android中的两个位置之间没有出现折线

getView()中的位置在两个位置之后重复,并跳过最后两个位置

定位相机在GMSMapview iOS中显示两个位置

在文本文件中的行中搜索两个位置之间的图案,并打印整行

Google Maps iOS SDK,获取2个位置之间的路线

具有一个日期列的同一表中两个位置之间的日期差

比较同一文件 Linux 中两个位置之间的 2 个值

使用Google Map API计算两个位置之间的距离

如何在iPhone应用程序中找到两个位置之间的方向?