01、创建 geometry类型的对象
select st_geomfromtext(('POINT(117 36.5)'),4326) as coords;
02、geometry转wkt
select st_astext(st_geomfromtext(('POINT(117 36.5)'),4326));
03、wkt转geojson
select st_asgeojson(st_astext(st_geomfromtext(('POINT(117 36.5)'),4326)));
04、geojson转geometry
select st_geomfromgeojson('{"type":"Point","coordinates":[117,36.5]}')
05、取geometry(point)里的x、y
select st_x(st_geomfromtext(('POINT(117 36.5)'),4326)) as x, st_y(st_geomfromtext(('POINT(117 36.5)'),4326)) as y
06、计算缓冲区域
select st_buffer(st_geomfromtext(('POINT(117 36.5)'),4326),2)
07、判断包含关系
select st_contains(st_geomfromtext(('POLYGON((119 36.5,120 37,121 36.5,120 36,119 36.5))')), st_geomfromtext(('POINT(120 36.5)')))