Geographic Information Systems Asked by The Guest on May 23, 2021
I am trying to load a WMS into my C++ program to use it as a GDALDataset
. The problem is that I am able to load the WMS but every time I am doing a GetRasterCount()
I get 0
; and every time I am trying to do a GetRasterBand(0)
I get "Erreur de segmentation (core dumped)"
.
I was doing the same thing for WFS (GetLayerCount()
and GetLayer(0)
) and it was working fine.
Here is my code:
GDALAllRegister();
GDALDataset *poDS = static_cast<GDALDataset*>(
poDS = (GDALDataset*)GDALOpenEx("https://geowebservices.stanford.edu/geoserver/ows?SERVICE=WMS&request=GetCapabilities", GDAL_OF_RASTER,NULL,NULL,NULL ));
if( poDS == NULL )
{
std::cout << "Dataset is empty" << std::endl;
GDALClose( poDS );
exit( 1 );
}
std::cout << "THE DATASET CONTAINS THIS MANY RASTER BANDS : " << poDS->GetRasterCount() << std::endl;
for (int i = 0; i < poDS->GetRasterCount(); i++){
GDALRasterBand *band;
band = poDS->GetRasterBand(i);
std::cout << band->GetXSize() << std::endl;
}
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP