LayerDefinitions

2942
3
09-08-2011 09:57 AM
ChrisMahlke
New Contributor II
This question is concerning layer definitions.

I follow the sample code snippets posted at the very bottom of this page:

http://help.arcgis.com/en/arcgismobile/10.0/apis/iOS/1.8/concepts/index.html#//00pw0000004m000000.ht...

Here is my code:

AGSDynamicMapServiceLayer *dyn = [[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer"]];
 
int layerID = 3; 
NSString *defString = @"NAME = 'Middlesex County'";
AGSLayerDefinition *layerDef = [AGSLayerDefinition layerDefinitionWithLayerId:layerID definition:defString];
dyn.layerDefinitions = [NSArray arrayWithObject:layerDef];
 
[mapView removeMapLayerWithName:@"previous layer"];
self.fbMapServiceUIView = [mapView addMapLayer:_dyn withName:@"some name"];


Instead of just 4 counties being loaded, the entire choropleth map is being loaded as though there were no layer definitions being applied.

Has anyone out there successfully applied layer definitions?  Any suggestions?

Thanks...
0 Kudos
3 Replies
NimeshJarecha
Esri Regular Contributor
Chris,

The layer you are using is a Tiled layer not a Dynamic layer. Hence, it's not being honored.

Regards,
Nimesh
0 Kudos
MuruganandhamKuppan1
New Contributor III

Hi Nimesh Jarecha‌,

I didn't find the `AGSLayerDefinition` class in latest runtime SDK for iOS. How to accomplished this in Latest arcgis runtime SDK for iOS. 

Regards,

0 Kudos
NimeshJarecha
Esri Regular Contributor

For latest SDK (ver 100.x) property is renamed to `definitionExpression` and is available on sub layers, feature layer and service feature table. Please see below image. 

The sample is available at arcgis-runtime-samples-ios/arcgis-ios-sdk-samples/Features/Feature layer definition expression at ma... 

Hope this helps!

Regards,

Nimesh

0 Kudos