Skip site navigation (1) Skip section navigation (2)

Re: Problem of creating geometry column (linestring)

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Newperson <useintowngas(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem of creating geometry column (linestring)
Date: 2009-09-18 06:37:23
Message-ID: 5a8aa6680909172337g739857eal974bfeb84681b307@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
2009/9/18 Newperson <useintowngas(at)gmail(dot)com>:
>
> Dear all,
>     I have a problem on creating geometry column about linestring.
>     In my table (name is pipe), it has 4 coordinates (x1 y1 x2 y2 x3 y3 x4
> y4). I want to use them to form lines in geometry column (name is
> pipe_geom).
>     In sql I type:
> SELECT AddGeometryColumn( 'public', 'pipe', 'pipe_geom', 4269, 'LINESTRING',
> 2 );
> UPDATE pipe
> SET pipe_geom = GeomertyFromText('LINESTRING(' ||x1 ,y1 || ', '|| x2 ,
> y2||',' || x3 , y3||',' || x4 ,y4|| ')', 4269)
>
> But error occurs:
> ERROR:  function geomertyfromtext(text, text, text, text, text, integer)
> does not exist
> LINE 3: SET pipe_geom = GeomertyFromText('LINESTRING(' ||sdo_x1 ,sdo...

You have a typo in the name of the function.

>     I also try:
> SELECT AddGeometryColumn( 'public', 'pipe', 'pipe_geom', 4269, 'LINESTRING',
> 2 );
> UPDATE pipe
> SET pipe_geom = LineFromText('LINESTRING(x1 y1,  x2 y2, x3 y3,x4 ,y4 )',
> 4269)
> which error also appears:
> ERROR:  parse error - invalid geometry
> HINT:  "LINESTRING(" <-- parse error at position 11 within geometry
>
>     I just find example of creating POINT geometry field but have no idea
> about how to generate geometry column of linestrings. I hope someone could
> help me.

I have never done this, but maybe if you fix the typo above it will work?

-- 
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Responses

pgsql-novice by date

Next:From: Michael WoodDate: 2009-09-18 06:55:00
Subject: Re: shp2pgsql in java
Previous:From: Melanie HofmannDate: 2009-09-18 06:34:39
Subject: shp2pgsql in java

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group