You're trying to access a geometry property on features which does not exist. Actually features is an array. Instead, you should loop on those features to get the extent for each one, and take advantage of the extend method on the Bounds class to compute the global extent.
var extent = new OpenLayers.Bounds(); for(var i=0, len=features.length; i<len; i++) { extent.extend(features[i].geometry.getBounds()); } Also notice that "extent" and "extend" have different meanings in english. Pierre On Thu, Dec 9, 2010 at 6:35 PM, Wyo <otto.w...@orpatec.ch> wrote: > I'm retrieving a relation from API and like to center the map according the > relation albeit it's not working. > > handleResponse: function (resp, options) { > var request = resp.priv; > if(options.callback) { > if(request.status >= 200 && request.status < 300) { > // success > resp.features = this.parseFeatures(request); > resp.code = OpenLayers.Protocol.Response.SUCCESS; > //?var extend = resp.features.geometry.getBounds(); > //?if (extend) this.map.zoomToExtent (extend); > }else{ > // failure > resp.code = OpenLayers.Protocol.Response.FAILURE; > } > options.callback.call (options.scope, resp); > } > }, > > As soon as I remove the //? to activate the lines it doesn't work anymore > yet no error is given. Debugging isn't possible it doesn't return after > stepping over getBounds. > > Wyo > http://www.orpatec.ch/osm/tools/test.php > > _______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users > -- Pierre GIRAUD Géomaticien, Analyste Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 93 Mail : pierre.gir...@camptocamp.com http://www.camptocamp.com
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users