How do I load a vtpk file as a base map?
When I do it like this, the App loads the whole vector map in to memory -> crash !
self.vectorTiledLayer = [[AGSArcGISVectorTiledLayer alloc] initWithName:@"..."]; [self.vectorTiledLayer loadWithCompletion:^(NSError * _Nullable error) { if (error){ NSLog(@"Error: %@", error); } weakSelf.arcGISMap.map = [AGSMap mapWithBasemap:[[AGSBasemap alloc] initWithBaseLayer: self.vectorTiledLayer]]; }];
Can you provide the stack trace you get when the app crashes?
Also, does the crash happen when you create the instance of the layer, or when you add it to map as a base layer?
Just to clarify, we don't load the whole vector tile package into memory, we access individual tiles that are needed from the package on disk.
For now it is no longer crashing, but I do see a huge memory peak to 400 - 600 MB after loadWithCompletion.
The test file I'm trying to load is:
http://www.arcgis.com/home/item.html?id=b84c4ec081b740f9ba299f04fbcae300
Maybe there's something wrong with it.
When loaded, there is no map, and I cannot zoom or pan.
Doing it like this now:
... AGSBasemap *baseMap; if (loadLocalMap) { AGSArcGISVectorTiledLayer *baseLayer = [AGSArcGISVectorTiledLayer ArcGISVectorTiledLayerWithName:@"nederland"]; baseMap = [AGSBasemap basemapWithBaseLayer:baseLayer]; } else { baseMap = [AGSBasemap streetsVectorBasemap]; } self.map = [AGSMap mapWithBasemap:baseMap]; [self.map loadWithCompletion:^(NSError * _Nullable error) { if (error){ DDLogWarn(@"Error: %@", error); } weakSelf.arcGISMap.map = weakSelf.map; }];