[gdal-dev] Creating a vector mbtile with several layers

DELEPINE Christophe christophe.delepine at thalesgroup.com
Thu Jun 30 08:17:18 PDT 2022


Hello

I am trying to create a vector mbtile containing several layers (using C++ GDAL API) but it does not work. My output mbtile only contains one layer (ogrinfo only lists one layer)
What I do is the following :

GDALDriver* driver = (GDALDriver*)GDALGetDriverByName("MBTiles");
GDALDataset* poDS = driver->Create(mbtiles.c_str(), 0, 0, 0, GDT_Unknown, datasetCreationOptions);
for (auto& layer : layers)
{
       OGRLayer* oLayer = poDS->CreateLayer(layer.name_.c_str(), &srs3857_, wkbUnknown);
OGRFeature *oFeature = OGRFeature::CreateFeature(oLayer->GetLayerDefn());
oFeature->SetGeometryDirectly(geom);
oLayer->CreateFeature(oFeature);
}
GDALClose(poDS);


Any idea what is wrong ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220630/368e5014/attachment-0001.htm>


More information about the gdal-dev mailing list