nearest N objects (points)

المشرف العام

Administrator
طاقم الإدارة
i'm searching nearest ten neighbor points from a giving point.

When i use this query:

SELECT id, geom, ST_Distance(geography(geom), ST_GeographyFromText('SRID=4326;POINT(-0.22707 51.5444204)')) as distanceFROM carsORDER BY geom 'SRID=4326;POINT(-0.22707 51.5444204)'::geometryLIMIT 10;

i don't get the same result as when i use this query:

SELECT id, geom, ST_Distance(geography(geom), ST_GeographyFromText('POINT(-0.22707 51.5444204)')) as distanceFROM carsORDER BY distanceLIMIT 10;

Three of all the points returned are different. And when viewing it in qgis it looks like the best result is the last query. I need to use index-based KNN because of performance issues.

can you give some hint?



أكثر...
 
أعلى