iphone - draw route with multiple markers on Google Map iOS -
i'm new iphone development, in application want draw route between 2 points , show multiple markers on route. i'm done route between 2 points don't know how draw multiple markers on route. please me this.
thanks in advance!!!
_markerstart = [gmsmarker new]; _markerstart.title = [[[routedict objectforkey:@"legs"] objectatindex:0]objectforkey:@"start_address"]; _markerstart.icon = newimage; //[uiimage imagenamed:@"startmarker.png"]; _markerstart.map = gmsmapview; _markerstart.position = startpoint; _markerfinish = [gmsmarker new]; _markerfinish.title = [[[routedict objectforkey:@"legs"] objectatindex:0]objectforkey:@"end_address"]; _markerfinish.icon = newimage; //[uiimage imagenamed:@"finishmarker.png"]; _markerfinish.map = gmsmapview; _markerfinish.position = endpoint;
here have added start , end marker.
as completed drawing route between 2 points, have co-ordinates route. can take co-ordinates , draw them on google maps.
for drawing route may have used gmspolyline
. polyline, must have used gmspath
. path can co-ordinates using method
-(cllocationcoordinate2d)coordinateatindex:(nsuinteger)index
you can use these co-ordinates plot marker on route. gmsmarkers doc
check code (here gmspath gmspath
) edit:
//gmspath *gmspath; //nsstring *title; (int = 0; < [gmspath count]; i++) { cllocationcoordinate2d location = [gmspath coordinateatindex: i]; gmsmarker *marker = [gmsmarker markerwithposition:location]; marker.title = title; marker.icon = [uiimage imagenamed:@"marker_img.png"]; marker.map = self.mapview; }
this plot marker each co-ordinate.
Comments
Post a Comment