wrapAround doesn't work with tiled service in iOS, works in other API's

2354
11
05-17-2012 11:57 AM
LukePhilips
New Contributor III
Hey,
I've got a tiled map service that is Web Mercator (WKID 102100), I have no problem using it in the other client API's (e.g. JavaScript) with wrapAround however when I add it to a iOS mapView the wrap around no longer works. any recommended means of debugging this?

Thanks
0 Kudos
11 Replies
NimeshJarecha
Esri Regular Contributor
Luke,

What you mean by no longer works? Are you setting the self.mapView.wrapAround property to TRUE?

Regards,
Nimesh
0 Kudos
LukePhilips
New Contributor III
Yes, I've thrown together a basic viewer that just adds the World Street Map as a baseMap with mapView.wrapAround = YES. That works, then I start adding a FeatureLayer, DynamicMapServiceLayer, and a TiledMapServiceLayer, commenting each on/off to test the wrapAround. The FeatureLayer and DynamicServiceLayer are no problem, but once I comment out those and add the TiledMapServiceLayer then the map no longer pans around the Date Line.
0 Kudos
NimeshJarecha
Esri Regular Contributor
There are certain *Constraints* for wrap around to work. Please refer all details in the Wrap Around doc.

1. Is your base layer's spatial reference either WGS 1984 or Web Mercator?
2. Is the base layer's full envelope covers entire world?

Regards,
Nimesh
0 Kudos
LukePhilips
New Contributor III
1. Yes
2. Yes
Though how are these constraints verified in the SDK? e.g. I can see from the service that the Spatial Reference value is: 102100 (3857), is that the value checked by the SDK? As well, I have no problem with this service in the other SDK's like JavaScript when using wrapAround.
0 Kudos
NimeshJarecha
Esri Regular Contributor
These constrains are verified based on mapView's properties. When wrap around is not working, verify that.

Regards,
Nimesh
0 Kudos
LukePhilips
New Contributor III
When wrap around is not working, verify that.


I'm looking for? I can see that the mapView property for wrapAround goes to false once I add my tiled layer. I see the Spatial reference and full envelope though are the same with or without my tiled layer, e.g.:
mapView->_fullEnvelope:
AGSEnvelope: xmin = -20037507.067162, ymin = -19971868.880409, xmax = 20037507.067162, ymax = 19971868.880409, spatial reference: [AGSSpatialReference: wkid = 102100, wkt = null]
0 Kudos
NimeshJarecha
Esri Regular Contributor
Can you please list out the sequence of steps you are following? Are you loading your tiled layer as base layer?
Did you try just adding your tiled layer (no other layer) with wrapAround = TRUE? What happens in that case?

Regards,
Nimesh
0 Kudos
LukePhilips
New Contributor III
First I'll do this:
#define kBaseMapMapServiceURL @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
...

- (void)viewDidLoad {
    [super viewDidLoad];    
    //assign the layer delegate. 
 self.mapView.layerDelegate = self;
    //add the base map. 
 NSURL *mapUrl = [NSURL URLWithString:kBaseMapMapServiceURL];
 self.baseMapLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];
 [self.mapView addMapLayer:self.baseMapLayer withName:@"Base Map"]

self.mapView.wrapAround = YES;
}


that works without issue. then I add my tiled service like so:
#define kBaseMapMapServiceURL @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
...

- (void)viewDidLoad {
    [super viewDidLoad];    
    //assign the layer delegate. 
 self.mapView.layerDelegate = self;
    //add the base map. 
 NSURL *mapUrl = [NSURL URLWithString:kBaseMapMapServiceURL];
 self.baseMapLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];
 [self.mapView addMapLayer:self.baseMapLayer withName:@"Base Map"]
    
    
    NSURL *mapUrl3 = [NSURL URLWithString:{myServiceURL}];
 AGSTiledMapServiceLayer *Lyr3 = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl3];
 [self.mapView addMapLayer:Lyr3 withName:@"MyService"];   

self.mapView.wrapAround = YES;
}


this no longer wraps around. I have also tried making my service the basemap service and same issue.
0 Kudos
NimeshJarecha
Esri Regular Contributor
So it seems that your tiled layer is not meeting the criteria of being wrap around. Can you please attach a text file of your tiled layer JSON so I can have a look at it? You can get it like this..http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer?f=pjson

Regards,
Nimesh
0 Kudos