[OpenLayers-Users] Re: Zoom to selected features

gabriel gpetricek at gmail.com
Mon Dec 5 09:53:36 EST 2011


Hi, i working on function, which will zoom to selected feature/s from CQL.
Here is my syntax: 

function filtrovanie()
    {
      var cql = document.getElementById("select").value;
      var hodnota = document.getElementById("dopyt").value;
      var vypis = cql+" "+hodnota;
      var format = new OpenLayers.Format.CQL();
      var filter;
      filter = format.read(vypis);
      if(filter)
      {
          rule.filter = filter;
          wfs.redraw();
          map.zoomToExtent(new
OpenLayers.Bounds(wfs.selectedFeatures[0].getDataExtent()));          
      };

      return false;      
    }

I got this error message : 
Cannot call method 'getDataExtent' of undefined

I also tried to set wfs.selectedFeatures[0].geometry.getBounds().clone() ,
but nothing happened. 
Can you say me what is wrong? 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Zoom-to-selected-features-tp2649057p7063131.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111205/36f6c72d/attachment.html


More information about the Users mailing list