[OpenLayers-Users] WFS-T

Ivan Grcic igrcic at gmail.com
Wed Nov 25 13:39:03 EST 2009


Hi,
 I would say your solution depends on two things: level of
interactivity you want to achieve and browser limits.

Most important thing to have in your mind: Browser limit says don't
load more then (having IE in mind) -> 100-150 features!

Off course we would like to have the highest level of interactivity,
that is, to have all the features loaded - vector layer, so we can
have fast hover/click effects on features. But because of browser
limits that's not possible. So depending on your data, we can cope
with this with different solutions:

1) Use wms layer with GetFeature control
http://openlayers.org/dev/examples/getfeature-wfs.html
Like this all the feature show up, but you only get some info when you
click on it. Bad thing is that sometimes it takes some time to query
the features
(lower interactivity), so make sure you have fast response from your
server for this (spatial index data usually helps ;)
Use this for large scales of you layer

2) Use vector layers. Use this solutions when you are sure that you
wont be requesting lots of features at once (browser limits). Using
BBOX with Cluster strategy is not a bad solution. Use this for small
scales (small areas -> less features are requested)
One important note here: Cluster strategy that we have here is a
client solution, that means all the data has to be received before
they are clustered. Example: we have 5000 points. If we use cluster
strategy they will be visualized with, lets say, 100 points -> within
browser limits right? But what about the data transfer and expensive
calculations of clusters (every time we zoom in?) Conclusion: be
careful with  cluster strategy, don't use it if you have more then few
hundreds features (and use it together with BBOX strategy)

3) Develop server clustering - this should be the best solution I
think (most intereactive also) Let server process the data, and make
clusters for you, with some basic cluster info - like geometry, number
of features in cluster etc. Then you make vector layer out of it, and
implement lets say hover effect that get basic data, and on click you
make GetFeatureInfo request that gets the rest of the data.

The best example that works in similar way is maps.google.com with
Wikipedia & Photos layers, where you can see tons of images at once
without lots of stress on thebrowser.  Its wms layer with clusters in
background, and div elements (or image map?, im not sure) in front.

Cheers

On Wed, Nov 25, 2009 at 4:59 PM, Alexandre Dube <adube at mapgears.com> wrote:
> Hey,
>
> 40.000 is sure big.  You could try the Cluster strategy [1], or have you
> points in WMS when zoomed out then changed to WFS when zoomed in.  The
> latter is what I'm doing in the demo I sent you.  Load it, then zoom
> out.  You'll see that the roads switch from WFS to WMS.  You could also
> do that.
>
> Best regards,
>
> Alexandre
>
> [1] http://openlayers.org/dev/examples/strategy-cluster.html
>
>
> JuKiM wrote:
>> Ok..
>>
>> And about the other question.. If in the datasource there are about
>> 40.000 positions... Is a good way to try loading them with WFS? Or
>> using WMS is recommended?
>>
>> Thanks!
>>
>>
>> 2009/11/25 Alexandre Dube <adube at mapgears.com <mailto:adube at mapgears.com>>
>>
>>     Hi,
>>
>>      Just before your commit, you need to copy the your field values
>>     to the feature's attributes.  They will then be part of the
>>     'insert' request sent to your server.  See an example (demo) of
>>     what I'm talking about [1].  It uses TinyOWS, but it should be
>>     similar to what you're seeking to do.
>>
>>      Hope this helps,
>>
>>     Alexandre
>>
>>
>>     [1] http://dev4.mapgears.com/bdga/bdgaWFS-T.html
>>
>>
>>     JuKiM wrote:
>>
>>         Hi,
>>
>>         I'm searching documentation about WFS-T, because with I can
>>         understand, it let to create new entries in the datastore
>>         through the GeoServer....
>>
>>         I create the map, and a wms layers which is displayed, and
>>         then I create the wfs layer..
>>
>>         wfs = new
>>         OpenLayers.Layer.WFS("Test_Layer","http://localhost:8080/geoserver/wfs",
>>                        {typename: 'Test:dots'},
>>                        {
>>                            typename: "dots",
>>                            featureNS: "http://www.uriURL.org/test",
>>                            extractAttributes: false,
>>                            commitReport: function(str) {
>>                             alert(str);
>>                                OpenLayers.Console.log(str);
>>                            }
>>                        }
>>                    );
>>
>>         var draw = new OpenLayers.Control.DrawFeature(
>>                        wfs, OpenLayers.Handler.Point,
>>                        {
>>                            handlerOptions: {freehand: false, multi: true},
>>                            displayClass: "olControlDrawFeaturePoint"
>>                        }
>>                    );
>>                                var save = new OpenLayers.Control.Button({
>>                        trigger: OpenLayers.Function.bind(wfs.commit, wfs),
>>                        displayClass: "olControlSaveFeatures"
>>                    });
>>                              panel.addControls([
>>                        new OpenLayers.Control.Navigation(),
>>                        save, draw
>>                    ]);
>>                      map.addControl(panel);
>>
>>         When I save the new points, they are insterted in the DB, but
>>         with empty values.. Only the auto incremental id is created..
>>         In my table there are four fields, 'id', 'location',
>>         'description', 'type'. How can I configure the WFS calls to
>>         create the new entries with all the information? (The
>>         information about description and type is the same, and is
>>         stored in a textfield, and the location should be the
>>         different points of the map..
>>
>>         And on the other hand, if the datasource contains about 40.000
>>         positions, is better to work with WMS and process the
>>         information in server side?
>>
>>         Thanks!
>>         ------------------------------------------------------------------------
>>
>>         _______________________________________________
>>         Users mailing list
>>         Users at openlayers.org <mailto:Users at openlayers.org>
>>         http://openlayers.org/mailman/listinfo/users
>>
>>
>>
>>
>>     --
>>     Alexandre Dubé
>>     Mapgears
>>     www.mapgears.com <http://www.mapgears.com>
>>
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



--
Ivan Grcic



More information about the Users mailing list