From: Regina Obe Date: Sat, 23 Feb 2013 05:08:19 +0000 (+0000) Subject: mordernize faq on creating spatial table. X-Git-Tag: 2.1.0beta2~194 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9be45d3d749d95b9cd4ceb8355218c641e6512c5;p=postgis mordernize faq on creating spatial table. git-svn-id: http://svn.osgeo.org/postgis/trunk@11113 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/faq.xml b/doc/faq.xml index 6cccf8863..bab715537 100644 --- a/doc/faq.xml +++ b/doc/faq.xml @@ -142,7 +142,7 @@ SELECT MAX(ST_NPoints(geom)) FROM sometable; - + How do I insert a GIS object into the database? @@ -156,11 +156,11 @@ SELECT MAX(ST_NPoints(geom)) FROM sometable; For geometry: Connect to your database with psql and try the following SQL: - CREATE TABLE gtest ( ID int4, NAME varchar(20) ); -SELECT AddGeometryColumn('', 'gtest','geom',-1,'LINESTRING',2); + CREATE TABLE gtest ( gid serial primary key, name varchar(20) + , geom geometry(LINESTRING) ); - If the geometry column addition fails, you probably have not - loaded the PostGIS functions and objects into this database. See the + 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 . Then, you can insert a geometry into the table using a SQL @@ -171,7 +171,7 @@ SELECT AddGeometryColumn('', 'gtest','geom',-1,'LINESTRING',2); 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)') ); For more information about other GIS objects, see the