如何在iOS中获取有关AGSFeature图层的详细信息

时间:2015-01-29 12:29:19

标签: ios objective-c ios8 arcgis

我可以在arcgis iOS sdk的basemap上添加3个图层。现在我想从要素图层获取详细信息。谁能帮我。有时数据会在地图上填充,但有时需要花费太多时间才能加载。下面是我的代码,我可以在底图上添加3个要素图层。

// Add basemap.
NSURL* url = [NSURL URLWithString: @"http://services.arcgisonline.com/arcgis/rest/services/World_Topo_map/mapserver"];
AGSTiledMapServiceLayer* layer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL: url];
layer.delegate = self;
[self.mapView addMapLayer:layer withName:@"Streets"];

//zoom to an area
AGSEnvelope *envelope = [AGSEnvelope envelopeWithXmin:-1.34732920649E7 ymin:4533851.309500001 xmax:-1.3431785844E7

ymax:4641521.468800001 spatialReference:self.mapView.spatialReference];     [self.mapView zoomToEnvelope:envelope animated:NO];

// Structures.
NSString *urlString = [self.currentWorkOrder.detectionURL substringToIndex:[self.currentWorkOrder.detectionURL length]-1];

self.featureLayerURL0 = [NSURL URLWithString:[NSString stringWithFormat:@"%@0",urlString]];

self.featureLayer0 = [AGSFeatureLayer featureServiceLayerWithURL:self.featureLayerURL0 mode:AGSFeatureLayerModeOnDemand];
self.featureLayer0.delegate = self;
[self.mapView addMapLayer:self.featureLayer0 withName:@"CloudData0"];

// Alignment.
self.featureLayerURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@1",urlString]];

self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL:self.featureLayerURL mode:AGSFeatureLayerModeOnDemand];
self.featureLayer.delegate = self;
[self.mapView addMapLayer:self.featureLayer withName:@"CloudData"];

// Detections.
self.featureLayerURL1 = [NSURL URLWithString:[NSString stringWithFormat:@"%@2",urlString]];

self.featureLayer1 = [AGSFeatureLayer featureServiceLayerWithURL:self.featureLayerURL1 mode:AGSFeatureLayerModeOnDemand];
self.featureLayer1.delegate = self;
PO(self.featureLayer1.fields);
[self.mapView addMapLayer:self.featureLayer1 withName:@"CloudData1"];

请帮我解决这个问题。提前谢谢。

1 个答案:

答案 0 :(得分:0)

这是一个在地图上加载图层的时间过长的网络。现在能够从AGSCalloutDelegate方法获取每个层的详细信息

  - (void)didClickAccessoryButtonForCallout:(AGSCallout *)callout
    {
        NSLog(callout.representedFeature);
    }