Hi Mike,

Here's something you could do : listen to the vector layer "featureselected" event to zoom to the extent of a feature selected either from a click or row in the grid. Here's how it should look like (using the example) :

vecLayer.events.on({
    "featureselected": function(e) {
        this.map.zoomToExtent(e.feature.geometry.getBounds());
    },
    "scope": vecLayer
});

If you don't want the map to zoom to the max zoomed in level when selecting a Point feature, you could manage them differently by detecting the type of geometry first then do a "map.setCenter(lonlat, zoom)" instead and define your own zoom level when selecting points.

Best regards,

Alexandre


On 11-03-02 01:44 PM, Michael Savarese wrote:
Greetings, I'm fairly new to GeoExt and OpenLayers and I was experimenting with the example "Grid with Features" http://api.geoext.org/1.0/examples/feature-grid.html. I'd like to zoom or pan to a feature when the feature is clicked on the grid. I've had success with zooming to a feature with OpenLayers but I have no idea how to bind that click to an OpenLayers function. Any help in the form of an example or reference would be appreciated.

Mike


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users


--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to