Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Link GDAL to consume a WFS

$
0
0

Im using a WFS that is openly available as a demo from mapserver’s website

http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities

And now i want to make a client application that can consume this service in C++ (QT) using the GDAL libraries.

I have compiled GDAL with xerces and curl as the docs say but apart from that they are not very clear about how to use it for a WFS, im sure the functionality is there because it says it supports it but i cant find any WFS specific documentation so far i have just tried to open a connection and get this error:

GDALAllRegister();
const char *pszFilename = NULL;
pszFilename = "http://demo.mapserver.org/cgi-bin/wfs?";
m_dataset = (GDALDataset*) GDALOpen(pszFilename, GA_ReadOnly);

if( m_dataset == NULL )
{
    std::cout << "Dataset is empty" << std::endl;
    exit( 1 );
}

Error:

ERROR 4: `/vsimem/http_1/file.dat' not recognised as a supported file format.

Dataset is empty
ERROR 4: Failed to create temporary file:/tmp/file.dat

I have also tried instead of the URL, an XML document that contains the URl like the docs say this shoudl work

<OGRWFSDataSource>
    <URL>http://path/to/WFS/service[?OPTIONAL_PARAMETER1=VALUE[&amp;OPTIONNAL_PARAMETER2=VALUE]]</URL>
</OGRWFSDataSource> 

but this just says the file isnt a compatible type, any help would be appreciated here


Viewing all articles
Browse latest Browse all 397

Trending Articles