[OpenLayers-Users] Large Vector Layer

Tim Schaub tschaub at openplans.org
Tue Aug 21 11:56:35 EDT 2007


Hey-

Scott Davis wrote:
> Bottom line: I need features from a datalayer that has 10k points. Is  
> WFS what you'd recommend at this point?

A few things to keep in mind:

With the current vector formats, you should think on the order of 100s 
of features client side (not thousands).

You can use the maxFeatures parameter with WFS to limit the number of 
features requested.

You can use a combination of WMS and WFS - with min/max resolution on 
the layers - to limit requests for vector features.

You can use WMS with GetFeatureInfo to query feature attributes.

There are two ways you take performance hits with vector features (or 
markers): parsing and rendering.  Currently you can't control how many 
features get rendered - all features within the viewport extent get 
rendered.  In the future, we can improve on this with resolution 
dependent rendering client-side.

In terms of parsing, I've made some improvements to the GML parser.  I 
have not had time to get these in the trunk yet.  I've seen a 2-3x 
improvement in parsing time with the new GML format.  This brings GML 
parsing time close to GeoJSON parsing time (also not in the trunk).

Of course, performance varies depending on your setup.  I've just run 
the tests on the following page:
http://dev.openlayers.org/sandbox/tschaub/xml/examples/format-test.html

And gotten the following parsing times:
5.5 ms per GML feature
4.3 ms per GeoJSON feature

(If you run the test - wait until both documents show "loaded" before 
clicking the links to parse features.  The tests take 5-10s to run in FF.)

So, without accounting for parsing, you can assume a client will parse a 
feature (with attributes) in 5-10 ms.  You can see how waiting around 
100 seconds just to parse 10,000 features is a show stopper.  Don't even 
consider rendering them.

I'll work on getting the new GML format tested and into the trunk this 
week.  Even with that, you'll want to take other measures to limit the 
number of features you deal with on the client side.  I hope to 
experiment with resolution dependent rendering before FOSS4G - if you're 
going to that, look for updates around that time.

Finally, consider WMS GetFeatureInfo for getting feature attributes.  I 
don't have a recipe handy for populating a popup with GetFeatureInfo 
results, but it's not that hard to put together.

Tim




More information about the Users mailing list