[Qgis-user] Drop the points and show only clusters

Andrea Giudiceandrea andreaerdna at libero.it
Mon Jan 31 02:55:00 PST 2022


> Simon Dietmann 
> <https://www.mail-archive.com/search?l=qgis-user@lists.osgeo.org&q=from:%22Simon+Dietmann%22>Mon, 
> 31 Jan 2022 00:07:19 -0800 
> <https://www.mail-archive.com/search?l=qgis-user@lists.osgeo.org&q=date:20220131>
>
> the reason für all the ‘1’ values is obviously that the algorithm seeking for
> the nearest points always finds the original point itself. When I first used
> the expression that I had suggested as a solution for your problem, this didn´t
> happen and the original point wasn´t taken into accont, but when I later tried
> it with another point layer, I got the same result as you with ‘1’ for every
> point feature.

Hi Simon,
as I've written in a previous message, I think a bug occurs when the 
overlay_nearest function is used with a Shapefile layer, while the bug 
doesn't occur with a Memory or GeoPackage or Spatialite layer.

Could you please try this:

- create a new scratch (Memory) point layer
- add a single point to the memory layer
- use the expression overlay_nearest(@layer,$geometry) in the field 
calculator for such layer: the preview will show [] (i.e. no nearest 
geometry returned)

- export the memory layer with a single point to a Shapefile layer
- import the Shapefile layer with a single point
- use the expression overlay_nearest(@layer,$geometry) in the field 
calculator for such layer: the preview will show [ <geometry: Point> ] 
(i.e. the expression incorrectly returns the very some point as the 
nearest point)

- export the memory layer with a single point to a GeoPackage or a 
Spatialite layer
- import the GeoPackage or a Spatialite layer with a single point
- use the expression overlay_nearest(@layer,$geometry) in the field 
calculator for such layer: the preview will show [] (i.e. no nearest 
geometry returned)

Best regards.

Andrea Giudiceandrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220131/cc08bdb8/attachment.html>


More information about the Qgis-user mailing list