Обсуждение: Problem of creating geometry column (linestring)
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...
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.
Regards,
Newperson
--
View this message in context:
http://www.nabble.com/Problem-of-creating-geometry-column-%28linestring%29-tp25502605p25502605.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.
2009/9/18 Newperson <useintowngas@gmail.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@gmail.com>
Michael Wood-8 wrote: > > 2009/9/18 Newperson <useintowngas@gmail.com>: > > You have a typo in the name of the function. > I have never done this, but maybe if you fix the typo above it will work? > > -- > Michael Wood <esiotrot@gmail.com> > > -- > Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-novice > > Dear all, I have fixed the above error. the sql which works is: SELECT AddGeometryColumn( 'public', 'pipe', 'pipe_geom', 4269, 'POINT', 2 ); I think this part has no typo. UPDATE pipe SET pipe_geom = GeometryFromText('LINESTRING('||x1||' '||y1||','||x2||' '||y2||', '||x3||' '||y3||','||x4||' '||y4||')' , 4269); This part cannot work if there is no space between ' '. -- View this message in context: http://www.nabble.com/Problem-of-creating-geometry-column-%28linestring%29-tp25502605p25530549.html Sent from the PostgreSQL - novice mailing list archive at Nabble.com.