[postgis-users] Cut lines with polygon
Brian Modra
brian at zwartberg.com
Tue Oct 6 01:50:37 PDT 2009
2009/10/6 Alexander Strunck <A.Strunck at gmx.net>:
> Hello postigs uder discussion
>
> i still got the problem with st_intersection. i try this sql
>
> create table osm_polygon_in_grossring25_50 as
> SELECT b.way_id, b.geom,
> st_Intersection ( g.geom, b.geom )
> FROM stadtgrossbuffer25_50 AS g, osm_valid_polygon AS b
> WHERE IsEmpty ( st_Intersection ( g.geom, b.geom ) ) = FALSE;
You were inserting two geometries into that table, the original
b.geom, and the intersection geometry.
Also, your test was CPU intensive, rathether use st_intersects as the test.
Try this:
create table osm_polygon_in_grossring25_50 as
SELECT b.way_id,
st_Intersection ( g.geom, b.geom ) as geom
FROM stadtgrossbuffer25_50 AS g, osm_valid_polygon AS b
WHERE st_Intersects ( g.geom, b.geom ) ;
> but the lines or polygons won´t get cut out. all lines and polygones that are in contact with the buffer get selected and not cut at the border of the buffer. i checked the output with sql und via desktop gis. in the attatchment are two jpg with the output?
>
> has anyone a idea?
>
> alex
>
>
>
> -------- Original-Nachricht --------
>> Datum: Mon, 5 Oct 2009 15:37:43 +0200
>> Von: Brian Modra <brian at zwartberg.com>
>> An: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>> Betreff: Re: [postgis-users] Cut lines with polygon
>
>> 2009/10/5 Alexander Strunck <A.Strunck at gmx.net>:
>> > Hello
>> >
>> > i checked if its a rendering problem. but that´s not it. for example i
>> have a polygon with a hole in it and one line yust go through this hole...
>>
>> take a look at this:
>> http://postgis.refractions.net/documentation/manual-svn/ch04.html#OGC_Validity
>>
>> > how can i find the poylgon that throughs this error? i have no idea...
>>
>> I assume they all have UIDs?
>> Do it iteratively:
>> start with one half of the table (limited by UID range)
>> If that throws the error, then try one half of that half, etc... unil
>> you are down to one polygon.
>>
>> >
>> >
>> > alex
>> >
>> >
>> >
>> > -------- Original-Nachricht --------
>> >> Datum: Mon, 5 Oct 2009 14:57:44 +0200
>> >> Von: Brian Modra <brian at zwartberg.com>
>> >> An: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>> >> Betreff: Re: [postgis-users] Cut lines with polygon
>> >
>> >> 2009/10/5 Alexander Strunck <A.Strunck at gmx.net>:
>> >> > Hello
>> >> >
>> >> > i am really new to postgis and i try to cut lines with a polygon. the
>> >> sql statement is
>> >> >
>> >> > create table osm_line_in_dorfring2_5_10 as
>> >> > SELECT b.way_id, b.geom,
>> >> > Intersection ( g.geom, b.geom )
>> >> > FROM stadtdorfbuffer2_5_10 AS g, osm_line AS b
>> >> > WHERE IsEmpty ( Intersection ( g.geom, b.geom ) ) = FALSE;
>> >> >
>> >> > but when i look at the result the lines are not cut by the polygon.
>> the
>> >> lines go a little bit over the borders of the polygon. Why is that?
>> >>
>> >> Have you checked the coords and done the maths (manually) to see if
>> >> the intersection points are wrong? Maybe its just a rendering problem
>> >> in whatever you are using to view them?
>> >>
>> >> > the second problem ist when i want to do the same thing with two
>> >> different polygon tables. i get the error
>> >> > NOTICE: TopologyException: found non-noded intersection between
>> >> 8.18405 48.9483, 8.18366 48.9481 and 8.18285 48.947, 8.18933 48.9551
>> 8.18381
>> >> 48.9482
>> >> > ERROR: GEOS Intersection() threw an error!
>> >> >
>> >> > ********** Fehler **********
>> >> >
>> >> > ERROR: GEOS Intersection() threw an error!
>> >> > SQL Status:XX000
>> >>
>> >> See if you can find the polygon that its throwing this for, and view
>> >> it to see if there is something obvious about the topology.
>> >>
>> >> >
>> >> > i tested the polygon tables with ST_IsValid and everything seems to
>> be
>> >> all right.
>> >> >
>> >> > does someone have any suggestions?
>> >> >
>> >> > thx in advance
>> >> >
>> >> > alex
>> >> > --
>> >> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>> >> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>> >> > _______________________________________________
>> >> > postgis-users mailing list
>> >> > postgis-users at postgis.refractions.net
>> >> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Brian Modra Land line: +27 23 5411 462
>> >> Mobile: +27 79 69 77 082
>> >> 5 Jan Louw Str, Prince Albert, 6930
>> >> Postal: P.O. Box 2, Prince Albert 6930
>> >> South Africa
>> >> http://www.zwartberg.com/
>> >> _______________________________________________
>> >> postgis-users mailing list
>> >> postgis-users at postgis.refractions.net
>> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >
>> > --
>> > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox
>> 3.5 -
>> > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>> > _______________________________________________
>> > postgis-users mailing list
>> > postgis-users at postgis.refractions.net
>> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >
>>
>>
>>
>> --
>> Brian Modra Land line: +27 23 5411 462
>> Mobile: +27 79 69 77 082
>> 5 Jan Louw Str, Prince Albert, 6930
>> Postal: P.O. Box 2, Prince Albert 6930
>> South Africa
>> http://www.zwartberg.com/
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
--
Brian Modra Land line: +27 23 5411 462
Mobile: +27 79 69 77 082
5 Jan Louw Str, Prince Albert, 6930
Postal: P.O. Box 2, Prince Albert 6930
South Africa
http://www.zwartberg.com/
More information about the postgis-users
mailing list