<div dir="ltr">Hi,<div><br></div><div>Your multipolygon is invalid: PG parts cannot share an edge in a MultiPolygon.</div><div>Postgis unions the two parts during the st_difference process.</div><div><br></div><div>Geometric operation should be called only on valid objects.</div><div><br></div><div>Nicolas</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 4 September 2014 21:20, Max Demars <span dir="ltr"><<a href="mailto:burton449geo@gmail.com" target="_blank">burton449geo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi!<br><br></div>I am using the ST_Difference to erase multipolygon feature by a mask. However, the query returns a dssolved multipolygon.<br><br></div>The query is the following:<br><br>
'''SELECT ST_AsGeoJSON(ST_Collect(geom))<div dir="ltr">::json <br>
   FROM (SELECT (<br>     ST_Dump ( <br>         ST_Difference(ST_GeomFromGeoJSON('%s'),ST_GeomFromGeoJSON('%s')))).geom) <br>             As f''' % (feature,mask)<br clear="all"><div><div><div>

<br></div><div>Please take a look at those images above to understand the problem:</div></div></div></div><br clear="all"></div>Input: <a href="http://i.stack.imgur.com/QO4MN.png" target="_blank">http://i.stack.imgur.com/QO4MN.png</a><br>
</div>Output: <a href="http://i.stack.imgur.com/Slw32.png" target="_blank">http://i.stack.imgur.com/Slw32.png</a><br><div><div><br></div><div>Thank you all,<br></div><div>-Max Demars<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>-- <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></font></span></div></div>
<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></div>