读书人

关于postgis视图中geometry项平添

发布时间: 2012-08-22 09:50:35 作者: rapoo

关于postgis视图中geometry项添加

?在视图中,不能使用AddGeometryColumn建立geometry字段,postgis参考中明确指出了:在sql视图和批量插入中这两种情况下,你需要把一个geometry字段注册给一个含geometry字段的表,但是此时不能通过AddGeometryColumn实现(关于postgis视图中geometry项平添翻译有点烂)。原文如下:

--Lets say you created a derivative table by doing a bulk insertSELECT poi.gid, poi.the_geom, citybounds.city_nameINTO myschema.myspecialpoisFROM poi INNER JOIN citybounds ON ST_Intersects(citybounds.the_geom, poi.the_geom);--Create index on new tableCREATE INDEX idx_myschema_myspecialpois_geom_gist ON myschema.myspecialpois USING gist(the_geom);--To manually register this new table's geometry column in geometry_columns-- we do the same thing as with viewINSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type")SELECT '', 'myschema', 'myspecialpois', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom)FROM public.myschema.myspecialpois LIMIT 1;

?附原文地址:http://www.postgis.org/documentation/manual-1.5/ch04.html#Manual_Register_Spatial_Column

?

读书人网 >操作系统

热点推荐