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

Pankajeshwara Sharma pankajeshwara at gmail.com
Fri Nov 17 06:41:39 PST 2023


Hello,

These QGIS features need to be invoked manually, and I was hoping that
these functions (or a similar one) could somehow be called using a Python
script from within QGIS. Maybe someone with knowledge of QGIS internal
functions can give advice on how these functions can be called.

Yours sincerely,
Pankaj

On Mon, Nov 13, 2023 at 4:20 PM Pankajeshwara Sharma <
pankajeshwara at gmail.com> wrote:

> 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/20231118/f5d04afb/attachment.htm>


More information about the QGIS-Developer mailing list