[postgis-users] Generating Point geometry
Robyn Rennie
rrennie at hemmera.com
Tue Aug 9 15:38:49 PDT 2005
> > SELECT
> AddGeometryColumn('table_xy_45700522','xypoint',-1,'POINT',1);
> > ALTER TABLE table_xy_45700522 DROP CONSTRAINT
> enforce_dims_xypoint; - needed because it seemed to fail otherwise?
>
> Last argument is geometry dimension. 1 should not be allowed
> (what version are you using?). If you use 2 there you won't
> need to drop the CONSTRAINT.
I am using PostGIS 1.0.0.
Nothing in the documentation specifies what that values for the last argument must be - I saw lots of examples with LINESTRINGS and a value of 2 but the command reference does not elaborate on any of the arguments. So I picked 1 for a 1 dimensional point.
>
> > and now have a table which looks like samplename (varchar),
> x(float8), y(float8), xypoint(geometry). There are 800+
> records in the table all with values in the samplename, x and
> y columns. How can I use MakePoint or some other function to
> get the geometry for each of these points? (this is a test
> table - the real table has considerably more points)
> > Looking through the archives I only see references to
> loading the data from an external file.
> > Thanks for any assistance.
>
> This is an SQL question, you must UPDATE you TABLE setting the
> value for the xypoint:
>
> UPDATE TABLE <tablename> SET xypoint = MakePoint(x, y);
I don't know why I couldn't get this to work earlier - probably simple syntax errors with quotes and commas and the wrong combinations of them. Hmmmm.
Thanks,
/Robyn
More information about the postgis-users
mailing list