<div dir="ltr"><div><div><div>I put in a ticket a while back. Here it is:<br><br><a href="https://issues.qgis.org/issues/16524#change-83842">https://issues.qgis.org/issues/16524#change-83842</a><br><br></div>The problem does not happen with the "New Temporary Scratch Layer". It only occurs with other 3rd party plugins with memory layers. You can easily reproduce it by either using using the "New Memory Layer" plugin and create two layers with polygons that overlap then do a geoprocessing difference or by using the Shape Tools plugin "Create Shapes" to create a polygon. Create two polygon layers where the polygons overlap and then run difference. I could probably write a script that does this to show it off if you want, if this is not sufficient.<br><br></div>Thanks,<br><br></div>Calvin<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 1, 2017 at 3:39 PM, Matthias Kuhn <span dir="ltr"><<a href="mailto:matthias@opengis.ch" target="_blank">matthias@opengis.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Hi Hamilton,</p>
    <p>It might be just me missing some context, in this case sorry.</p>
    <p>What exactly does go wrong?</p>
    <p>Would it be possible for you to generate some minimal,
      self-contained python code that shows the issue? Like generating
      one or two memory layers, plus an additional layer if required,
      invoke processing.runalg and provide expected and real results?</p>
    <p>This can then be integrated into our test-suite, so we can fix
      things and avoid this in the future.</p>
    <p>Thanks<br>
      Matthias<br>
    </p><div><div class="h5">
    <br>
    <div class="m_1179240721110583975moz-cite-prefix">On 11/01/2017 08:22 PM, C Hamilton
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>It has come to my attention that a few of the plugins that
          create memory layer polygons do not work correctly with the
          Geoprocessing Tools such as Difference. Two examples include
          the "New Memory Layer" plugin (which is being replaced by
          core) and my own Shape Tools plugin. I'm sure that others out
          there have the same problem. What happens is that when you
          create the polygons with these tools and you run the
          Geoprocessing algorithms such as the Difference operator, you
          get features back that do not contain the proper output
          polygons.</div>
        <div><br>
        </div>
        <div>My question is how do I create these polygons to be valid
          to the new Geoprocessing algorithms? Currently I do the
          following:</div>
        <div><br>
        </div>
        <div>
          <table class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-highlight
gmail-m_327041085091658843m_8287713516171879065gmail-tab-size
gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line-container">
            <tbody>
              <tr>
                <td class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-blob-code
gmail-m_327041085091658843m_8287713516171879065gmail-blob-code-inner m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line" id="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-LC355">polygonLayer
                  <span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-k">=</span>
                  QgsVectorLayer(<span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-s"><span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-pds">"</span>Polygon?crs=ep<wbr>sg:4326<span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-pds">"</span></span>,
                  "Layer Name", <span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-s"><span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-pds">"</span>memory<span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-pds">"</span></span>)</td>
              </tr>
              <tr>
              </tr>
            </tbody>
          </table>
          ppolygon <span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-k">=</span>
          polygonLayer.dataProvider()</div>
        <div>...</div>
        <div>
          <table class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-highlight
gmail-m_327041085091658843m_8287713516171879065gmail-tab-size
gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line-container">
            <tbody>
              <tr>
                <td class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-blob-code
gmail-m_327041085091658843m_8287713516171879065gmail-blob-code-inner m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line" id="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-LC398">
                  featureout <span class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-pl-k">=</span>
                  QgsFeature()</td>
              </tr>
              <tr>
              </tr>
            </tbody>
          </table>
          <table class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-highlight
gmail-m_327041085091658843m_8287713516171879065gmail-tab-size
gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line-container">
            <tbody>
              <tr>
                <td class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-blob-code
gmail-m_327041085091658843m_8287713516171879065gmail-blob-code-inner m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line" id="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-LC399">
                  <p> featureout.setGeometry(QgsGeom<wbr>etry.fromPolygon([pts]))</p>
                  <p># pts is an array of QgsPoints of the polygon
                    vertices</p>
                </td>
              </tr>
              <tr>
              </tr>
            </tbody>
          </table>
          <table class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-highlight
gmail-m_327041085091658843m_8287713516171879065gmail-tab-size
gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line-container">
            <tbody>
              <tr>
                <td class="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-blob-code
gmail-m_327041085091658843m_8287713516171879065gmail-blob-code-inner m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-js-file-line" id="m_1179240721110583975gmail-m_327041085091658843m_8287713516171879065gmail-LC400"><br>
                </td>
              </tr>
              <tr>
              </tr>
            </tbody>
          </table>
          ppolygon.addFeatures([featureo<wbr>ut])</div>
        <div>...</div>
        <div>polygonLayer.updateExtents()</div>
        <div>QgsMapLayerRegistry.instance()<wbr>.addMapLayer(polygonLayer)</div>
        <div><br>
        </div>
        <div>What needs to be different? One of my concerns is that the
          geoprocessing algorithms takes the data, executes, fails to
          generate proper results, and doesn't give the user any warning
          that the results may be wrong. I sure hope this is only a
          memory layer issue and not also an issue with loading data
          from files or databases.</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Calvin<br>
        </div>
      </div>
      <br>
      <fieldset class="m_1179240721110583975mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
QGIS-Developer mailing list
<a class="m_1179240721110583975moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="m_1179240721110583975moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a>
Unsubscribe: <a class="m_1179240721110583975moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a></pre>
    </blockquote>
    <br>
  </div>

<br>______________________________<wbr>_________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br></blockquote></div><br></div>