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

Christopher Schmidt crschmidt at metacarta.com
Tue Nov 11 10:35:16 EST 2008


On Tue, Nov 11, 2008 at 04:27:24PM +0100, Vidal, Antoni wrote:
> 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.

Polygons are a Collection of LinearRins (inner and outer) -- they are
subclassed from Geometry.Collection, which has a Components property:

  http://dev.openlayers.org/apidocs/files/OpenLayers/Geometry/Collection-js.html#OpenLayers.Geometry.Collection.components

So you can loop over that, and each LinearRing in that list will have a
list of components which is the points, I believe. 

(Though I'm somewhat curious if this is what you want to be doing or
why...) 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list