Aurelien,<br><br>What you want to do is fairly simple to accomplish if
you have a postgres/postGIS database. One method would be to have a
select box with each polygon so that you had a reference on which
polygon you are splitting based on the select box, then do a draw tool
with an event to submit a request to a server with the WKT of the
polygon you wish to split and the line to split it with. The sevrerside
script would run the following exampel query:<br>
<br>SELECT astext(geom) FROM dump ((<br>&nbsp;&nbsp;&nbsp; SELECT polygonize(geomunion(boundary(<div id=":18l" class="ArwC7c ckChnd">poly), line)) AS mpoly FROM<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (SELECT &#39;$segment&#39;::geometry AS poly) AS a,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (SELECT &#39;$splitWKT&#39;::geometry AS line) AS b<br>

))<br><br>Several
polugons should be returned by the query. With the new polygons
generated you can nuke the old polygon and then add the new polygons
into the vector layer while being sure to refresh your select box (or
however you choose manage it).<br>
<br>// Destroy the old vector<br>for (var i=0;i&lt;vectors.features.length;i++) {<br>&nbsp;&nbsp;&nbsp; if (vectors.features[i].id == oldPolyID) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vectors.features[i].destroy();<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>//Add new<br>var features = wkt.read(wktPolygon);<br>

vectors.addFeatures(features);</div><br><br>PS Ivan, sorry that previous email went to you and you alone, forgot to do a reply all.<br clear="all">--<br>Nathan Gerber<br>
<br><br><div class="gmail_quote">On Fri, Feb 13, 2009 at 11:14 AM, Aurélien Pelletier <span dir="ltr">&lt;<a href="mailto:aurelien.pelletier@atosorigin.com">aurelien.pelletier@atosorigin.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I&#39;d like to have an idea of how hard it would be to implement the &quot;split<br>
polygon&quot; feature in openLayer as it is done in geomajas:<br>
<a href="http://www.geomajas.org/majas-tutorial/applications/tutorial/html/sample-editing.html" target="_blank">http://www.geomajas.org/majas-tutorial/applications/tutorial/html/sample-editing.html</a><br>
<br>
The polygon and the line are send to the server, the polygon is splitted<br>
using the JTS library on the server side and send back to the client.<br>
<br>
Thanks<br>
<br>
Aurélien<br>
<br>
<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
</blockquote></div><br>