Thanks , Arnd 
I tested with

var findRectangle = new 
OpenLayers.Control.DrawFeature(polygonLayer,OpenLayers.Handler.RegularPolygon,{
id: 'defaultControl01',
title: "Klikk eller dra ut firkant rundt objekt i kartet for å finne mer 
informasjon",
handlerOptions: {sides: 4, irregular: true},
displayClass: 'findRectangle'  ,       
displayClass: 'olControlDrawFeaturePolygon'
}
);


 function findRectangleFeaturAadded(feature) {               
  var theVertexes = polygonLayer.features[0].geometry;
  alert(theVertexes);
}

This function show the 4 vertex in this format POLYGON((-1487158.8221094 
-2661231.5764062,1878516.406875 -2504688.5425,3209132.1950781 
-6653078.9410156,-1174072.7542969 -6300857.1147266,-1487158.8221094 
-2661231.5764062))

My question is : How I can obtain each vertex for example vertice[0].lat , 
vertice[0].long, .........

And my second question is .

In this test only draw one poligon with 4 vertex , how I implement double click 
for a finish the draw  polygon 

thanks , 

Regards Salas

 


  ----- Original Message ----- 
  From: Arnd Wippermann 
  To: 'fsalas' 
  Cc: [email protected] 
  Sent: Thursday, October 08, 2009 4:32 PM
  Subject: AW: [OpenLayers-Users] How obtain the vertex in openlayer


  Hi,

  this is the way to get the vertexes of a polygon feature:
  var theVertexes = thePolygonFeature.geometry.components[0].components;

  for(var i=0;i<theVertexes.length;i++)
      ... theVertexes[i];


  or use vectorLayer.features[0].geometry, that returns the wkt string for the 
polygon feature

  POLYGON((-1487158.8221094 -2661231.5764062,1878516.406875 
-2504688.5425,3209132.1950781 -6653078.9410156,-1174072.7542969 
-6300857.1147266,-1487158.8221094 -2661231.5764062))

  Arnd


------------------------------------------------------------------------------
  Von: [email protected] [mailto:[email protected]] Im 
Auftrag von fsalas
  Gesendet: Donnerstag, 8. Oktober 2009 23:07
  An: [email protected]
  Betreff: [OpenLayers-Users] How obtain the vertex in openlayer


         Hi, 

  I need obtain the list of the vertex of my polygon becouse after that I need 
to pass this value to POLYGON parameters and obtain all the objects inside the 
polygon.

  I use this
  .
  .
  .
  .
  var drawpolygon = new OpenLayers.Control.DrawFeature(
                  polygonLayer, OpenLayers.Handler.Polygon,
                  {displayClass: 'olControlDrawFeaturePolygon'}
              );

    panel.addControls([new OpenLayers.Control.Navigation(), drawpolygon]);
  ..
  .
  .
  .

  ************************************************************* This is the Sql 
for postgis **************************
  SELECT  cod,tipo,empresa,the_geom
  FROM sennal 
  WHERE sennal.the_geom && GeomFromText('POLYGON((-85.47677 23.56344,-82.31771 
23.51950,-82.33468 21.03659,-85.47677 23.56344))',4267) and tipo = 'FV';
  *********************************************************
  How implement this ?


  Regards , salas






  var drawpolygon = new OpenLayers.Control.DrawFeature(
                  polygonLayer, OpenLayers.Handler.Polygon,
                  {displayClass: 'olControlDrawFeaturePolygon'}
              );
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to