Reputation: 77
I am trying to add markers to Google Maps from data in my Web Service. Now how to show Marker that only in "specific radius distance". I'm trying but didn't have a logic on how to implement that in Objective-C.
Upvotes: 2
Views: 1628
Reputation: 1055
It works for me.Please try it.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:(sourceValue.latValue + destinationValue.latValue)/2
longitude:(sourceValue.lngValue + destinationValue.lngValue)/2
zoom:7.5];
mapview = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
[self.view addSubview:mapview];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(sourceValue.latValue, sourceValue.lngValue);
marker.map = mapview;
//Place source mark of destination
GMSMarker *marker2 = [[GMSMarker alloc] init];
marker2.position = CLLocationCoordinate2DMake(destinationValue.latValue, destinationValue.lngValue);
marker2.map = mapview;
Change your lat, lang value according to your requirements.Thanks
Upvotes: 1