用得比较多的就是point、path、Polygon、text。下面是保存示例:
insert into aggregate_state(code,name,zoom,geom,longitude,latitude) VALUES("21","上海",7,ST_GeomFromText("SRID=4326;Polygon((117.357442 30.231278,119.235188 30.231278,119.235188 32.614617,117.357442 32.614617,117.357442 30.231278))"),
ST_X(st_centroid(ST_GeomFromText("SRID=4326;Polygon((117.357442 30.231278,119.235188 30.231278,119.235188 32.614617,117.357442 32.614617,117.357442 30.231278))"))),
ST_Y(st_centroid(ST_GeomFromText("SRID=4326;Polygon((117.357442 30.231278,119.235188 30.231278,119.235188 32.614617,117.357442 32.614617,117.357442 30.231278))")))
);
注意:SRID必须与设计的表对应,且Geometry的类型要对应,insert into示例还计算了面的中心展示位置方便聚合数据输出到地图显示。
参考阅读
几何(geometry)对象类型
Geometry——PostgreSQL+PostGIS的使用
Java Geometry空间几何数据的处理应用