[OpenLayers-Dev] How to get every pont of a polygon

Vidal, Antoni antoni.vidal at icc.cat
Tue Nov 11 10:27:24 EST 2008



I would like to transform coordinates of every point of a polygon feature drawned by the user using the polygon measure tool. In a function a get the geometry:


for (var lyr=0; lyr < map.layers.length; ++lyr){

                  var layer = map.layers[lyr];


                        alert('toString '+layer.features[0].geometry.toString());




The alert shows a message like this: POLYGON((295568,4706540,469875,4690960,443475,4589500,307175,4592100,295568,4706540)) for a polygon drawned by the client user width 4 corners.


How can I get every pair of coordinates to send to getViewPortPxFromLonLat? so that I need pixels coordinates of every point.


Thanks in advance


Antoni Vidal

Institut Cartogràfic de Catalunya    Tel: +34-93 567 1500 Ext. 3228

Parc de Montjuïc                             Fax: +34-93 567 1567

08038 Barcelona                            http://www.icc.cat <http://www.icc.cat/> 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20081111/6e0ac760/attachment.html

More information about the Dev mailing list