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