AnsweredAssumed Answered

Selection of Closest Facility on Map Load

Question asked by e_saurabh on Mar 10, 2014
Latest reply on Mar 18, 2014 by SBaskaran-esristaff
Hi,

I am finding the route for the Closest Facility from a user defined location. Able to do it successfully and the route is drawn as required, but however I want to select the closest facility as well after the route is drawn. Please find the screen shot for the route display to the closest faclity from the user's location.

Is it possible to do it and can anybody help me with the code for selection for the closest facility. Please find the code below...

       // update the status message
     self.statusMessageLabel.text = @"Finding closest facilities";

     // if we have a sketch layer on the map, remove it
     if ([self.mapView.mapLayers containsObject:self.sketchLayer]) {
     [self.mapView removeMapLayerWithName:self.sketchLayer.name];
     self.mapView.touchDelegate = nil;
      self.sketchLayer = nil;

     //also disable the sketch control so that user cannot sketch
     self.sketchModeSegCtrl.selectedSegmentIndex = -1;
     for (int i =0; i<self.sketchModeSegCtrl.numberOfSegments; i++) {
     [self.sketchModeSegCtrl setEnabled:NO forSegmentAtIndex:i];
     }

     }

     //retrieves the default parameters for the closest facility task from the server
     //the caOp property will keep tract of the operation in case we need to cancel it at any point.
     self.cfOp = [self.cfTask retrieveDefaultClosestFacilityTaskParameters];

     //showing activity indicator
     [self.activityAlertView show];

     self.mapView.touchDelegate = self;


Regards,
Saurabh.

Outcomes