[gdal-dev] gdal & WMS
Ming Chin
mingchin.st at gmail.com
Thu Jun 17 11:02:29 PDT 2021
Hello Even,
thank you for your input.
I will review the raster API as you have suggested. However, as I
understand the requirements of my task, I need to support the vector API as
well, because we do need to support vector layers.
Can you, or anyone else here, point to a recommended guide/tutorial to
implementing gdal wms vector layers (in c++)?
Thank you,
Ming
On Thu, 17 Jun 2021 at 08:47, Even Rouault <even.rouault at spatialys.com>
wrote:
> Ming,
>
> A OGRLayer is a *vector* layer, not a raster one. So you should rather
> look at the raster API: https://gdal.org/tutorials/raster_api_tut.html
>
> Depending on the kind of URL you provide to GDAL, you may get directly a
> workable dataset, or just a placeholder that links to real datasets with
> the subdataset (which can be seen as a king of raster layer) mechanism,
> using GDALDataset::GetMetadata("SUBDATASETS") to get the list of
> subdatasets, and then pass to GDALOpen() the value of one of the
> SUBDATASET_xx_NAME item
>
> Even
> Le 17/06/2021 à 17:41, Ming Chin a écrit :
>
>
> Hello GDAL devs,
>
> I am a GDAL rookie, and I am trying to add WMS support to an existing GDAL
> (2.2.4) implementation.
>
> I saw in this example:
>
>
> https://gis.stackexchange.com/questions/67416/using-gdal-to-connect-to-a-wfs
>
> that its possible to provide OGRSFDriverRegistrar::Open(sURL, FALSE );
>
> with a url and use it to open an OGRDataSource.
>
> And in other examples I see that OGRSFDriverRegistrar::Open() has been
> deprecated and that GDALOpen() should be used instead.
>
> So I did that, adding cURL to our GDAL build, and then in my
> implementation, I provided GDALOpen() with a URL like this:
>
> GDALDataset *pDataset = (GDALDataset*)::GDALOpen(sURL, GA_ReadOnly);
> if( pDataset )
> {
> int nLayers = pDataset->GetLayerCount();
> OGRLayer *pLayer = pDataset->GetLayerByName(sLayerName);
> }
>
> This seems to partially work, in the sense that the GDALOpen function
> returns a non-NULL pointer to a GDALDataset, but when I try to call the
> member functions of the resulting GDALDataset, everything seems to return
> zeros or nulls;
>
> The above call returns nLayers = 0, and pLayer=NULL
>
> but if I feed the same sURL into my web browser (Chrome), the browser
> receives a properly formatted xml file that clearly has <Layer>(s) defined
> in it.
>
> What am I missing? Why am I unable to retrieve useful data from the
> dataset?
>
> Ming
>
>
> _______________________________________________
> gdal-dev mailing listgdal-dev at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210617/555a5871/attachment-0001.html>
More information about the gdal-dev
mailing list