[QGIS-Developer] QGIS equivalent of Turf/nearest-point function

Pankajeshwara Sharma pankajeshwara at gmail.com
Sun Nov 12 19:20:10 PST 2023


Dear Sebastian,

Thank you so much. I was just wondering if this tool can be called using
Python from within QGIS.

I am trying to write a Python equivalent of the following JavaScript block
of code.
nearestPoint = turf.nearestPoint(currentFeature, entire_dataset)

Yours sincerely,
Pankaj

On Mon, Nov 13, 2023 at 3:10 AM Sebastian Gutwein <bas at rdgland.com> wrote:

> Not that exact function that I am aware of but there is a *Distance to
> nearest hub (points) *tool in the processing toolbox that will give you
> the distance to all of the points and then you can choose the one with the
> shortest distance. You could also use select by expression using the *Closest
> Point *function.
>
> On Sun, Nov 12, 2023 at 7:14 AM Pankajeshwara Sharma via QGIS-Developer <
> qgis-developer at lists.osgeo.org> wrote:
>
>> Dear developers,
>>
>> I was wondering of there is a QGIS equivalent of Turf's nearest point
>> function?
>> https://www.npmjs.com/package/@turf/nearest-point
>>
>> The function takes a reference point and a FeatureCollection of Features
>> with Point geometries and returns the point from the FeatureCollection
>> closest to the reference.
>>
>>
>> Yours sincerely,
>> Pankaj Sharma
>> Research Fellow
>> University of Auckland
>> pankaj.sharma at auckland.ac.nz
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
>
> --
> ___________________________
> Sebastian "Bas* " Gutwein
> *rhymes with Josh
>
> Regenerative Design Group
> 1 Chevalier Ave
> Greenfield, Ma 01301
> Web: regenerativedesigngroup.com
> (631) 241-1018
>
> *Look close, think big, make change. *
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20231113/de3104fd/attachment-0001.htm>


More information about the QGIS-Developer mailing list