]> granicus.if.org Git - postgis/commitdiff
mordernize faq on creating spatial table.
authorRegina Obe <lr@pcorp.us>
Sat, 23 Feb 2013 05:08:19 +0000 (05:08 +0000)
committerRegina Obe <lr@pcorp.us>
Sat, 23 Feb 2013 05:08:19 +0000 (05:08 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11113 b70326c6-7e19-0410-871a-916f4a2858ee

doc/faq.xml

index 6cccf88636070a184e601b6d1c703df3ae723a0b..bab715537f9938e4ffd2dbc624e18fcb3b0df6d6 100644 (file)
@@ -142,7 +142,7 @@ SELECT MAX(ST_NPoints(geom)) FROM sometable;</programlisting>
       </answer>
     </qandaentry>
 
-    <qandaentry>
+    <qandaentry id="faq_how_to_define_geometry_table">
       <question>
         <para>How do I insert a GIS object into the database?</para>
       </question>
@@ -156,11 +156,11 @@ SELECT MAX(ST_NPoints(geom)) FROM sometable;</programlisting>
                For geometry: Connect to your database with
         <filename>psql</filename> and try the following SQL:</para>
 
-        <programlisting>CREATE TABLE gtest ( ID int4, NAME varchar(20) );
-SELECT AddGeometryColumn('', 'gtest','geom',-1,'LINESTRING',2);</programlisting>
+        <programlisting>CREATE TABLE gtest ( gid serial primary key, name varchar(20)
+        , geom geometry(LINESTRING) );</programlisting>
 
-        <para>If the geometry column addition fails, you probably have not
-        loaded the PostGIS functions and objects into this database. See the
+        <para>If the geometry column definition fails, you probably have not
+        loaded the PostGIS functions and objects into this database or are using a pre-2.0 version of PostGIS. See the
         <xref linkend="PGInstall" />.</para>
 
         <para>Then, you can insert a geometry into the table using a SQL
@@ -171,7 +171,7 @@ SELECT AddGeometryColumn('', 'gtest','geom',-1,'LINESTRING',2);</programlisting>
 VALUES (
   1, 
   'First Geometry', 
-  ST_GeomFromText('LINESTRING(2 3,4 5,6 5,7 8)', -1)
+  ST_GeomFromText('LINESTRING(2 3,4 5,6 5,7 8)')
 );</programlisting>
 
         <para>For more information about other GIS objects, see the <link