Latest 0.0.5
Homepage https://github.com/crash-wu/SGTileLayer
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Author

吴小星, [email protected]

Decribe

提供天地图瓦片图层加载,百度地图瓦片图层加载,高德瓦片,以及其他TileLayer类型图层加载等功能。在图层加载的时,提供缓存图层功能。

Class

Usage

'#import <SGTileLayer/SGTileLayerHeader.h>'
//引入头文件到项目中

加载天地图,百度地图瓦片

SGTileLayerUtil

/**
*  @author crash         [email protected]   , 16-08-23 10:08:01
*
*  @brief  单列
*
*  @return 类的对象
*/
+(nonnull instancetype)sharedInstance;

/**
*  @author crash         [email protected]   , 16-08-23 10:08:31
*
*  @brief  清除天地图图层
*
*  @param mapView 地图容器
*/
-(void)clearTdtLayer:(nonnull AGSMapView * ) mapView;

/**
*  @author crash         [email protected]   , 16-08-23 10:08:49
*
*  @brief  加载天地图
*
*  @param tdtLayerType 天地图瓦片类型

*  @param mapView      地图容器
*/
-(void)loadTdtTileLayer:(WMTSLayerTypes) tdtLayerType  andMapView :(nonnull AGSMapView * ) mapView;

/**
*  @author crash         [email protected]   , 16-08-23 10:08:54
*
*  @brief  加载百度地图切片
*
*  @param mapView 地图
*/
-(void)loadBdTileLayer:(nonnull AGSMapView *)mapView;

/**
*  @author crash         [email protected]   , 16-08-23 10:08:00
*
*  @brief  清除百度瓦片图层
*
*  @param mapView 地图容器
*/
-(void)clearBdLayer:(nonnull AGSMapView *)mapView;

/**
*  @author crash         [email protected]   , 16-08-23 10:08:35
*
*  @brief  获取天地图当前图层级别
*
*  @param tdtLayer 天地图图层
*
*  @return 天地图当前图层级别
*/
-(NSInteger)currentLevel:(nonnull SouthgisTdt_TileLayer *)tdtLayer;

 /**
 *  @author crash         [email protected]   , 16-09-01 17:09:01
 *
 *  @brief  加载天地图底图(CGCS2000 坐标系)
 *
 *  @param mapView 地图
 */
-(void)loadTdtCGCS2000:(nonnull AGSMapView *)mapView;

/**
 *  @author crash         [email protected]   , 16-09-05 15:09:14
 *
 *  @brief  加载天地图影像底图
 *
 *  @param mapView 当前地图
 */
-(void) loadTdtImageCGCS2000:(nonnull AGSMapView *) mapView;

/**
 *  @author crash         [email protected]   , 16-09-05 15:09:05
 *
 *  @brief  清除天地图CGCS2000图层
 *
 *  @param mapView 当前地图
 */
-(void)clearCGCS2000:(nonnull AGSMapView *)mapView;

例如:

加载天地图
[[SGTileLayerUtil sharedInstance] loadTdtTileLayer:WMTS_VECTOR_2000 andMapView:self.mapView];

//加载天地图国标2000图层
[[SGTileLayerUtil sharedInstance]loadTdtCGCS2000:self.mapView];

加载百度地图
[[SGTileLayerUtil sharedInstance] loadBdTileLayer:self.mapView];

//加载高德瓦片
[[SGTileLayerUtil sharedInstance] loadGDLayer:self.indoorMapView.mapView];

加载其他 TileLayer图层服务

Southgis_TiledServiceLayer

/**
* @author Jeremy, 16-03-01 14:03:04
*
* 初始化
*
* @param url   图层地址
*
* @return 服务图层
*/
- (instancetype)initTiledServiceLayerURL:(NSString *)url;

加载 WMTS服务图层

SGSWMTSInfo

/**
*  根据 GetCapabilities URL 实例化
*
*  如果实例化成功则自动开始进行 GetCapabilities,可以通过代理方法获取请求结果
*  DPI 默认使用 96 dots/inch
*
*  @param url GetCapabilities 请求地址
*
*  @return SGSWMTSInfo or nil
*/
- (instancetype)initWithURLString:(NSString *)url delegate:(id<SGSWMTSInfoDelegate>)delegate;

/**
*  根据 GetCapabilities URL 实例化
*
*  如果实例化成功则自动开始进行 GetCapabilities,可以通过代理方法获取请求结果
*
*  @param url GetCapabilities 请求地址
*  @param dpi 切片 DPI
*
*  @return SGSWMTSInfo or nil
*/
- (instancetype)initWithURLString:(NSString *)url tileDPI:(NSUInteger)dpi delegate:(id<SGSWMTSInfoDelegate>)delegate;

例如:

-(void)viewDidAppear:(BOOL)animated{
     [super viewDidAppear:animated];

   SGSWMTSInfo  * _info = [[SGSWMTSInfo alloc] initWithURLString:@"http://t0.tianditu.com/vec_c/wmts" delegate:self];
}

#pragma mark - SGSWMTSInfoDelegate
- (void)sgsWMTSInfoDidLoad:(SGSWMTSInfo *)wmtsInfo {
    SGSWMTSLayerInfo *layerInfo = wmtsInfo.layerInfos.firstObject;
    if (layerInfo) {
        SGSWMTSLayer *layer = [wmtsInfo wmtsLayerWithLayerInfo:layerInfo];
        [_mapView addMapLayer:layer];

        [layer loadWMTSTileAndUsingCache:YES];
    } else {
        NSLog(@"tuceng wei kong");
    }
}

Setting

设置Framework search Patchs 以及 Other Links

  • 1.选择项目工程文档;
    2.选择Build Setting 菜单;
    3.选择 Frame work search Patchs ,并且添加 ‘$(inherited)’
    4.选择Others Links ,并且添加 ‘$(inherited)’*

如图:

修改 SGTileLayer.framework编译属性

  • 由于ArcgisSDK是静态库的原因,所有pod Install ,或者pod update 后,要更改SGTileLayer.framework编译属性.
    1.点击打开Pods项目
    2.选择SGTileLayer.framework
    3.选择Build Settings菜单栏;
    4.搜索Mach-o 编译库选项;
    5.修改Mach-o 为Static Library
    6.每次pod install 或者pod update 后,都要更改上述的编译配置信息;

如下图所示:

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

加载天地图

加载百度地图

加载WMTS

Requirements

ArcGIS-Runtime-SDK-iOS for version 10.2.5

Installation

SGTileLayer is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SGTileLayer"

License

SGTileLayer is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SGTileLayer",
    "version": "0.0.5",
    "summary": "u5929u5730u56feu74e6u7247u56feu5c42u52a0u8f7duff0cu767eu5ea6u5730u56feu74e6u7247u56feu5c42u52a0u8f7du7b49u76f8u5173u529fu80fd.",
    "description": "u63d0u4f9bu5929u5730u56feu74e6u7247u56feu5c42u52a0u8f7duff0cu767eu5ea6u5730u56feu74e6u7247u56feu5c42u52a0u8f7duff0cu9ad8u5fb7u74e6u7247u52a0u8f7duff0cu4ee5u53cau5176u4ed6TileLayeru7c7bu578bu56feu5c42u52a0u8f7du7b49u529fu80fdu3002u5728u56feu5c42u52a0u8f7du7684u65f6uff0cu63d0u4f9bu7f13u5b58u56feu5c42u529fu80fd",
    "homepage": "https://github.com/crash-wu/SGTileLayer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "u5434u5c0fu661f": "[email protected]"
    },
    "source": {
        "git": "https://github.com/crash-wu/SGTileLayer.git",
        "tag": "0.0.5"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": [
        "SGTileLayer/Classes/**/*.{h,m}",
        "SGTileLayer/Classes/*.{h,m}"
    ],
    "xcconfig": {
        "FRAMEWORK_SEARCH_PATHS": "$(HOME)/Library/SDKs/ArcGIS/iOS",
        "OTHER_LDFLAGS": "-ObjC -framework ArcGIS -l c++",
        "ENABLE_BITCODE": "NO",
        "CLANG_ENABLE_MODULES": "YES"
    }
}

Pin It on Pinterest

Share This