<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Lars and other members of this list..</p>
    <p>I feel somewhat obligated to help Lars since it's a problem he
      has inherited from me. (Sorry about that...)  <br>
    </p>
    <p>To sum it up:<br>
    </p>
    <p>If QGIS connects to a WFS based layer from Geoserver using an
      existing project with styled layers and one or more layers
      containing <i>zero</i> objects, QGIS can't determine the object
      type (point, line-string, polygon...) for those layers. QGIS will
      not show legends  and promptly forget any layer information stored
      in the project related to the object-type, ex. styling
      information. <br>
    </p>
    <p>And what is worse - this is a permanent situation: If you save
      the project in the above-mentioned state and reopen it at a later
      time - where the layers <i>now</i> contains objects - QGIS has
      forgotten the styling and other information, so the layers stays
      invisible and without the former styling. <br>
    </p>
    <p>(long posting...)<br>
    </p>
    <p>I've done some tests to determine the root cause of this problem:</p>
    <ul>
      <li>Setup of a Postgres database <i>and </i>a SQL Server
        database.<br>
        <br>
      </li>
      <li>Loaded the same MapInfo-dataset twice into each database,
        called them tableA and tableB, and populated the meta-table
        "dbo.geometry_columns" with the correct information for tableA
        and tableB in SQLServer.<br>
        <br>
      </li>
      <li>Installed a fresh Geoserver 2.15 and MapServer TinyOWS WFS-T
        server <br>
        <br>
      </li>
      <li>Setup a Workspace in Geoserver with 4 layers: tableA and -B
        from SQLServer and the same tables from Postgres using WFS.<br>
        <br>
      </li>
      <li>In Geoserver, the datastore definition for the SQLServer
        tables has a pointer to the "dbo.geometry_columns" meta-table.<br>
        <br>
      </li>
      <li>Setup of TinyOWS with tableA and -B from Postgres <br>
        <br>
      </li>
      <li>And lastly: Made a project in QGIS 3.4.7 /Windows 64bit with
        the 6 WFS layers: <br>
        <br>
      </li>
      <ul>
        <li>tableA is shown 3 times: <br>
          <br>
        </li>
        <ol>
          <li>From SQLServer through GeoServer; <br>
          </li>
          <li>From Postgres through GeoServer <br>
          </li>
          <li>From Postgres through Tiny-WFS<br>
            <br>
          </li>
        </ol>
        <li>tableB is shown 3 times using the same setup as tableA</li>
      </ul>
    </ul>
    <p>All 6 layers in QGIS was shown correctly and the object type for
      all layers was recognized.</p>
    <p>After this I <i>deleted</i> all rows from tableB in <i>both</i>
      MS-SQLServer and in Postgres and reopened the same QGIS project:</p>
    <ul>
    </ul>
    <ul>
      <li>The layer showing (the zero objects) tableB from SQLServer
        through GeoServer was not in order.</li>
      <li>The 5 other layers was shown correctly. Legends was correct
        and styling was not deleted<br>
      </li>
    </ul>
    I'm drawing the following conclusion:
    <ul>
      <li>GeoServer WFS connections (maybe in conjunction with QGIS)
        doesn't work properly when the dataprovider is MS-SQLServer and
        the layers contains zero objects. More precisely: GeoServer's
        SQLServer dataprovider can't or don't use geometry_columns
        meta-table defined in the datastore as described in:
<a class="moz-txt-link-freetext" href="https://docs.geoserver.org/stable/en/user/data/database/sqlserver.html#using-the-geometry-metadata-table">https://docs.geoserver.org/stable/en/user/data/database/sqlserver.html#using-the-geometry-metadata-table</a>
        .</li>
    </ul>
    <p>After this test I've tried to change the placement and existence
      of the "<span>geometry_columns" metadata table</span>:  <br>
    </p>
    <ul>
      <li>No value</li>
      <li>dbo.geometry_column (ordinary placement)<br>
      </li>
      <li>data.geometry_column (I made a copy of the geometry_columns
        table and placed it in the same schema as the test tables)</li>
      <li>geometry_columns (without schema definition)<br>
      </li>
    </ul>
    <ul>
    </ul>
    <p>Nothing of the above worked.<br>
    </p>
    <p>@Lars: <br>
      You might change your database system to Postgres and perhaps
      replace GeoServer with TinyOWS for WFS purposes (ducks and and
      run....) . <br>
      Or getting the issue investigated and fixed using some GeoServer
      core developer, perhaps in cooperation with a QGIS core developer?
      <br>
      Apparently the problem is fixable, since neither TinyOWS or
      GeoServer/Postgres have the same  issues.<br>
    </p>
    <p>Obviously, the above is a far cry from a really rigorous
      investigation of the problem, but it points at some of the "pain"
      points <br>
    </p>
    <p>Regards</p>
    <p>Bo Victor Thomsen<br>
    </p>
    AestasGIS<br>
    Denmark<br>
    <br>
    <div class="moz-cite-prefix">Den 09-05-2019 kl. 13:36 skrev Lars I.
      Nielsen, LIFA A/S:<br>
    </div>
    <blockquote type="cite"
      cite="mid:6EDB455314CAD940983B0F3ACAC4B0A53B001868@Mail2010.LIFA.DK">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Markeringsbobletekst Tegn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Arial","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.MarkeringsbobletekstTegn
        {mso-style-name:"Markeringsbobletekst Tegn";
        mso-style-priority:99;
        mso-style-link:Markeringsbobletekst;
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Hi developers.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">I asked this question on the user’s list, so
            far without any answers, but have been advised to ask here
            as well.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">I’m working with a number of projects, which
            statically open a fixed number of layers. All layers are
            fetched using WFS / WFS-T.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Each layer has an extensive rule based styling,
            and an extensive field/attribute dialog setup. This is saved
            in the project files.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Our plugin changes the data provider filter for
            many layers, when the user works with the data. These filter
            expressions are also saved in the project, of course.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Our problem is, that if the user accidently
            chooses a work area (= new data provider filter), which
            contain no data in any layer, those layers lose all styling
            etc. And it’s apparently impossible to recover these styles
            etc. by changing the filter back.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">So basically the user’s project is
            unrecoverably trashed at this point in time.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">A - Is this a correct description of how QGIS
            handles “no-data” layers ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">B - Are there any standard ways to handle this
            in QGIS (using metadata or otherwise) in an automated
            fashion (i.e. not manually) ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">C - If the answers to A and B are yes and no
            resp., are there any plans to remedy this unnecessarily
            serious problem ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Might it not be solved simply by adding an
            (optional?) layer metadata key, that stores the last used
            topology, and revert to this if no data are found on the
            layer ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">Using 3.4.5 x64 (Danish)<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"
            lang="EN-US">Med venlig hilsen</span><o:p></o:p></p>
        <p class="MsoNormal"
          style="mso-margin-top-alt:auto;margin-bottom:11.9pt"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"
            lang="EN-US">Lars I. Nielsen, LIFA A/S</span><span
            style="font-family:"Arial","sans-serif""><br>
          </span><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""
            lang="EN-US">GIS-konsulent, FME Certified Professional</span><span
            style="font-family:"Arial","sans-serif""><br>
            <br>
          </span><span
style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:DA"><img
              id="_x0000_i1026"
              src="cid:part1.1FAE1013.78CF387D@gmail.com"
              alt="Beskrivelse: http://website.lifa.dk/lsp.gif" class=""
              height="77" width="270"></span><o:p></o:p></p>
        <table class="MsoNormalTable" style="width:225.0pt"
          cellspacing="0" cellpadding="0" width="300" border="0">
          <tbody>
            <tr>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">T</span></b><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">6313
                    6800</span><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">@</span></b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""><a
                      class="moz-txt-link-abbreviated"
                      href="mailto:lin@lifa.dk">lin@lifa.dk</a></span><o:p></o:p></p>
              </td>
            </tr>
            <tr>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">D</span></b><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">6313
                    6849</span><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">W</span></b><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""><a
                      href="http://www.lifa.dk" moz-do-not-send="true"><span
                        style="color:blue">www.lifa.dk</span></a></span><o:p></o:p></p>
              </td>
            </tr>
            <tr>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">M</span></b><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">2492
                    4866</span><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">CVR</span></b><o:p></o:p></p>
              </td>
              <td style="padding:0cm 0cm 0cm 0cm">
                <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">20937289</span><o:p></o:p></p>
              </td>
            </tr>
          </tbody>
        </table>
        <p class="MsoNormal"><br>
          <a href="https://www.linkedin.com/company/lifa-a-s/"
            moz-do-not-send="true"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:DA;text-decoration:none"><img
                id="_x0000_i1025"
                src="cid:part4.8F4F19C4.A4E4B371@gmail.com"
                alt="Beskrivelse:
C:\Users\lin\AppData\Roaming\Microsoft\signatures\21x21-Images-Get-L749-l8.png"
                class="" height="21" width="21" border="0"></span></a><span
style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
            Følg os på LinkedIn og læs de seneste nyheder fra LIFA A/S </span><o:p></o:p></p>
      </div>
      <!--'"--><br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
    </blockquote>
    <br>
  </body>
</html>