[OpenLayers-Dev] Editable polygon

Andy Deakin andy.deakin at pcmend.net
Mon Feb 9 06:56:11 EST 2009


This is great! Thanks.

Is there a preferred way to find the coordinates of an edited polygon 
(e.g. to send back to a server via ajax).
At the moment I have found two ways:

1) Parsing the polygon.geometry.toString() by stripping off the 
POLYGON(( and )), then splitting by comma, then splitting by space 
(seems a bit messy)
2) loop through polygon.geometry.components[0].components[i]

In the documentation 
http://dev.openlayers.org/docs/files/OpenLayers/Geometry-js.html there 
also appears to be a getVertices() function, but it doesn't seem to 
exist. Has this been removed?

Also, it there the feature to transform the coords into decimal degrees 
format on the client side?

Thanks again

Christopher Schmidt wrote:
> On Wed, Feb 04, 2009 at 03:24:17PM -0500, Christopher Schmidt wrote:
>   
>> On Wed, Feb 04, 2009 at 07:19:23PM +0000, Andy Deakin wrote:
>>     
>>> Hi All,
>>>
>>> Is there a way to create an editable polygon (e.g. a geofence) on a map?
>>>
>>> I would like to be able to drag nodes, as well as adding nodes if the 
>>> boundary was dragged where there is no node. The ability to remove nodes 
>>> would be useful too!
>>>       
>> http://openlayers.org/dev/examples/modify-feature.html
>>     
>
> And http://docs.openlayers.org/library/controls#modifyfeature
>
> Regards,
>   



More information about the Dev mailing list