bulk nearest neighbor - slow process

18 views
Skip to first unread message

Antonio Valanzano

unread,
Jul 10, 2024, 12:02:58 PMJul 10
to SpatiaLite Users
I have 2 tables:
buildings (5000 polygons)
sensors (110000 points)
and I would like to find  for each of the building the nearest sensor.

I have tried the VirtualKNN2 but I had to stop the processing after 10 minutes (only 2400 sensors analyzed out of 110000) .
The reason for such long time is because the implementation in Spatialite requires to start necessarily from the points (which are 20 times more than the buildings).
The output (once finished) should be for each point the distance to the nearest building and with a further step I should find for each building the smallest distance and then the correspondent sensor.

Looking at old documentation (VirtualKNN) I discovered that for this previous version of KNN the parameter ref_geometry is defined as
" any arbitrary Geometry (POINT, LINESTRING, POLYGON or whatever else) intended to represent the origin of the KNN search"
while for the lastest  version
the parameter ref_geometry is defined as
"some POINT Geometry representing the origin of the KNN2 search."

Because Virtual KNN is deprecated does someone know how to approach this problem in a more efficient way?

Antonio




Reply all
Reply to author
Forward
0 new messages