<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18783"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=163550817-27062009><FONT color=#0000ff
size=2 face=Arial>George,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=163550817-27062009><FONT color=#0000ff
size=2 face=Arial>Use generate series in combination with ST_PointN. So
just change the FROM of this with your table and also increase the 1000 to the
maximum number of points you have in any line in your polygon. This will
only work with LINESTRING. If you need to work with MULTILINESTRING you'll
need to include ST_Dump in there.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=163550817-27062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=163550817-27062009>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2 face="Courier New">SELECT
gid, ST_MakeLine(ST_PointN(the_geom, n),ST_PointN(the_geom,n+1)) As
geomwkt</FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2 face="Courier New">FROM
(VALUES (1 , ST_GeomFromText('LINESTRING(1 2, 3 4, 5 8, 6 10)') ) ,</FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2><FONT
face="Courier New"><SPAN> </SPAN>(2 , ST_GeomFromText('LINESTRING(1 2, -1
-2)') )) </FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2 face="Courier New">As
foo(gid,the_geom)</FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2><FONT
face="Courier New"><SPAN> </SPAN>CROSS JOIN generate_series(1,
1000) As n</FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT size=2 face="Courier New">WHERE n
< ST_Npoints(foo.the_geom);</FONT></P>
<P style="MARGIN: 0in 0in 0pt 13.5pt"><FONT color=#0000ff size=2
face=Arial></FONT> </P></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=163550817-27062009><FONT color=#0000ff
size=2 face=Arial>Leo</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=163550817-27062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><FONT size=2
face="Courier New"></FONT><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>George Silva<BR><B>Sent:</B> Friday, June 26, 2009 10:42 PM<BR><B>To:</B>
PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] St_boundary and
illegal argument exception<BR></FONT><BR></DIV>
<DIV></DIV>I ran a st_isvalid on all features of my table. I had 4 invalid
features. deleted em, everything worked.<BR><BR>But how about transforming that
linestring, into lines?<BR><BR>Example, i have a square, and i need to have all
four lines that compose it into separate records.<BR><BR>Is that
possible?<BR><BR>George<BR><BR>
<DIV class=gmail_quote>On Fri, Jun 26, 2009 at 11:41 PM, Kevin Neufeld <SPAN
dir=ltr><<A
href="mailto:kneufeld@refractions.net">kneufeld@refractions.net</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>I'm not sure exactly what you are trying to do, but yes,
ST_Boundary does extract linework (aka. the boundary) from a
polygon.<BR><BR>SELECT ST_AsText(ST_Boundary('POLYGON((0 0, 1 1, 1 0, 0
0))'::geometry));<BR> st_astext
-----------------------------<BR>LINESTRING(0 0,1 1,1 0,0
0)<BR>(1 row)<BR><BR>Can you isolate the geometry that is causing you
grief?<BR>-- Kevin<BR><BR><BR>George Silva wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV>
<DIV></DIV>
<DIV class=h5>Hello everyone.<BR><BR>I'm trying to build a function that
will transforma one polygon into many lines. I have a lot table, and i would
like to insert each line from each lot in a table, containing the id of the
lot.<BR><BR>I've tried: SELECT gid, St_boundary(the_geom) INTO lines from
lots and postgis gave me an error:<BR><BR>*NOTICE:
IllegalArgumentException: Number of points must be 0 or
>3<BR>ERROR: POSTGIS2GEOS conversion failed<BR><BR>********** Erro
**********<BR><BR>ERROR: POSTGIS2GEOS conversion failed<BR>SQL state:
XX000*<BR><BR>I'm wondering if that is the right approach? I'm not even sure
if boundary is what i am looking for. Can anyone help me? Why postgis gave
me this error?<BR><BR>Thanks in advanced.<BR><BR>George<BR><BR><BR>--
<BR>George R. C. Silva<BR>Sigma Consultoria<BR><BR>Desenvolvimento em
GIS<BR></DIV></DIV><A href="http://www.consultoriasigma.com.br"
target=_blank>www.consultoriasigma.com.br</A> <<A
href="http://www.consultoriasigma.com.br"
target=_blank>http://www.consultoriasigma.com.br</A>><BR><A
href="http://www.sigmaconsultoria.blogspot.com"
target=_blank>www.sigmaconsultoria.blogspot.com</A> <<A
href="http://www.sigmaconsultoria.blogspot.com"
target=_blank>http://www.sigmaconsultoria.blogspot.com</A>><BR>------------------------------------------------------------------------<BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR> <BR></BLOCKQUOTE>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>George R. C. Silva<BR>Sigma
Consultoria<BR><BR>Desenvolvimento em GIS<BR><A
href="http://www.consultoriasigma.com.br">www.consultoriasigma.com.br</A><BR><A
href="http://www.sigmaconsultoria.blogspot.com">www.sigmaconsultoria.blogspot.com</A><BR></BODY></HTML>