<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Hi Andrea,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Thank you for your advice.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">How these
</span><span style="font-size:11.0pt">.idm and and .ind files were created?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">These files are created by reading ESRI coverage data used in an application under ArcInfo:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">vLayer = qgis.core.QgsVectorLayer(coverageSource + "|layername=arc", layerSourceName, "ogr")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">and I created shapefile like this<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">qgis.core.QgsVectorFileWriter.writeAsVectorFormat(vLayer, \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                                                                  shapeDestination + "/" + shapeLayerName + ".shp", \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                                                                  "utf-8", \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                                                                  srs, \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                                                                  "ESRI Shapefile")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">What is interesting not all the shapefiles have these idm and ind files.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">QGIS 2.18 did not have this problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Anyway, I assume I can have a general script to remove any file with extension idm and ind.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Cab these file be recreated without knowing?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Marian<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> Andrea Giudiceandrea <andreaerdna@libero.it>
<br>
<b>Sent:</b> July 23, 2022 6:29 AM<br>
<b>To:</b> Tudorache, Marian <Marian.Tudorache@navcanada.ca>; qgis-user@lists.osgeo.org<br>
<b>Subject:</b> [EXT] Re: RE: Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="mso-line-height-alt:.75pt"><span style="font-size:1.0pt;color:white">Hi Marian, I advise you, for the future, to avoid sending e-mail messages to a mailing list user personal e-mail address (unless requested) and instead please always
 prefer to send the message/replay to the mailing list e-mail address.</span><span style="font-size:1.0pt;font-family:"Tahoma",sans-serif;color:white">⁠</span><span style="font-size:1.0pt;color:white">​ Moreover,
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-line-height-alt:.75pt"><span style="font-size:1.0pt;color:white"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">Hi Marian,<br>
I advise you, for the future, to avoid sending e-mail messages to a mailing list user personal e-mail address (unless requested) and instead please always prefer to send the message/replay to the mailing list e-mail address. Moreover, better to avoid attach
 big files to an e-mail message (better to specify a link to an online resource).<br>
<br>
Looking at the provided ESRI Shapefile layer, it seems to me the issue is due to the fact that in addition to the typical ESRI Shapefile files (.shp, .shx, .dbf, .prj, ...) are also present the non standard .idm and .ind files which contain the "attribute indexes
 as a mapinfo format index" [1].<br>
<br>
If you remove such .idm and and .ind files, then the issue will not occur with your ESRI Shapefile layer.<br>
<br>
What I suppose is that while QGIS, using the GDAL/OGR library, can use such non standard .idm and .ind files for attribute indexes, it (or the GDAL/OGR library) fails to properly update such attribute indexes files when a new feature is added to the layer.
 You can check this just looking at such files modification time in you file system when a new feature is added to the layer: such files are not modified.<br>
<br>
Best regards.<br>
<br>
Andrea Giudiceandrea<br>
<br>
<br>
<br>
[1] <a href="https://urldefense.com/v3/__https:/gdal.org/drivers/vector/shapefile.html*spatial-and-attribute-indexing__;Iw!!P0kg3YazkQ!Bt-tNo4aq3ENChJ2xQGTArs2o6LONBDrdCC4xd3u6NaDJSQJVEcm56YkkJjuk8ahBf9AviXt5MKBBGDgbqmDkal_wT_gv88$">
https://gdal.org/drivers/vector/shapefile.html#spatial-and-attribute-indexing</a><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Il 22/07/2022 21:54, Tudorache, Marian ha scritto:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Hi Andrea,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Thank you for your answer.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I attach the an archive with the shapefile in question.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I also attached a video to see what is going on.</span><o:p></o:p></p>
</blockquote>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This electronic message, as well as any transmitted files included in the electronic message, may contain privileged or confidential information and is intended solely for the use of the individual(s) or entity to which it is addressed. If you have received
 this electronic message in error please notify the sender immediately and delete the electronic message. Any unauthorized copying, disclosure or distribution of the electronic message is strictly forbidden. NAV CANADA accepts no liability for any damage caused
 by any virus and/or other malicious code transmitted by this electronic communication.<br>
<br>
Le présent message électronique et tout fichier qui peut y être joint peuvent contenir des renseignements privilégiés ou confidentiels destinés à l’usage exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez reçu ce message électronique
 par erreur, veuillez en informer l’expéditeur immédiatement et supprimez le. Toute reproduction, divulgation ou distribution du présent message électronique est strictement interdite. NAV CANADA n’assume aucune responsabilité en cas de dommage causé par tout
 virus ou autre programme malveillant transmis par ce message électronique.<br>
</font>
</body>
</html>