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

Josh S. jstreufe at utk.edu
Sun May 24 10:13:22 EDT 2009


Could you do the following if you wanted to pull each feature(polygon in my
case) out of the vectors layer?

		for (var lyr=0; lyr < map.layers.length; ++lyr){
                  var layer = map.layers[lyr];
				  for (var ftr=0; ftr < feature.length; ++ftr) {
	           		var featr = layer.feature[ftr].geometry;
						alert(featr); }


-Josh S.

Christopher Schmidt-2 wrote:
> 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
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

View this message in context: http://n2.nabble.com/How-to-get-every-pont-of-a-polygon-tp1835847p2965306.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list