Displaying a Selected Location on ArcGIS Map View

المشرف العام

Administrator
طاقم الإدارة
I am New to ArcGIS. I am Developing an iOS application Using ArcGIS iOS SDK. In that application i want to implement general search of an address like if I type a key word in my search field i want to display all the addresses,blocks,Highways,Avenues etc.. matching to that key word. I write the below code for implementing general search.

ViewController.m

- (void)viewDidLoad { [super viewDidLoad]; self.mapView.layerDelegate = self; self.mapView.callout.delegate = self; self.searchBar.delegate = self; AGSCredential* cred = [[AGSCredential alloc] initWithUser:mad:"username" password:mad:"password"]; AGSTiledMapServiceLayer *tiledMapServiceLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:[NSURL URLWithString:mad:"url"] credential:cred]; [self.mapView addMapLayer:tiledMapServiceLayer]; self.dynamicLayer = [[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:mad:"Dynamic Layer Ursl"] credential:cred]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"POIS"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"ADDRESSES"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"HIGHWAYS"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"AVENUES"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"ROADS_LANES"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"BLOCKS"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"AREAS"]; [self.mapView addMapLayer:self.dynamicLayer withName:mad:"GOVERNORATE"]; self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.graphicsLayer withName:mad:"Results"]; self.graphicsLayer.calloutDelegate = self; self.findTask = [[AGSFindTask alloc] initWithURL:[NSURL URLWithString:mad:"findTaskURL"] credential:cred]; self.findTask.delegate = self; self.findParams = [[AGSFindParameters alloc]init]; } - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { self.mapView.callout.hidden = YES; self.findParams.contains = YES; self.findParams.layerIds = [NSArray arrayWithObjects:mad:"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",nil]; self.findParams.outSpatialReference = self.mapView.spatialReference; self.findParams.returnGeometry = TRUE; self.findParams.searchFields = [NSArray arrayWithObjects:mad:"SearchFields",nil]; self.findParams.searchText = searchBar.text; [self.findTask executeWithParameters:self.findParams]; [searchBar resignFirstResponder]; } -(void)findTask:(AGSFindTask *)findTask operation:(NSOperation *)op didExecuteWithFindResults:(NSArray *)results { [self.graphicsLayer removeAllGraphics]; poiArray = [[NSMutableArray alloc]init]; addressArray = [[NSMutableArray alloc]init]; highwayArray = [[NSMutableArray alloc]init]; avenueArray = [[NSMutableArray alloc]init]; roadLanesArray = [[NSMutableArray alloc]init]; blocksArray = [[NSMutableArray alloc]init]; areasArray = [[NSMutableArray alloc]init]; governarateArray = [[NSMutableArray alloc]init]; poiObjectArray = [[NSMutableArray alloc]init]; addressObjectArray = [[NSMutableArray alloc]init]; highwayObjectArray = [[NSMutableArray alloc]init]; avenueObjectArray = [[NSMutableArray alloc]init]; roadLanesObjectArray = [[NSMutableArray alloc]init]; blocksObjectArray = [[NSMutableArray alloc]init]; areasObjectArray = [[NSMutableArray alloc]init]; governarateObjectArray = [[NSMutableArray alloc]init]; AGSFindResult *result = nil; NSMutableDictionary *d = [[NSMutableDictionary alloc]init]; NSMutableString *d1 = [[NSMutableString alloc]init]; NSMutableString *d2 = [[NSMutableString alloc]init]; NSMutableString *d3 = [[NSMutableString alloc]init]; for (int i=0;i
 
أعلى