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

Julien Osman julien.osman at csgroup.eu
Thu Oct 1 08:17:41 PDT 2020


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);
  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.



More information about the gdal-dev mailing list