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

andreia farrér andreia.farrer at gmail.com
Tue Aug 17 09:50:49 CEST 2010


I've now added the following line to my code:

 <script type="text/javascript" src="/proj4js/lib/proj4js.js"></script>
>

Is that sufficient or do I have to add someting like a
reprojection-statement in my WFS-definition?
Cheers
Andreia

2010/8/16 Adam Ratcliffe <adam at prema.co.nz>

> You may need to include the Proj4js library, if you're not already, as your
> map projection is not spherical mercator.
>
> Cheers
> Adam
>
> On 16/08/2010, at 10:01 PM, andreia farrér wrote:
>
> Hi Adam,
> thanks a lot for the quick reply.
> I now activated the 'extent'-option, but the result is still the same, no
> feature-rendering. I don't think it's related to the missing
> "zoom/center"-options, but as I'm quite new to GeoExt/OL so I can't rule it
> out for sure.
> Cheers
> Andreia
>
>
>
> 2010/8/16 Adam Ratcliffe <adam at prema.co.nz>
>
>> 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
>> <andreia.farrer at gmail.com> 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
>> > Users at geoext.org
>> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>> >
>> >
>>
>
>
>
> --
> Andreia Farrér, Birmensdorferstr. 260, 8055 Zürich; phone: +41 78 825 44 93
>
>
>


-- 
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/20100817/c3954341/attachment.htm 


More information about the Users mailing list