[gdal-dev] Using GDALRPCTransform with a pre-loaded DEM

Even Rouault even.rouault at spatialys.com
Thu Oct 1 08:36:33 PDT 2020


On jeudi 1 octobre 2020 17:17:41 CEST Julien Osman wrote:
> Dear Frank,
> 
> Thank you for this great advice. It seems to be the best options.
> 
> Nevertheless, I fail to make it work. I use the SRTM DEM, witch consist
> of a bunch of files in a directory. So I load each file in a Dataset,
> then I build a VRT file that I store as a memory dataset. Then I provide
> this dataset to my RPCTransformer. But it doesn't work, I get "ERROR 4:
> No such file or directory". If I try to open the VRT file directly with
> GDALOpen, I get the same error. I also tried to open the srtm files
> using GDALOpenShared, for the same result.
> 
> For example :
> 
>   std::vector<GDALDatasetH> vrtDatasetList(2);
>   vrtDatasetList[0] = GDALOpenShared("srtm1.hgt", GA_ReadOnly);
>   vrtDatasetList[1] = GDALOpenShared("srtm2.hgt", GA_ReadOnly);
>   GDALBuildVRT("/vsimem/inmemdem.vrt", 2, vrtDatasetList.data(),
> nullptr, nullptr, nullptr);

--> this returns a GDALDatasetH. You need to GDALClose() it before being able to reopen it, 
so that its content gets flushed to storage.

>   GDALDataset* poDS = reinterpret_cast<GDALDataset
> *>(GDALOpen("/vsimem/inmemdem.vrt", GA_ReadOnly));
> 
> When I run this, poDS is nullptr.
> 
> Could you guide me to the correct way to do it?
> 
> Best regards.
> Julien Osman.
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201001/363df356/attachment.html>


More information about the gdal-dev mailing list