-
Notifications
You must be signed in to change notification settings - Fork 84
Query items by geolocation and distance return incorrect results #266
Comments
How? If you know the answer it would be great if you could state that. |
I think I know what you are hinting here. The third parameter is interpreted as degrees rather than meters. |
Not a PostgreSQL expert but I think there is a problem when passing Geometry point as Lat Lng to ST_DWithin. |
@cychiuae Sounds good, let’s cast it to geography. You need to apply an index on the column using a geography type to make use of the index. |
http://postgis.net/docs/manual-2.3/using_postgis_dbmanagement.html#PostGIS_GeographyVSGeometry Always casting it to geography incurs performance penalty. By the way, if we decide to cast it anyway, would it be better to store it as
|
I am going to say the objective of this issue is to fix the bug that the distance predicate does not work. According to http://gis.stackexchange.com/questions/221978/st-dwithin-calc-meters-transform-or-cast:
Please open another issue suggesting that we switch to |
Suppose we have a record type product
We first create a product with location in Tower Hamlet, UK (lat: 51.5153574, lng: -0.0525232)
Then, we query product which within 5km from Lai Chi Kwok (lat: 22.3364240917999, lng: 114.14808275214)
Skygear uses ST_DWithin incorrectly.
Please look at http://postgis.net/docs/ST_DWithin.html
Expected Results
Far products should not be queried
Actual Results
Far products can be queried
The text was updated successfully, but these errors were encountered: