[postgis-devel] Float vs Double Box

Nicklas Avén nicklas.aven at jordogskog.no
Thu Nov 10 23:47:43 PST 2011


> Or floats for every box, right ?
> That should be pretty consistent: box operations are floats,
> shape operations are double.

No, there will still be problems.
Look at the example I posted yesterday. When it comes to ordering by
distance between bboxes you might get the wrong answer.

So nearest neighbor calculations with knn will not be robust

SELECT id, ST_Distance(a, b), a<->b FROM 
(SELECT 1 id, 'POINT(300000 6000000)'::geometry a, 'POINT(300001.0
6000001.4)'::geometry b 
UNION ALL
SELECT 2 id, 'POINT(300000 6000000)'::geometry a, 'POINT(300001.1
6000001.1)'::geometry b ) c
ORDER BY  a<->b

Run it and look at the order of st_distance compared to the order of <->
Here it is of course without index use, but I guess the result is the
same with index.

/Nicklas




More information about the postgis-devel mailing list