<div dir="ltr">hello Carl,<div>in the end I need to implement support for vectors, so yes, WFS is where I need to go, but in the interim, i need wms rasters as well.</div><div><br></div><div>Ming</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 17 Jun 2021 at 11:58, Carl Godkin <<a href="mailto:cgodkin@gmail.com">cgodkin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Ming,<div><br></div><div>There are no vector layers in WMS.  It's for imagery only. </div><div><br></div><div>Perhaps you are interested in WFS instead?</div><div><br></div><div>carl</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 17, 2021 at 11:03 AM Ming Chin <<a href="mailto:mingchin.st@gmail.com" target="_blank">mingchin.st@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello Even,<div>thank you for your input.</div><div>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.</div><div>Can you, or anyone else here, point to a recommended guide/tutorial to implementing gdal wms vector layers (in c++)?</div><div><br></div><div>Thank you,</div><div>Ming</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 17 Jun 2021 at 08:47, Even Rouault <<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Ming,</p>
    <p>A OGRLayer is a *vector* layer, not a raster one. So you should
      rather look at the raster API:
      <a href="https://gdal.org/tutorials/raster_api_tut.html" target="_blank">https://gdal.org/tutorials/raster_api_tut.html</a></p>
    <p>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<br>
    </p>
    <p>Even<br>
    </p>
    <div>Le 17/06/2021 à 17:41, Ming Chin a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr"><br>
        <div>Hello GDAL devs,</div>
        <div><br>
        </div>
        <div>I am a GDAL rookie, and I am trying to add WMS support to
          an existing GDAL (2.2.4) implementation.</div>
        <div><br>
        </div>
        <div>I saw in this example:</div>
        <div><br>
        </div>
        <div><a href="https://gis.stackexchange.com/questions/67416/using-gdal-to-connect-to-a-wfs" target="_blank">https://gis.stackexchange.com/questions/67416/using-gdal-to-connect-to-a-wfs</a></div>
        <div><br>
        </div>
        <div>that its possible to provide <span>OGRSFDriverRegistrar::</span><span>Open(sURL, </span><span> FALSE
            );</span></div>
        <div><span><br>
          </span></div>
        <div><span>with a url and use it to open an OGRDataSource.</span></div>
        <div><span><br>
          </span></div>
        <div>And in other examples I see that <span>OGRSFDriverRegistrar::</span><span>Open() has been deprecated and
            that GDALOpen() should be used instead.</span></div>
        <div><span><br>
          </span></div>
        <div><span>So I did that, adding
            cURL to our GDAL build, and then in my implementation, I
            provided GDALOpen() with a URL like this:</span></div>
        <div><span><br>
          </span></div>
        <div><span>GDALDataset *pDataset
            = (GDALDataset*)::GDALOpen(sURL, GA_ReadOnly);<br>
          </span></div>
        <div><span>if( pDataset  )</span></div>
        <div><span>{</span></div>
        <div><span>    int nLayers = 
            pDataset->GetLayerCount();</span></div>
        <div><span>    OGRLayer *pLayer = 
            pDataset->GetLayerByName(sLayerName);</span></div>
        <div><span>}</span></div>
        <div><span><br>
          </span></div>
        <div><span>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;</span></div>
        <div><span><br>
          </span></div>
        <div>The above call returns nLayers = 0, and 
          pLayer=NULL</div>
        <div><br>
        </div>
        <div>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.</div>
        <div><br>
        </div>
        <div>What am I missing?  Why am I unable to retrieve useful data
          from the dataset?</div>
        <div><br>
        </div>
        <div>Ming</div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>