[OpenLayers-Dev] Editable polygon
Andy Deakin
andy.deakin at pcmend.net
Mon Feb 9 07:19:11 EST 2009
Thanks for the quick response, it works like a charm!
Nice to know that the documentation is uptodate.
Christopher Schmidt wrote:
> On Mon, Feb 09, 2009 at 11:56:11AM +0000, Andy Deakin wrote:
>
>> 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]
>>
>
> Do this.
>
>
>> 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?
>>
>
> No, but it was only added 48 hours ago.
>
>
>> Also, it there the feature to transform the coords into decimal degrees
>> format on the client side?
>>
>
> var geom = geometry.clone().transform(new OL.Projection("EPSG:900913"),
> new OL.Projection("EPSG:4326"));
>
> Regards,
>
More information about the Dev
mailing list