Thank you very much, this is what I was looking for. -Cheers
-Max Demars On Wed, Sep 3, 2014 at 3:55 AM, Sandro Santilli <[email protected]> wrote: > On Tue, Sep 02, 2014 at 01:19:55PM -0400, Max Demars wrote: > > Hi list, > > > > I am using postgis to split a multipolygon feature by a linestring. Both > > feature are geojson inputs. > > > > However the outputs returns a geojson that is a geocollection of two > > polygon features. In fact this is correct, but for consistency I would > like > > to keep the the splitted features into a single Multipolygon (even if > there > > is only one linear ring in it). Is it possible? > > Possible, but such a multipolygon would be invalid. > > > This is my query: > > > > SQLQuery = '''SELECT > > > ST_AsGeoJSON(ST_Split(ST_GeomFromGeoJSON('%s'),ST_GeomFromGeoJSON('%s')))::json > > As f''' % (feature,blade) > > Make it: > > SELECT > ST_AsGeoJSON( > ST_Collect(geom) FROM ( > SELECT ( > ST_Dump( > ST_Split(ST_GeomFromGeoJSON('%s'), ST_GeomFromGeoJSON('%s')) > ) > ).geom > ) foo > )::json As f > > ST_Collect will create a MULTIPOLYGON if all inputs are of the POLYGON > type. > > --strk; > > () ASCII ribbon campaign -- Keep it simple ! > /\ http://strk.keybit.net/rants/ascii_mails.txt > _______________________________________________ > postgis-users mailing list > [email protected] > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users > -- Stack Overflow: http://stackoverflow.com/users/1914034/burton449 GIS Overflow: http://gis.stackexchange.com/users/14426/burton449 LastFm: http://www.lastfm.fr/user/burton449
_______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
