<div dir="ltr">Sorry for the delay in reply Andrea. Yes, it did work. Thank you for your help.<div><br></div><div>Regards.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 31, 2022 at 3:55 AM Andrea Giudiceandrea <<a href="mailto:andreaerdna@libero.it">andreaerdna@libero.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<blockquote type="cite">
<div style="color:rgb(0,0,0);font-family:helvetica,arial,sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">
<p style="font-size:13px;color:rgb(102,102,102)"><span style="margin-right:0.5em;border-right:1px solid rgb(221,221,221);padding-right:0.8em"><a href="https://www.mail-archive.com/search?l=qgis-user@lists.osgeo.org&q=from:%22Simon+Dietmann%22" rel="nofollow" style="color:rgb(102,102,102);text-decoration:none" target="_blank"><span><span>Simon Dietmann</span></span></a></span><span> </span><span><a href="https://www.mail-archive.com/search?l=qgis-user@lists.osgeo.org&q=date:20220131" rel="nofollow" style="color:rgb(102,102,102);text-decoration:none" target="_blank">Mon, 31 Jan 2022 00:07:19 -0800</a></span></p>
</div>
<div style="color:rgb(0,0,0);font-family:helvetica,arial,sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">
<pre style="font-family:courier,"courier new",monospace;font-size:1em;white-space:pre-wrap;margin:0px">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.
</pre>
</div>
</blockquote>
<br>
Hi Simon,<br>
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.<br>
<br>
Could you please try this:<br>
<br>
- create a new scratch (Memory) point layer<br>
- add a single point to the memory layer<br>
- use the expression overlay_nearest(@layer,$geometry) in the field
calculator for such layer: the preview will show [] (i.e. no nearest
geometry returned)<br>
<br>
- export the memory layer with a single point to a Shapefile layer<br>
- import the Shapefile layer with a single point<br>
- use the expression overlay_nearest(@layer,$geometry) in the field
calculator for such layer: the preview will show [ <span style="font-style:italic"><geometry: Point></span> ] (i.e. the
expression incorrectly returns the very some point as the nearest
point)<br>
<br>
- export the memory layer with a single point to a GeoPackage or a
Spatialite layer<br>
- import the GeoPackage or a Spatialite layer with a single point<br>
- use the expression overlay_nearest(@layer,$geometry) in the field
calculator for such layer: the preview will show [] (i.e. no nearest
geometry returned)<br>
<br>
Best regards.<br>
<br>
Andrea Giudiceandrea<br>
</div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div>