postgresql 计算距离
计算距离,直接生成单位为米的结果:
select ST_Length(Geography(ST_GeomFromText('LINESTRING(120.451737 36.520975,120.455636 36.520885)')));
计算某一个点到某条线的距离是不是在某个范围内:
select ST_Contains(St_Astext(ST_Buffer(geography(ST_GeomFromText('MULTILINESTRING((120.451737 120.451737,120.455636 36.520885))')),25.00))
,st_astext(geography(ST_GeomFromText('POINT(120.451737 120.451737)')))) as result
返回结果:t or f
参考:http://blog.csdn.net/duanmuxiao/article/details/45667221
转载自:https://blog.csdn.net/songsongmianbao/article/details/71125027