On Mon, Oct 18, 2010 at 6:50 AM, P Kishor <[email protected]> wrote:
> 1. Once I have drawn a poly on the map (using the measure control),
> how do I get its geometry that I can then send to the server? All I
> need to know here is the appropriate method that will give me the
> geometry of the poly I drew.
Rather than start with the measure tool example, use one of the OL
drawing examples. You will need a vector layer to draw on. Here's a
snippet of code that I use to loop thru features that the user has
drawn and format them for a SQL insert statement. rwg.drawnFeature is
an array of features that the user has drawn.
var drawnFeatureLength = rwg.drawnFeature.length;
var geom;
var mapshape = "";
for(var i=0; i<drawnFeatureLength; i++) {
geom = rwg.drawnFeature[i].geometry + '';
geom = geom.replace(/POLYGON/i, '|');
geom = geom.replace(/\(\(/g, '');
geom = geom.replace(/\)\)/g, '');
mapshape += geom;
}
Rich
--
Richard Greenwood
[email protected]
www.greenwoodmap.com
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users