[postgis-users] St_boundary and illegal argument exception

Paragon Corporation lr at pcorp.us
Sat Jun 27 10:16:17 PDT 2009


George,
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.
 
SELECT gid, ST_MakeLine(ST_PointN(the_geom, n),ST_PointN(the_geom,n+1))  As
geomwkt

FROM (VALUES (1 , ST_GeomFromText('LINESTRING(1 2, 3 4, 5 8, 6 10)') ) ,

 (2 , ST_GeomFromText('LINESTRING(1 2, -1 -2)') )) 

As foo(gid,the_geom)

    CROSS JOIN generate_series(1, 1000) As n

WHERE n < ST_Npoints(foo.the_geom);

 

Leo
 


  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of George
Silva
Sent: Friday, June 26, 2009 10:42 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] St_boundary and illegal argument exception


I ran a st_isvalid on all features of my table. I had 4 invalid features.
deleted em, everything worked.

But how about transforming that linestring, into lines?

Example, i have a square, and i need to have all four lines that compose it
into separate records.

Is that possible?

George


On Fri, Jun 26, 2009 at 11:41 PM, Kevin Neufeld <kneufeld at refractions.net>
wrote:


I'm not sure exactly what you are trying to do, but yes, ST_Boundary does
extract linework (aka. the boundary) from a polygon.

SELECT ST_AsText(ST_Boundary('POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry));
        st_astext         -----------------------------
LINESTRING(0 0,1 1,1 0,0 0)
(1 row)

Can you isolate the geometry that is causing you grief?
-- Kevin


George Silva wrote:


Hello everyone.

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.

I've tried: SELECT gid, St_boundary(the_geom) INTO lines from lots and
postgis gave me an error:

*NOTICE:  IllegalArgumentException: Number of points must be 0 or >3
ERROR:  POSTGIS2GEOS conversion failed

********** Erro **********

ERROR: POSTGIS2GEOS conversion failed
SQL state: XX000*

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?

Thanks in advanced.

George


-- 
George R. C. Silva
Sigma Consultoria

Desenvolvimento em GIS

www.consultoriasigma.com.br <http://www.consultoriasigma.com.br>
www.sigmaconsultoria.blogspot.com <http://www.sigmaconsultoria.blogspot.com>
------------------------------------------------------------------------

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
 


_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





-- 
George R. C. Silva
Sigma Consultoria

Desenvolvimento em GIS
www.consultoriasigma.com.br
www.sigmaconsultoria.blogspot.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090627/f26798ce/attachment.html>


More information about the postgis-users mailing list