--添加空间字段 SELECT AddGeometryColumn ('GIS', '四至', 4326, 'POLYGON', 2); --根据其他字段更新空间字段数据 update "GIS" b set "四至"=ST_GeomFromText ('POLYGON((' || to_char(a."东经起",'999.9999') || to_char(a."北纬起",'999.9999') || ',' || to_char(a."东经止",'999.9999') || to_char(a."北纬起",'999.9999') || ',' || to_char(a."东经止",'999.9999') || to_char(a."北纬止",'999.9999') ||',' || to_char(a."东经起",'999.9999') || to_char(a."北纬止",'999.9999') || ',' || to_char(a."东经起",'999.9999') || to_char(a."北纬起",'999.9999') || '))',4326) from "GIS" a where b."ID"=a."ID" --创建索引 CREATE INDEX shape_index_sz1 ON "GIS" USING gist (四至); --查询与指定范围相交的多边形 SELECT * FROM "GIS" where ST_Intersects( ST_GeomFromText('POLYGON((86 44.1667,87.3333 44.1667,87.3333 45.1667,86 45.1667,86 44.1667))'), ST_GeomFromText(ST_AsText("四至")))