[postgis-devel] Wrong answer from new knn with recheck

Paul Ramsey pramsey at cleverelephant.ca
Sat May 23 16:57:49 PDT 2015


What happens when you run the query using the suspect house as a literal instead of doing the fun lateral query?

P. 


--  
http://postgis.net  
http://cleverelephant.ca


On May 23, 2015 at 1:36:55 PM, Nicklas Avén (nicklas.aven at jordogskog.no) wrote:
> Since I cannot reach trac I post it here.
>  
> I have been playing some with latest trunk and latest postgresql.
>  
> Since I cannot reach trac I cannot check that it is absolute latest
> trunk but I have r13544
>  
> PostgreSQL I pulled from git yesterday.
>  
> I have 2 data sets. one with roads and one with houses.
>  
> Attached is data that reproduces the problem.
>  
> table r is the roads and table t is the houses.
>  
>  
> If I then run this query:
>  
> SELECT t.navn, r.gid, st_distance(r.geom, t.geom)
> FROM t CROSS JOIN LATERAL
> (SELECT r.gid, r.geom FROM r ORDER BY t.geom <->r.geom LIMIT 2) r;
>  
> I get this result:
> navn | gid | st_distance
> ----------------------------------+---------+------------------
> Gramstad | 988075 | 90.2225986190226
> Gramstad | 986169 | 128.356279805393
> Sidhusgohpi | 982379 | 1379790.96016902
> Sidhusgohpi | 1724598 | 27839.424840718
>  
>  
> What is totally wrong here is the third row. That road is 1379 km away.
> The last row gives the right answer. The closest road to that house is
> 27 km away.
>  
> With the full data sets I can play with the limit and see how roads from
> the first house in some way is following to the second house. road nr
> 982379 is just 215 meters away from house nr 1. So something is not
> letting go.
>  
>  
> Thanks
>  
> Nicklas Avén
>  
>  
>  
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list