HI Andreia, I note that you've commented out the 'extent' option in the MapPanel configuration and you have no 'zoom' and 'center' options specified - could that be the problem?
You could try adding the vector layer to the map and letting the MapPanel create a LayerStore for you from the map's 'layers' array, though looking at the docs the 2 approaches look like they should be equivalent. Cheers Adam On Mon, Aug 16, 2010 at 9:24 PM, andreia farrér <[email protected]> wrote: > Dear List > I am trying to build a WFS-T-application with GeoExt/Openlayers. The > features are stored in a PostGIS-DB and are served by Geoserver. > I managed to retrieve the features (as stated by HttpFox), but somehow they > won't show up in my mappanel. The code is based on the > wfs-states.html-example > (http://openlayers.org/dev/examples/wfs-states.html). I simply can't figure > out why the features aren't rendered. > Here's my snippet: > >> Ext.BLANK_IMAGE_URL = "../ext/resources/images/default/s.gif"; >> >> Ext.onReady(function() { >> OpenLayers.ProxyHost = "../cgi-bin/proxy.cgi?url="; >> >> var map_options = {maxExtent: new OpenLayers.Bounds(10000, -240000, >> 1380000, 580000), >> numZoomLevels: 12, maxScale: 5000, minScale: 2000000, >> units: 'm', projection: 'EPSG:21781'}; >> >> var map = new OpenLayers.Map(map, map_options,{ >> allOverlays: true >> }); >> >> var modifyControl = new >> OpenLayers.Control.ModifyFeature(ogmlines); //ÄNDERN! >> map.addControl(modifyControl); >> modifyControl.activate(); >> >> >> var saveStrategy = new OpenLayers.Strategy.Save({ >> onCommit: function() { >> saveStrategy.ogm_lines.refresh(); >> } >> }); >> >> ogmlines = new OpenLayers.Layer.Vector("lines",{ >> strategies:[ >> new OpenLayers.Strategy.BBOX(), >> saveStrategy >> ], >> projection: new OpenLayers.Projection("EPSG:21781"), >> protocol: new OpenLayers.Protocol.WFS({ >> version: '1.1.0', >> srsName: 'EPSG:21781', >> url: 'http://localhost:8090/geoserver/wfs', >> //?strict=true >> featureType: 'ogm_lines', >> featurePrefix: 'OpenGeoMap', >> geometryName: 'the_geom', >> extractAttribute: true >> }), >> }); >> >> var mapPanel = new GeoExt.MapPanel({ >> title: "Map", >> region: "west", >> width: 600, >> map: map, >> layers: [ogmlines], >> //extent: new OpenLayers.Bounds(485000, 63000, 833000, >> 296000), >> bbar: [ >> new GeoExt.Action({ >> control: new OpenLayers.Control.DrawFeature( >> ogmlines, OpenLayers.Handler.Polygon, { >> //ogmlines! >> handlerOptions: {multi: true} >> } >> ), >> text: "Create", >> toggleGroup: "tools", >> map: map >> }), { >> text: "Delete", >> handler: function() { >> >> gridPanel.getSelectionModel().each(function(rec) { >> var feature = rec.get("feature"); >> modifyControl.unselectFeature(feature); >> gridPanel.store.remove(rec); >> if(feature.state !== >> OpenLayers.State.INSERT) { >> feature.state = >> OpenLayers.State.DELETE; >> ogm_polygons.addFeatures([feature]); >> } >> }) >> } >> }, "->", { >> text: "Save", >> handler: function() { >> store_polygons.commitChanges(); >> saveStrategy.save(); >> } >> } >> >> ] >> }); >> } > > Any help is HIGHLY appreciated. > Kind regards > Andreia > > -- > Andreia Farrér, Birmensdorferstr. 260, 8055 Zürich; phone: +41 78 825 44 93 > > _______________________________________________ > Users mailing list > [email protected] > http://www.geoext.org/cgi-bin/mailman/listinfo/users > > _______________________________________________ Users mailing list [email protected] http://www.geoext.org/cgi-bin/mailman/listinfo/users
