<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">So if both a layerid and layername, you would prever layerid over layername ?</span></blockquote><div>no, the other way around</div><div><br></div><div>Default: layername, only when a duplicate layername exists, should the id be used</div><div>Checking for duplicate names is done in subLayers()</div><div>- if layername is unique, id will be set to -1 and sent to QgsOgrProvider</div><div><br></div><div>QgsOgrProvider would </div><div>- use GDALDatasetGetLayer if id >= 0<br></div><div>otherwise <br></div><div>- use GDALDatasetGetLayerByName</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">To solve the issue of several geometry fields we also need a (optional) parameter with the </span><span style="font-size:12.8px">geometry column name.</span></blockquote><div><br></div><div>subLayers() will send the layer name in the 'table_name(field_name)' format<br></div></div><div><br></div><div>It was only with gdal 1 that GDALDatasetGetLayerByName could not use that format.</div><div>That means the 'table_name(field_name)' format can always be used.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">>From a robustness point of view, I think we should be robust to layerid being absent from the</span><br style="font-size:12.8px"><span style="font-size:12.8px">URI (and I'd prefer that when we generate URI, we don't set layerId = -1 but just remove it)</span><br style="font-size:12.8px"><span style="font-size:12.8px">since URIs can also been built by users and not only through the UI. </span></blockquote><div>Since it is not a mandatory parameter inside QgsOgrProvider where the string is being parsed, the default value of -1 will be used.</div><div>- so there is no need to store a -1 value in the project.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">We shoud also be robust</span><br style="font-size:12.8px"><span style="font-size:12.8px">to layername from being absent as well, as done currently.</span></blockquote><div>Yes, also not a mandatory parameter</div><div>- at the moment QgisApp::askUserForOGRSublayers removes the layername sent by, so everything also works without a layername  being sent.</div><div><br></div><div>I have started a manual merge into the QGIS 3 version, making sure that the many changes are not disturbed.</div><div><br></div><div>Also all gdal 1 switches and the '>= GDAL_COMPUTE_VERSION(2,0,0)' will be removed.</div><div><br></div><div>So I hope to offer a QGIS 3 pull request in the next few days.</div><div><br></div><div>---</div><div>I would also like to adapt QgsOgrProvider::ogrWkbGeometryTypeName </div><div>- to use QgsWkbTypes::displayString first</div><div>and only when not found to check for geometry types not supported by qgis when needed.</div><div><br></div><div>ogrWkbGeometryTypeFromName must remain, since there is no corresponding function in QgsWkbTypes.<br></div><div><br></div><div>Mark</div></div>