[postgis-commits] svn - r3314 - trunk/doc
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Nov 21 06:28:42 PST 2008
Author: robe
Date: 2008-11-21 06:28:42 -0800 (Fri, 21 Nov 2008)
New Revision: 3314
Modified:
trunk/doc/reference_new.xml
trunk/doc/using_postgis.xml
Log:
GBT #71: Update section 4.2 of docs to describe manual adding to geometry columns - revision. Add pretty anchor, reference pretty anchor in AddGeometryColumn reference section. Rearrange order.
Modified: trunk/doc/reference_new.xml
===================================================================
--- trunk/doc/reference_new.xml 2008-11-21 14:15:35 UTC (rev 3313)
+++ trunk/doc/reference_new.xml 2008-11-21 14:28:42 UTC (rev 3314)
@@ -107,6 +107,12 @@
table. The <varname>type</varname> must be an uppercase string
corresponding to the geometry type, eg, 'POLYGON' or
'MULTILINESTRING'.</para>
+
+ <note>
+ <para>Views and derivatively created tables will need to be registered in geometry_columns manually.
+ since AddGeometryColumn also adds a spatial column. Refer to <xref linkend="Manual_Register_Spatial_Column"/>.
+ </para>
+ </note>
<para>
<inlinegraphic fileref="images/check.png" />
@@ -171,7 +177,7 @@
<refsection>
<title>See Also</title>
- <para><xref linkend="DropGeometryColumn"/>, <xref linkend="DropGeometryTable"/></para>
+ <para><xref linkend="DropGeometryColumn"/>, <xref linkend="DropGeometryTable"/>, <xref linkend="Manual_Register_Spatial_Column"/></para>
</refsection>
</refentry>
Modified: trunk/doc/using_postgis.xml
===================================================================
--- trunk/doc/using_postgis.xml 2008-11-21 14:15:35 UTC (rev 3313)
+++ trunk/doc/using_postgis.xml 2008-11-21 14:28:42 UTC (rev 3314)
@@ -468,7 +468,7 @@
</variablelist>
</sect2>
- <sect2 id="CreateSpatialTable">
+ <sect2 id="Create_Spatial_Table">
<title>Creating a Spatial Table</title>
<para>Creating a table with spatial data is done in two stages:</para>
@@ -528,7 +528,49 @@
);
SELECT AddGeometryColumn( 'roads', 'roads_geom', -1, 'GEOMETRY', 3 );</programlisting>
</sect2>
+
+ <sect2 id="Manual_Register_Spatial_Column">
+ <title>Manually Registering Geometry Columns in geometry_columns</title>
+ <para>The AddGeometryColumn() approach creates a geometry column and also registers the new
+ column in the geometry_columns table. If your software utilizes geometry_columns, then
+ any geometry columns you need to query by must be registered in this table. Two of the cases
+ where you want a geometry column to be registered in the geometry_columns table, but you can't use
+ AddGeometryColumn, is in the case of SQL Views and bulk inserts. For these cases, you must register the column in the
+ geometry_columns table manually. Below is a simple script to do that.</para>
+
+ <programlisting>
+ --Lets say you have a view created like this
+ CREATE VIEW public.vwmytablemercator AS
+ SELECT gid, ST_Transform(the_geom,3395) As the_geom, f_name
+ FROM public.mytable;
+
+ --To register this table in AddGeometry columns - do the following
+ INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type")
+ SELECT '', 'public', 'vwmytablemercator', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom)
+ FROM public.vwmytablemercator LIMIT 1;
+ </programlisting>
+
+ <programlisting>
+ --Lets say you created a derivative table by doing a bulk insert
+ SELECT poi.gid, poi.the_geom, citybounds.city_name
+ INTO myschema.myspecialpois
+ FROM poi INNER JOIN citybounds ON ST_Intersects(citybounds.the_geom, poi.the_geom);
+
+ --Create index on new table
+ CREATE 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 view
+ INSERT 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;
+
+ </programlisting>
+
+ </sect2>
+
<sect2>
<title>Ensuring OpenGIS compliancy of geometries</title>
@@ -570,47 +612,6 @@
there.</para>
</note>
</sect2>
- <sect2>
- <title>Manually Registering Geometry Columns in geometry_columns</title>
- <para>The AddGeometryColumn() approach creates a geometry column and also registers the new
- column in the geometry_columns table. If your software utilizes geometry_columns, then
- any geometry columns you need to query by must be registered in this table. Two of the cases
- where you want a geometry column to be registered in the geometry_columns table, but you can't use
- AddGeometryColumn, is in the case of SQL Views and bulk inserts. For these cases, you must register the column in the
- geometry_columns table manually. Below is a simple script to do that.</para>
-
- <programlisting>
- --Lets say you have a view created like this
- CREATE VIEW public.vwmytablemercator AS
- SELECT gid, ST_Transform(the_geom,3395) As the_geom, f_name
- FROM public.mytable;
-
- --To register this table in AddGeometry columns - do the following
- INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type")
- SELECT '', 'public', 'vwmytablemercator', 'the_geom', ST_CoordDim(the_geom), ST_SRID(the_geom), GeometryType(the_geom)
- FROM public.vwmytablemercator LIMIT 1;
-
- </programlisting>
-
- <programlisting>
- --Lets say you created a derivative table by doing a bulk insert
- SELECT poi.gid, poi.the_geom, citybounds.city_name
- INTO myschema.myspecialpois
- FROM poi INNER JOIN citybounds ON ST_Intersects(citybounds.the_geom, poi.the_geom);
-
- --Create index on new table
- CREATE 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 view
- INSERT 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;
-
- </programlisting>
-
- </sect2>
</sect1>
<sect1>
More information about the postgis-commits
mailing list