<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">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 style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px">OGRSFDriverRegistrar::</span><span class="gmail-hljs-built_in" style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;white-space:inherit;font-size:13px;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">Open(sURL, </span><span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px"> FALSE );</span></div><div><span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px"><br></span></div><div><span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px">with a url and use it to open an OGRDataSource.</span></div><div><span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px"><br></span></div><div>And in other examples I see that <span style="font-family:inherit;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;background-color:transparent;white-space:inherit">OGRSFDriverRegistrar::</span><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">Open() has been deprecated and that GDALOpen() should be used instead.</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit"><br></span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">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 class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit"><br></span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">GDALDataset *pDataset = (GDALDataset*)::GDALOpen(sURL, GA_ReadOnly);<br></span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">if( 

pDataset  )</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">{</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">    int nLayers = 

pDataset->GetLayerCount();</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">    OGRLayer *pLayer = 



pDataset->GetLayerByName(sLayerName);</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">}</span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit"><br></span></div><div><span class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">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 class="gmail-hljs-built_in" style="font-family:inherit;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;background-color:transparent;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit"><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>