|
问的属于入门的问题~请不吝指教
请教下编辑mymap.earth文件
-
- <map name="MyMap" type="geocentric" version="2">
- <image name="bluemarble" driver="gdal">
- <url>d:/world.tif</url>
- </image>
- </map>
复制代码
直接在程序中读取(或者用osgviewer运行)怎么只有空白的球~~
按照自带的例子运行
- // Start by creating the map:
- Map* map = new Map();
- // Start with a basemap imagery layer; we'll be using the GDAL driver
- // to load a local GeoTIFF file:
- GDALOptions basemapOpt;
- //basemapOpt.url() = "d:/earthdata/data/world.tif";
- basemapOpt.url() = "d:/world.tif";
- //map->addImageLayer( new ImageLayer( ImageLayerOptions("basemap", basemapOpt) ) );
- map->addImageLayer( new ImageLayer( "basemap", basemapOpt) );
- // Next we add a feature layer. First configure a feature driver to
- // load the vectors from a shapefile:
- OGRFeatureOptions featureOpt;
- featureOpt.url() = "d:/earthdata/data/world.shp";
- //featureOpt.da
- // Define a style for the feature data. Since we are going to render the
- // vectors as lines, configure the line symbolizer:
- Style* style = new Style;
- LineSymbol* ls = new LineSymbol;
- ls->stroke()->color() = osg::Vec4f( 1,1,0,1 );
- ls->stroke()->width() = 1.5f;
- style->addSymbol(ls);
- // Now we'll choose the AGG-Lite driver to render the features. By the way, the
- // feature data is actually polygons, so we override that to treat it as lines.
- // We apply the feature driver and set the style as well.
- AGGLiteOptions worldOpt;
- worldOpt.featureOptions() = featureOpt;
- worldOpt.geometryTypeOverride() = Geometry::TYPE_LINESTRING;
- worldOpt.styles()->addStyle( style );
- map->addImageLayer( new ImageLayer( ImageLayerOptions("world", worldOpt) ) );
- // That's it, the map is ready; now create a MapNode to render the Map:
- MapNode* mapNode = new MapNode( map );
- viewer.setSceneData( mapNode );
复制代码
可以显示world.tif的贴图,但不能显示shp文件,请问是什么原因~
另外
如果只显示tif贴图
如下这样为什么不行啊~~用的是osgearth2.0~
- Map* map = new Map();
- // Start with a basemap imagery layer; we'll be using the GDAL driver
- // to load a local GeoTIFF file:
- GDALOptions basemapOpt;
- //basemapOpt.url() = "d:/earthdata/data/world.tif";
- basemapOpt.url() = "d:/world.tif";
- //map->addImageLayer( new ImageLayer( ImageLayerOptions("basemap", basemapOpt) ) );
- map->addImageLayer( new ImageLayer( "basemap", basemapOpt) );
- MapNode* mapNode = new MapNode( map );
- viewer.setSceneData( mapNode );
复制代码 |
|