GIS内核-连接WMTS服务

	GsWebGeoDatabaseFactoryPtr ptrFac = new GsWebGeoDatabaseFactory();
	GsGeoDatabaseFactoryPtr fac = ptrFac;
	GsConnectProperty cp;
	cp.DataSourceType = GsDataSourceType::eWeb;

	GsString str = "http://t0.tianditu.com/img_c/wmts";
	cp.Server = str;
	GsLogger::Default().AutoFlush(true);
	GsLogger::Default().LogLevel(eLOGALL);
	GsGeoDatabasePtr db = fac->Open(cp);
		
	GsTileColumnInfo info;
	info.XYDomain = GsBox(-180, -90, 180, 90);
	info.ValidBottomLevel = 20;
	info.ValidTopLevel = 0;
	info.FeatureType = eImageTileFeature;
	GsTileClassPtr Raster = db->CreateTileClass("img", new  GsSpatialReference(4326), GsPyramid::WellknownPyramid(e360DegreePyramid), info);
	GsTMSTileClassPtr tms = Raster;
	//http://t1.tianditu.com/DataServer?T=vec_w&x=${Col}&y=${Row}&l=${Level}
	//这里为模板,这个模板是根据网络请求串抓取的,后期可能封装成常用服务串
	tms->UrlTemplate("http://t6.tianditu.com/DataServer?T=img_w&x=${Col}&y=${Row}&l=${Level}");
	tms->TileType(ePngType);
        //这里是缓存,浏览过的瓦片会缓存到此数据集
	GsGeoDatabaseFactoryPtr cacheFac = new GsSqliteGeoDatabaseFactory();
	GsConnectProperty cacheConn;
	cacheConn.DataSourceType = GsDataSourceType::eSqliteFile;
	cacheConn.Server = "D:\\";
	GsGeoDatabasePtr ptrDB = cacheFac->Open(cacheConn);
	GsTileClassPtr ptrCacheTs =  ptrDB->CreateTileClass("imgCache", new  GsSpatialReference(4326), GsPyramid::WellknownPyramid(e360DegreePyramid), info);
	tms->Cache(ptrCacheTs);
        //加载图层到视图
	GsTileLayerPtr layer = new	GsTileLayer(Raster);
	space->layerBox().addLayer(layer);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值