in Education by
I don't need so many pins , they are crowding the area. I used the output of kml parser to draw the route between two points, how can I remove the extra pins between the route. I only need pins for beginning and ending. How do I reduce those excessive red pins\ from KML showing up. // Locate the path to the route.kml file in the application's bundle // and parse it with the KMLParser. kml = [[KMLParser parseKMLAtPath:filePath] retain]; // Add all of the MKOverlay objects parsed from the KML file to the map. NSArray *overlays = [kml overlays]; [map addOverlays:overlays]; // Add all of the MKAnnotation objects parsed from the KML file to the map. NSArray *annotations = [kml points]; [map addAnnotations:annotations]; // Walk the list of overlays and annotations and create a MKMapRect that // bounds all of them and store it into flyTo. MKMapRect flyTo = MKMapRectNull; for (id overlay in overlays) { if (MKMapRectIsNull(flyTo)) { flyTo = [overlay boundingMapRect]; } else { flyTo = MKMapRectUnion(flyTo, [overlay boundingMapRect]); } } //overlay for (id annotation in annotations) { MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); if (MKMapRectIsNull(flyTo)) { flyTo = pointRect; } else { flyTo = MKMapRectUnion(flyTo, pointRect); } } ///annotation // Position the map so that all overlays and annotations are visible on screen. map.visibleMapRect = flyTo; } - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay { return [kml viewForOverlay:overlay]; } - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation { if ([[annotation title] isEqualToString:@"Destination"]) { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenpin"]; newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; return newAnnotation; } else if ([[annotation title] isEqualToString:@"Current Location"]) { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"yellowpin"]; newAnnotation.pinColor = MKPinAnnotationColorPurple; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; return newAnnotation; } else { return [kml viewForAnnotation:annotation];} } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
By this code all the annotations in [kml ponits] are added on map. NSArray *annotations = [kml points]; [map addAnnotations:annotations]; if you want only first and last annotation then simply add NSArray *annotations = [kml points]; [map addAnnotation:[annotations lastObject]]; [map addAnnotation:[annotations objectAtIndex:0]];

Related questions

0 votes
    I'm trying to incorporate Google Maps into my Access form so that for every record a map of its ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    @RequestMapping annotation is used to map a HTTP request method (GET or POST) to a specific class or method in the ... which will handle the respective request. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    I am following up with the Wirecloud User Guide available here https://wirecloud.readthedocs.io/en/latest/ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I am using this for slide up layout in my map fragment but my app just crashing again and again ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am using this for slide up layout in my map fragment but my app just crashing again and again ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I have a google map and is not displayed properly. To see what I'm talking about check this LINK ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I have source and destination latitude and longitude values, and wish to display a Google map showing the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I have a google map set with the Javascript API V3. It's displayed in a div with a dynamic width ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I have a google map set with the Javascript API V3. It's displayed in a div with a dynamic width ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    What is Distribution and map overlay in Google Analytics?...
asked Oct 3, 2020 in Technology by JackTerrance
0 votes
    I wait for onCharacteristicChanged() callbacks to receive data via BLE. But if the BluetoothDevice sends too ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    What is the problem Here ? I got an error shows ValueError: too many values to unpack This code ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    In a script where I create many figures with fix, ax = plt.subplots(...), I get the warning ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    How many times does Google release the algorithms and updates visible to users?...
asked Mar 5, 2021 in Technology by Editorial Staff
0 votes
    How many types of custom Reports in Google Analytics?...
asked Oct 3, 2020 in Technology by JackTerrance
...