[postgis-users] Split polygon by line

Birgit Laggner birgit.laggner at thuenen.de
Thu Oct 18 07:47:37 PDT 2018


Hi, 

I believe QGIS can not deal with GeometryCollections which are the resulting geometrytype of ST_Split. 

Your idea is not bad, but why do you save the result as wkt? 

I would try: 
SELECT (ST_Dump(ST_Split(circle, line))).geom::geometry (polygon,0) As geom 
INTO layerq 
FROM (SELECT 
ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)) As line, 
ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo; 

If you cast the geometry type like that (::geometry (polygon,0)), PostGIS should be able to populate the geometry_columns table automaticly. 

Regards, 
Birgit 


Von: "Shane Carey" <careyshan at gmail.com> 
An: "arnaud listes" <arnaud.listes at codata.eu> 
CC: postgis-users at lists.osgeo.org 
Gesendet: Donnerstag, 18. Oktober 2018 18:55:44 
Betreff: Re: [postgis-users] Split polygon by line 

Ok thanks, will do in future: 

This is what I have tried and no joy- any ideas? Thanks in advance. 

SELECT ST_AsText((ST_Dump(ST_Split(circle, line))).geom) As wkt 
INTO layerq 
FROM (SELECT 
ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)) As line, 
ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo; 
select populate_geometry_columns(); 

Le gach dea ghui, 
Shane Carey 
GIS and Data Solutions Consultant 


On Thu, Oct 18, 2018 at 3:38 PM Arnaud L. < [ mailto:arnaud.listes at codata.eu | arnaud.listes at codata.eu ] > wrote: 


Le 18/10/2018 à 18:43, Shane Carey a écrit : 
> Yep, I run the following: 
> 
> SELECT ST_Split(circle, line) 
> INTO qlayer 
> FROM (SELECT 
> ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)) As line, 
> ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo; 
> 
> But this layer does not show up as a gis layer in qgis? 

Probably because the geometry_columns table is not populated. 
Try to either create the destination table first and then to insert in 
it, or maybe just run : 
SELECT Populate_Geometry_Columns(); 

> Thanks in advance for your help. Sorry, what do you mean by top post? 

[ https://en.wikipedia.org/wiki/Posting_style | https://en.wikipedia.org/wiki/Posting_style ] 
Bottom or interleaved posting are the preferred style. 

-- 
Arnaud 




_______________________________________________ 
postgis-users mailing list 
postgis-users at lists.osgeo.org 
https://lists.osgeo.org/mailman/listinfo/postgis-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20181018/d8c5ad17/attachment.html>


More information about the postgis-users mailing list