简体   繁体   中英

How to get distance between two points Postgres?

Here is a query:

SELECT ST_DistanceSpheroid(geometry(a.location), ST_GeomFromText('POINT(28.828042, 47.023565)', 4326), 'SPHEROID["WGS 84",6378137,298.257223563]')
FROM users a
WHERE a.id=1

I got this error:

ERROR: ОШИБКА:  parse error - invalid geometry
HINT:  "POINT(28.828042, 4" <-- parse error at position 18 within geometry


SQL state: XX000

Where did I make mistake??

Well-known Text representations of points don't need a comma. Try this:

POINT(28.828042 47.023565)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM