[Qgis-user] null geometries workaround

Jésahel Benoist djes1975 at gmail.com
Thu Jul 2 07:08:46 PDT 2020


I had to deal with null geometries (points) in a geopackage. As it shows
some QGIS strange behavior I decided to post this.

When the attributes table is by default on "filtered by view", switching to
"show all" is filtering null geometries. No way to show them... By changing
the default behaviour in the options to "show all", there's no more filter,
but it isn't possible to find faulty lines ; all graphic tools are working
as if everything was correct.

I've found that the "geometry attribute table" plugin by P. Whitten can
help, however, I wondered if there was a standard tool to do the job.

With QGIS 3.10.7, the 'removenullgeometries', 'fixgeometries',
'checkgeometries' processing tools doesn't work.
The checkgeometry tool finds them, but gives only the id without any option
to fix.

I found with "DB browser with SQLite" that the geometry was there, but x
and y were 0x0000 0000 0000 f87f. This is for 'not a number' (nan) value.
But I didn't find any expression to check for this value...

Finally, I found two ways to find the faulty lines :
The first is to create a calculated field with $x as value. (nan) is
clearly shown then.
The second is to make a filter with this simple formulae : if
(to_int($x)=0, true, false). The to_int() converts the nan value to 0, et
voila. Easy.

You're then free to add a part or delete the faulty lines.

Hope it helps some people...

Jésahel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200702/2b6565db/attachment.html>


More information about the Qgis-user mailing list