Here is the SQLite data with the data.
https://drive.google.com/file/d/0B_wUhean78RKRE5DdHRNMlhCTnc/view?usp=sharing
Here is the KNN Query that is not returning the adjacent polygons
select 277838 as slink,aa.slink as adj_slink,k.distance
from ashland_att aa join knn k
on k.fid=aa.rowid
where k.f_table_name='ashland_att'
and k.ref_geometry=(select shape from ashland_att where slink=277838)
and k.max_items=20
group by k.pos
having k.distance=0
The query return 0 rows for me.
That there are adjacent polygons is shown in this query:
select slink as adj_slink,st_distance(a.shape,b.shape)
from ashland_att a,ashland_att b
where st_touches(a.shape,b.shape)
and b.slink=277838
This returns 8 rows for me.
The KNN query is working correctly for most of the data. For example using 10000 instead of 277838
should return 8 records for the KNN query.
Bumping this to the top. Wondering why an error in a function does not seem to be receiving any attention.
For those that want to replicate the problem here is the text of the email that I sent:
Here is the SQLite data with the data.
https://drive.google.com/file/d/0B_wUhean78RKRE5DdHRNMlhCTnc/view?usp=sharing
Here is the KNN Query that is not returning the adjacent polygons
select 277838 as slink,aa.slink as adj_slink,k.distance
from ashland_att aa join knn k
on k.fid=aa.rowid
where k.f_table_name='ashland_att'
and k.ref_geometry=(select shape from ashland_att where slink=277838)
and k.max_items=20
group by k.pos
having k.distance=0
The query return 0 rows for me.
That there are adjacent polygons is shown in this query:
select slink as adj_slink,st_distance(a.shape,b.shape)
from ashland_att a,ashland_att b
where st_touches(a.shape,b.shape)
and b.slink=277838
This returns 8 rows for me.
The KNN query is working correctly for most of the data. For example using 10000 instead of 277838
should return 8 records for the KNN query.
> Bumping this to the top. Wondering why an error in a function does not
> seem to be receiving any attention.
This comes across as pretty aggressive.
I don't know this function, and don't have time to work on it in any case.
Perhaps Sandro is on holidays, or is busy on something else, or is sick.
Perhaps consider what you could do to fix it, instead of expecting free
support?
Brad
I can confirm that:1) this first query returns 0 results.2) the second returns 8 records after the faulty sql was corrected ('select slink as adj_slink' to 'select b.slink as adj_slink')
3) the third query brings 9 results, not 8
I can confirm that:1) this first query returns 0 results.2) the second returns 8 records after the faulty sql was corrected ('select slink as adj_slink' to 'select b.slink as adj_slink')The SQL in query 2 is not faulty, though it is not fully specified. I want the polygons in table a that are adjacent to the polygon in table b. Correct SQL would be select a.slink as adj_slink. Using b.slink just repeats the where clause for 8 rows. Not particularly useful information.3) the third query brings 9 results, not 8I forgot a to include a part of the where clause. where aa.slink<>277838. Otherwise the KNN will return the calling feature, where the feature and the adjacent feature are the same. Sorry about the mixup.
It is possible that something has been found that could also be the cause of this problem- not knowing your data as well as the data I used, it could not be reproduced-- had however a similar effect, so I hope it is the same problemThe cause is at the moment not clear, but the symptoms are- so we now have something to look for.M