Postgis

Geometry:
st_setsrid(st_point(xx, xx), 4326)
ST_GeomFromText('POINT(121.550831 31.281347)',4326)
Geography:
CAST(st_setsrid(st_point(xx, xx), 4326) as geography)
st_geographyfromtext('SRID=4326;POINT(121.550831 31.281347)')
更新几何对象中心点
update table SET center_point = st_centorid(boundary)
多边形
st_geomfromtext('MULTIPOLYGON (((120.3413855185274 30.32735332094727, 120.3407992852243 30.32823925237491, 120.3396179932952 30.32824138741688, 120.3390319212804 30.32735757447267, 120.3396181403135 30.3264716288156, 120.3407994322755 30.32646949377494, 120.3413855185274 30.32735332094727)), ((120.3382551010078 30.32687106026084, 120.3374012548605 30.32815445311701, 120.3357027860405 30.32815759553757, 120.3348491755746 30.32687736075593, 120.3357029981805 30.32560194310398, 120.3374014670707 30.32559880068611, 120.3382551010078 30.32687106026084)))', 4326) 
面积
st_Area(boundary :: geography)
点间距离(米)
Tip: 点间距离用geography类型计算
     几何间运算用geometry
st_distance(point1 :: geography, point2 :: geography)

一定距离内的点
st_clusterwithin(geometry, float(distance / 111195)) 米转化成度
类型
round(3.423, 2)
cast(1 as numeric)
xx :: geometry
NUMERIC: 存储空间不限,精度任意
多边形内随机取点
ST_AsText(st_pointonsurface(boundary :: geometry)) 

你可能感兴趣的:(Postgis)