【发布时间】:2016-02-05 07:23:14
【问题描述】:
我正在尝试将基本的 ArcGIS 工作流程编码到我的 iOS 项目中。我是这个平台的新手,可以使用一些指针。我的工作流程如下。
1.) 创建显示卫星(世界风格)地图的 mapView。 2.) 在 ArcGIS Online 上从我的用户帐户添加公共 webMap 作为卫星地图上的叠加层/图层。
我尝试过的
//.h
#import <ArcGIS/ArcGIS.h>
@interface ViewController : UIViewController <AGSWebMapDelegate>
@property (strong, nonatomic) IBOutlet AGSMapView *mapView;
//.m
// Add basemap
NSURL* url = [NSURL URLWithString:@"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"];
AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:url];
[self.mapView addMapLayer:tiledLayer withName:@"Basemap Tiled Layer"];
//If I run this part alone, I'll get the satellite map.
AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@"bb9b8c172e8142f995526bf658078f54" credential:nil];
webmap.delegate = self;
[webmap openIntoMapView:self.mapView];
//When I add this webMap code and run the project, I get a blank white screen.
//.m cont.
- (void)mapViewDidLoad:(AGSMapView *) mapView {
NSLog(@"mapView didLoad");
}
- (void) webMapDidLoad:(AGSWebMap*) webMap {
NSLog(@"webmap added successfully");
}
//Neither of these logs get called.
问题。
1.) 使用 AGSTiledMapServiceLayer 作为我的底图是否正确?另外,我的 ArcGIS Online 地图使用 AGSWebMap 是否正确?
2.) 我的目标是能够在卫星底图中添加和删除多个图层,一次一个。我在正确的轨道上吗?
我目前正在使用 MapBox 来实现这一点,但我开始尝试使用 ArcGIS SDK 及其功能。
提前致谢。
【问题讨论】:
-
查看 ObjC 代码的答案。我认为通过在基本地图上更新 Web 地图是正确的做法。
标签: ios objective-c arcgis