Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-25 Thread Andrea Giudiceandrea via Qgis-user

Il 25/07/2022 16:12, Tudorache, Marian ha scritto:
When I open the QGIS project created with QGIS2.18 I got a message 
which notify me the project is an old version of QGIS and some 
conversion was done.


So when I open QGIS 2.18 project something happened with the data and 
was transformed from LineString to MultiLineString.


Is this normal behaviour for QGIS 3 to convert the geometry type from 
single part to multiple parts?

Is any method to supress this transformation?



Hi Marian,
AFAIK the QGIS project update process doesn't actually transform any of 
your data, it only updates the qgs/qgz file.


The different behaviour is probably due to a change in the QGIS API 3 
and in the way a Shapefile layer is loaded in QGIS 3.

Basic Shapefile layer shape types [1] are:
- Point
- MultiPoint
- PolyLine
- Polygon

As you can see, there are Point and MultiPoint types, but only PolyLine 
and Polygon types and not also MultiPolyLine and MultiPolygon types.


In fact, the Shapefile format treats the PolyLine and the Polygon shape 
types as layers that can contain both (multi-part) geometries with only 
1 part and (multi-part) geometries with 2 or more parts. They are 
actually multi-part layer types.


With QGIS 2.18, a feature geometry with only 1 part in a PolyLine shape 
type Shapefile layer was considered as a LineString WKT geometry type, 
while a feature geometry with 2 or more parts in the same layer was 
considered as a MultiLineString WKT geometry type. Thus, you needed to 
correctly use asPolyline() or asMultiPolyline() for features geometries 
in the same PolyLine shape type Shapefile layer depending on the actual 
feature geometry type.


With QGIS 3, both the feature geometry with only 1 part and the feature 
geometry with 2 or more parts in a PolyLine shape type Shapefile layer 
are considered as MultiLineString WKT geometry type. Thus, you can 
always use asMultiPolyline() for all the geometries in the same PolyLine 
shape type Shapefile layer.


Best regards.

Andrea

[1] 
https://www.esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/library/whitepapers/pdfs/shapefile.pdf


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-25 Thread Tudorache, Marian via Qgis-user
Hi Andrea,

I asked permission to share these coverage files with you and the company 
cannot do this because the data belongs to ESRI and we are only the users of 
the data.
But I removed these files .idm and and .ind and everything is fine.
Thank you.

I have one more observation.
When I converted the data from coverage to shapefile using QGIS2.18 the 
geometries were simple parts. For example to extract the points from an arc 
layer I had to use arc.geometry().asPolyline()
The shapefiles were under a QGIS project (.qgs).
When I open the QGIS project created with QGIS2.18 I got a message which notify 
me the project is an old version of QGIS and some conversion was done.

When I ran some algorithm which tried to arc.geometry().asPolyline() I got this 
error.
Traceback (most recent call last):
  File "/usr/lib64/python3.9/code.py", line 90, in runcode
exec(code, self.locals)
  File "", line 1, in 
TypeError: MultiLineString geometry cannot be converted to a polyline. Only 
single line or curve types are permitted.

So when I open QGIS 2.18 project something happened with the data and was 
transformed from LineString to MultiLineString.
Is this normal behaviour for QGIS 3 to convert the geometry type from single 
part to multiple parts?
Is any method to supress this transformation?

Thank you,
Marian


From: Qgis-user  On Behalf Of Andrea 
Giudiceandrea via Qgis-user
Sent: July 25, 2022 5:12 AM
To: qgis-user@lists.osgeo.org
Subject: [EXT] Re: [Qgis-user] Filtering layer or selected features by 
attributes does not work for new added features in QGIS 3.22.8

Tudorache, Marian Sun Jul 24 11:⁠​14:⁠​30 PDT 2022 How these .⁠​idm and and 
.⁠​ind files were created? These files are created by reading ESRI coverage 
data used in an application under ArcInfo:⁠​ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ 
‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍

Tudorache, Marian
Sun Jul 24 11:14:30 PDT 2022


How these .idm and and .ind files were created?

These files are created by reading ESRI coverage data used in an application 
under ArcInfo:

Hi Marian,
could you share a link to a sample of such ESRI coverage data file for which 
the conversion to a Shapefile layer creates the .idm and and .ind attributes 
indexes sidecar files?




Cab these file be recreated without knowing?

Looking at the QGIS code, it seems such attributes indexes sidecar files could 
be unknowingly created if the user uses the Shapefile layer in a join (via 
layer Property->Joins) enabling the "Create attribute index on join field" 
option.
An user can also directly create attributes indexes using the "Create attribute 
index" processing algorithm, or e.g. using the GDAL/OGR "ogrinfo" command [1] 
[2], or using a Python script, or ... .

Best regards.

Andrea


[1] 
https://gdal.org/drivers/vector/shapefile.html#spatial-and-attribute-indexing
[2] 
https://gdal.org/user/ogr_sql_dialect.html#create-index



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.

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.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-25 Thread Andrea Giudiceandrea via Qgis-user

*Tudorache, Marian*
/Sun Jul 24 11:14:30 PDT 2022/

How these .idm and and .ind files were created?
These files are created by reading ESRI coverage data used in an application 
under ArcInfo:


Hi Marian,
could you share a link to a sample of such ESRI coverage data file for 
which the conversion to a Shapefile layer creates the .idm and and .ind 
attributes indexes sidecar files?




Cab these file be recreated without knowing?


Looking at the QGIS code, it seems such attributes indexes sidecar files 
could be unknowingly created if the user uses the Shapefile layer in a 
join (via layer Property->Joins) enabling the "Create attribute index on 
join field" option.
An user can also directly create attributes indexes using the "Create 
attribute index" processing algorithm, or e.g. using the GDAL/OGR 
"ogrinfo" command [1] [2], or using a Python script, or ... .


Best regards.

Andrea


[1] 
https://gdal.org/drivers/vector/shapefile.html#spatial-and-attribute-indexing

[2] https://gdal.org/user/ogr_sql_dialect.html#create-index___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-24 Thread Tudorache, Marian via Qgis-user
Hi Andrea,

Thank you for your advice.
How these .idm and and .ind files were created?
These files are created by reading ESRI coverage data used in an application 
under ArcInfo:
vLayer = qgis.core.QgsVectorLayer(coverageSource + "|layername=arc", 
layerSourceName, "ogr")
and I created shapefile like this
qgis.core.QgsVectorFileWriter.writeAsVectorFormat(vLayer, \
  
shapeDestination + "/" + shapeLayerName + ".shp", \
  "utf-8", \
  srs, \
  "ESRI 
Shapefile")

What is interesting not all the shapefiles have these idm and ind files.
QGIS 2.18 did not have this problem.

Anyway, I assume I can have a general script to remove any file with extension 
idm and ind.
Cab these file be recreated without knowing?

Thanks,
Marian

From: Andrea Giudiceandrea 
Sent: July 23, 2022 6:29 AM
To: Tudorache, Marian ; qgis-user@lists.osgeo.org
Subject: [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

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.⁠​ 
Moreover,

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. Moreover, 
better to avoid attach big files to an e-mail message (better to specify a link 
to an online resource).

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].

If you remove such .idm and and .ind files, then the issue will not occur with 
your ESRI Shapefile layer.

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.

Best regards.

Andrea Giudiceandrea



[1] 
https://gdal.org/drivers/vector/shapefile.html#spatial-and-attribute-indexing
Il 22/07/2022 21:54, Tudorache, Marian ha scritto:
Hi Andrea,

Thank you for your answer.
I attach the an archive with the shapefile in question.
I also attached a video to see what is going on.



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.

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.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-23 Thread Andrea Giudiceandrea via Qgis-user

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. Moreover, better to avoid attach big files to an e-mail 
message (better to specify a link to an online resource).


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].


If you remove such .idm and and .ind files, then the issue will not 
occur with your ESRI Shapefile layer.


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.


Best regards.

Andrea Giudiceandrea



[1] 
https://gdal.org/drivers/vector/shapefile.html#spatial-and-attribute-indexing

Il 22/07/2022 21:54, Tudorache, Marian ha scritto:


Hi Andrea,

Thank you for your answer.

I attach the an archive with the shapefile in question.

I also attached a video to see what is going on.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-22 Thread Andrea Giudiceandrea via Qgis-user

*Tudorache, Marian*
/Thu Jul 21 15:47:27 PDT 2022/

Why QGIS 3.22.8 does not filter or select new features by attribute?
I did not have this problem in QGIS 2.18.


Hi Marian,
could you please share your layer so it is possible to verify the issue?

Best regards.

Andrea Giudiceandrea___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Filtering layer or selected features by attributes does not work for new added features in QGIS 3.22.8

2022-07-22 Thread Kai Borgolte via Qgis-user
Am 22.07.2022 um 00:47 schrieb Tudorache, Marian via Qgis-user:

[
filter "ID" = 100 doesn't find feature
filter NOT "ID" != 100 finds feature
]

Weird. Which data source/provider do you use? What is "sfgdws19" in your
screenshots?
Is the field "ID" declared as numeric?
--
Kai Borgolte, Bonn
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user