osgearth加载影像数据TMS、Tif、XYZ

加载TMS文件

		TMSOptions imagery;
		imagery.url() = "http://readymap.org/readymap/tiles/1.0.0/22/";
		m_pMap->addLayer(new ImageLayer("ReadyMap Imagery", imagery));

加载TIF、IMG等格式文件

	         GDALOptions gdal;
			 gdal.url() = pDataSource.strFile;
			 osg::ref_ptr<ImageLayer> pImageLayer = new ImageLayer(pDataSource.strName, gdal);
			 m_pMap->addLayer(pImageLayer);

加载XYZ格式文件

	osgEarth::Drivers::XYZOptions tileOptions;
	tileOptions.url() = "http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png";
	tileOptions.profile()->namedProfile()=("spherical-mercator");
	osgEarth::ImageLayerOptions options = ImageLayerOptions("debug", tileOptions);
	osg::ref_ptr<osgEarth::ImageLayer> layer = new ImageLayer(options);
	mapNode->getMap()->addImageLayer(layer);

加载MB格式文件

	 MBTilesTileSourceOptions pMBTiles;
			 pMBTiles.filename() = pDataSource.strFile;
			 pMBTiles.format() = ".png";
			 m_pMap->addLayer(new ImageLayer(pDataSource.strName, pMBTiles));

一些数据汇总

以下url中:

Z-瓦片层级,一般支持0-18级,越大代表越清晰;

X-瓦片列号,从西向东(0->360),依次0,1,2,……;

Y-瓦片行号,从北向南(有些也可能是从南向北),依次0,1,2,……;

1、arcgis

街道图:

https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}

 

 

灰色图:

https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}

 

 

深蓝夜色:

https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}

 

 

2、googlemap

lys参数可选值包括:h(街道图)、m(街道图)、p(街道图)、r(街道图)、s(影像无注记)、y(影像含注记)、t(地形图)

街道图:

https://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}

 

 

卫星图:

https://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}(或者http://mt1.google.cn/vt/lyrs=s&x={x}&y={y}&z={z})

 

 

3、Amap(高德地图)

街道:(z>=3才有数据)

https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}

 

影像图:

https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}

 

4、OSM

街道图(国外服务器,访问较慢):

https://c.tile.openstreetmap.org/{z}/{x}/{y}.png

 

https://tile-b.openstreetmap.fr/hot/{z}/{x}/{y}.png

 

5、Mapbox

建筑图:(国内数据略陈旧)

https://b.tiles.mapbox.com/v3/osmbuildings.kbpalbpk/{z}/{x}/{y}.png

 

黑色底图:

https://a.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png

 

 

需要token

6、Mapbox

卫星图:

https://a.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=

 

街道图:

https://a.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=

 

带区划黑底:

https://a.tiles.mapbox.com/v4/mapbox.dark/{z}/{x}/{y}.png?access_token=

 

7、天地图(http://lbs.tianditu.gov.cn/server/MapService.html)

影像图:(z>=1)

https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=

 

矢量底图:(z>=1)

https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=9a516b0f2a8179bb68f73172cff4bd22

 

注记:(z>=1)

https://t2.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&tk=

 

8、BingMap

 

 

https://ecn.t0.tiles.virtualearth.net/tiles/a1.jpeg?g=7234

https://ecn.t0.tiles.virtualearth.net/tiles/a13.jpeg?g=7234

https://ecn.t0.tiles.virtualearth.net/tiles/a130.jpeg?g=7234

从Level1开始,g=7234/100/-10……为任意正负整数

  • 3
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
要在osgEarth 3.2中加载TMS高程数据,可以按照以下步骤操作: 1. 首先,在你的应用程序中创建一个osgEarth::Map对象。 2. 在Map对象中添加一个TMSImageLayer图层,并指定图层的URL地址和地图范围。 3. 在Map对象中添加一个TMSHeightFieldLayer图层,并指定图层的URL地址和地图范围。这个图层将加载高程数据。 4. 将Map对象添加到osgEarth::View对象中。 5. 创建一个osgViewer::Viewer对象,并将osgEarth::View对象作为参数传递给viewer的setSceneData()方法。 6. 运行你的应用程序,就可以看到加载TMS高程数据了。 下面是一个简单的示例代码: ```cpp osg::ref_ptr<osgEarth::Map> map = new osgEarth::Map(); // 添加TMS图层 osgEarth::Drivers::TMSOptions imagery; imagery.url() = "http://yourserver.com/tileset"; imagery.profile() = "global-mercator"; osg::ref_ptr<osgEarth::ImageLayer> imageLayer = new osgEarth::ImageLayer("Imagery", imagery); map->addImageLayer(imageLayer.get()); // 添加TMS高程数据图层 osgEarth::Drivers::TMSOptions elevation; elevation.url() = "http://yourserver.com/elevation"; elevation.profile() = "global-mercator"; osg::ref_ptr<osgEarth::ElevationLayer> elevationLayer = new osgEarth::ElevationLayer("Elevation", elevation); map->addElevationLayer(elevationLayer.get()); osg::ref_ptr<osgEarth::View> view = new osgEarth::View(); view->setMap(map.get()); osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(); viewer->setSceneData(view.get()); viewer->run(); ``` 注意,以上代码中的URL地址和地图范围需要根据你的实际情况进行修改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值