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
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 |
Old question but you just have to cast like this: ST_Distance(p.geom::geography, u.geom::geography)
where p and u are alias for two tables
Since writing this, I have discovered the "geographic" as opposed to the "geometry" type in PostGIS, which might do exactly what I want.