[Users] Building a WFS-T-application; Problem rendering WFS

andreia farrér andreia.farrer at gmail.com
Mon Aug 16 11:24:25 CEST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100816/27adb0c8/attachment-0001.htm 


More information about the Users mailing list