天天看點

arcgis地圖加載離線地圖

// 顯示基礎地圖

NSArray *bundleVtpk =[[NSBundle mainBundle] pathsForResourcesOfType:@".vtpk" inDirectory:nil];

NSURL *pathUrl1 = [[NSURL alloc]initFileURLWithPath:[bundleVtpk objectAtIndex:0]];

// 設定代理

self.mapView.touchDelegate = self;

AGSArcGISVectorTiledLayer *tiledLayer = [[AGSArcGISVectorTiledLayer alloc]initWithURL:pathUrl1];

AGSBasemap *basemap =[AGSBasemap basemapWithBaseLayer:tiledLayer];

// 去除水印

AGSLicenseResult *licenseResult = [AGSArcGISRuntimeEnvironment setLicenseKey:@“runtimelite,1000,rud5799562951,none,PM0RJAY3FLLR2B3TR001” error:nil];

self.mapView.map = [[AGSMap alloc] initWithBasemap:basemap];

self.mapView.interactionOptions.rotateEnabled = NO;

self.mapView.locationDisplay.showLocation = YES;

self.mapView.locationDisplay.showPingAnimationSymbol = NO;//取消閃爍的光圈

self.mapView.locationDisplay.showAccuracy = NO;//取消閃爍的光圈

self.mapView.locationDisplay.wanderExtentFactor = 0;

self.mapView.attributionTextVisible = false;

// 加載業務操作圖層

self.operationLayer = [[AGSArcGISMapImageLayer alloc] initWithURL:[NSURL URLWithString:QingpuRiverServerURL]];

[self.mapView.map.operationalLayers addObject:self.operationLayer];//加載操作業務圖層

//設定預設顯示區域

AGSEnvelope *envelope = [[AGSEnvelope alloc]initWithXMin:Map_XMin yMin:Map_YMin xMax:Map_XMax yMax:Map_YMax spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326]];

_avp=[[AGSViewpoint alloc]initWithTargetExtent:envelope];

self.mapView.map.initialViewpoint = _avp;

繼續閱讀