Distance between 2 POINTs in Postgis in srid 4326 in metres

前端 未结 3 1540
我寻月下人不归
我寻月下人不归 2021-01-31 09:58

This is probably a simple question, but I\'m not very good at PostGIS and don\'t fully grok all of this.

Basically I have a table (nodes) with a POINT colum

3条回答
  •  温柔的废话
    2021-01-31 10:32

    You could use ST_Transform to use meters, also remeber that not all functions are available with geography types but if you really need speed use ST_DWithin, is the fastest way. Here's an aproximation of conversions between degrees and meters:

    | places | degrees    | distance |
    | ------ | ---------- | -------- |
    | 0      | 1.0        | 111 km   |
    | 1      | 0.1        | 11.1 km  |
    | 2      | 0.01       | 1.11 km  |
    | 3      | 0.001      | 111 m    |
    | 4      | 0.0001     | 11.1 m   |
    | 5      | 0.00001    | 1.11 m   |
    | 6      | 0.000001   | 0.111 m  |
    | 7      | 0.0000001  | 1.11 cm  |
    | 8      | 0.00000001 | 1.11 mm  |
    

提交回复
热议问题