PostGIS 测试 - 多边形(POLYGON)

1.建表

CREATE TABLE polygontable ( 
  id SERIAL PRIMARY KEY,
  name VARCHAR(128),
   geom GEOMETRY(POLYGON, 26910)
);

2.添加GIST索引

CREATE INDEX polygontable_gix ON polygontable USING GIST (geom); 

3.插入数据

INSERT INTO polygontable (name, geom) VALUES ('p1',
  ST_GeomFromText('POLYGON((4 0,8 0,8 4,4 0))', 26910)
);

INSERT INTO polygontable (name, geom) VALUES ('p2',
  ST_GeomFromText('POLYGON((1 1, 2 1, 2 2, 1 2,1 1))', 26910)
);

4.QGIS中显示几何数据

    PostGIS 测试 - 多边形(POLYGON)_第1张图片 

你可能感兴趣的:(PostGIS,QGIS,GIST索引,POLYGON,ST_GeomFromText)