osgearth中geodetic和mercator初始的瓦片数不一样

87 篇文章 38 订阅
13 篇文章 0 订阅

在osgEarth/Registry中

if ( !_global_geodetic_profile.valid() )
    {
        GDAL_SCOPED_LOCK;

        if ( !_global_geodetic_profile.valid() ) // double-check pattern
        {
            const_cast<Registry*>(this)->_global_geodetic_profile = Profile::create(
                "epsg:4326",
                -180.0, -90.0, 180.0, 90.0,
                "",
                2, 1 );
        }
    }
if ( !_spherical_mercator_profile.valid() ) // double-check pattern
        {
            // automatically figure out proper mercator extents:
            const SpatialReference* srs = SpatialReference::create( "spherical-mercator" );

            //double e, dummy;
            //srs->getGeographicSRS()->transform2D( 180.0, 0.0, srs, e, dummy );
            //const_cast<Registry*>(this)->_global_mercator_profile = Profile::create(
            //    srs, -e, -e, e, e, 1, 1 );
            const_cast<Registry*>(this)->_spherical_mercator_profile = Profile::create(
                srs, MERC_MINX, MERC_MINY, MERC_MAXX, MERC_MAXY, 1, 1 );
        }

geodetic初始瓦片有两个,应该是分成了东西半球。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
加载本地sqlite瓦片影像地图png可以通过以下步骤实现: 1. 在Qt使用QSqlDatabase连接sqlite据库。 ```c++ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("your_database_name.sqlite"); if (!db.open()) { qDebug() << "Failed to open database."; return; } ``` 2. 在osgEarth使用Sqlite驱动器打开据库,并加载图层。 ```c++ osgEarth::Registry::instance()->setDriverModel("sqlite"); osgEarth::ImageLayerOptions layerOptions("your_layer_name", "your_database_name.sqlite"); layerOptions.setDriver("sqlite"); // 设置图层的范围、瓦片大小和最大级别等参 layerOptions.setProfile(osgEarth::ProfileOptions::create("global-geodetic")); layerOptions.setMinLevel(0u); layerOptions.setMaxLevel(18u); layerOptions.setTileSize(256u); // 设置图层的URL格式 layerOptions.addImageLayerOptions().driver()->setUrl("sqlite:///"+your_database_name.sqlite+"/your_table_name?column=your_column_name"); // 创建图层并添加到地球模型 osgEarth::ImageLayer* layer = new osgEarth::ImageLayer(layerOptions); osgEarth::Map* map = new osgEarth::Map(); map->addLayer(layer); osgEarth::Viewer viewer; viewer.setSceneData(map->getTerrainEngine()); viewer.run(); ``` 3. 如果你的sqlite据库存储的是png格式的瓦片,那么只需要在URL添加`&format=png`即可。 ```c++ layerOptions.addImageLayerOptions().driver()->setUrl("sqlite:///"+your_database_name.sqlite+"/your_table_name?column=your_column_name&format=png"); ``` 这样就可以加载本地sqlite瓦片影像地图png了。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值