[Users] GeoExt.data.FeatureStore and layer features information
Lluís Peinado
peinado.l at gmail.com
Mon Apr 19 19:45:20 CEST 2010
Hi again, thanks a lot for your response, Andreas.
Finally I used the vector layer's events (featuresadded) with something
like:
var vecLayer = new OpenLayers.Layer.Vector("WFS", {
eventListeners: {
featuresadded: function() {
var extent = vecLayer.getDataExtent()
mapPanelWMS.map.zoomToExtent(extent);
mapPanelWFS.map.zoomToExtent(extent);
wms.setVisibility(true);
}
}});I used the example on this
page:http://workshops.opengeo.org/geoext/more_ogc/dissect.html
Regards.
2010/4/19 Andreas Hocevar <ahocevar at opengeo.org>
> Hi,
>
> loading the features is asynchronous. If you want to access the features,
> you have to wait until they are loaded. The best way to do so is register
> for the store's load event.
>
> Regards,
> Andreas.
>
> On Apr 19, 2010, at 00:59 , Lluís Peinado wrote:
>
> > Hi everyone, this is my first message to the list.
> > I'm working on an application based on this example:
> > http://dev.geoext.org/trunk/geoext/examples/feature-grid.html
> >
> > I have a problem using my own application and also debugging the
> example's code, I create a vector layer and a FeatureStore with this
> >
> > // create vector layer
> >
> > var vecLayer = new OpenLayers.Layer.Vector("vector");
> >
> > map.addLayers([wmsLayer, vecLayer]);
> >
> > // create feature store, binding it to the vector layer
> > store = new GeoExt.data.FeatureStore({
> > layer: vecLayer,
> > fields: [
> > {name: 'name', type: 'string'},
> > {name: 'elevation', type: 'float'}
> > ],
> > proxy: new GeoExt.data.ProtocolProxy({
> > protocol: new OpenLayers.Protocol.HTTP({
> > url: "data/summits.json",
> > format: new OpenLayers.Format.GeoJSON()
> > })
> > }),
> > autoLoad: true
> > });
> >
> > It really works fine, but when I want to read the vector layer features i
> can't localize them, things like:
> > this.store.layer.features[] has no point features as spected on an
> OpenLayers vector layer
> > I've tried also to look at
> > this.mapPanel.map.layers[1].features[]
> > but no success, only "remove" method is listed on firebug watcher.
> > Is there anyway to access this data?, is just I need to read the point
> coordinates to center the map and things like that.
> >
> > Thanks a lot for any suggestion.
> > Lluís.
> >
> > _______________________________________________
> > Users mailing list
> > Users at geoext.org
> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100419/4f28d176/attachment.htm
More information about the Users
mailing list