32

In your experience, how many point features can be added to an OpenLayers vector layer (new OpenLayers.Layer.Vector("Point Layer")) before it goes unusably slow?

My use case is to display points from a database table. The user can decide which time frame to visualize. Therefore the result can be from very few to potentially 100,000s of points. I'd like to introduce a reasonable limit and warn the user if his query would return more features.

4
  • Is there a standard browser being used? The limit will likely be different depending on which browser you're using. Apr 23, 2011 at 16:21
  • Mostly Firefox. It doesn't have to work in old IEs.
    – underdark
    Apr 23, 2011 at 17:53
  • 1
    Rather than warn a user you could switch from requesting vector data to returning the points as a WMS / image. Apr 24, 2011 at 7:52
  • @geographika: Usually I'd do that. But the user also gets to decide which database to connect to. I'd have to know all possible databases and have them available through a WMS. They don't even have PostGIS installed, i just fetch lat/lon columns.
    – underdark
    Apr 24, 2011 at 20:16

6 Answers 6

45

I don't have a definitive answer for you but you I put together a page where you can play around with different numbers of points on an OL map: http://derekswingley.com/lab/olpts/

12
  • 6
    Derek there should be 'Great Answer with practical example' badge for that. Good to see the differences in speed overlying pointss.
    – Mapperz
    Apr 24, 2011 at 4:11
  • 3
    Very interesting! It makes me think to the geoipsum. Alternatively, it can be use as well to test performance : craigmmills.com/geoipsum (I don't know if there is a polygon number limit)
    – simo
    Apr 26, 2011 at 11:53
  • 1
    @So4ne that google app engine site died at some point, the same (nearly 5 year old) code is here: derekswingley.com/lab/olpts Jan 21, 2016 at 18:53
  • 1
    @nospor fallout from switching to https, updated and the site is back. Jun 30, 2016 at 22:44
  • 1
    @DerekSwingley I've made updated samples based on your idea using Leaflet, MapboxGL JS & OpenLayers 4 medium.com/@ThomasG77/… I put credits for your sample
    – ThomasG77
    Oct 27, 2017 at 20:06
5

If the display goes slow because of the too high feature number, it means that the data to display are not suitable for the zoom level. Usually, when the features density goes too high, the display can not be readable anymore (see this example). Even if there was no processing limit and all the display devices were able to display 1000000000000 features in 0.001s on a small screen, the visualisation would remain impossible.

The Töpfer's radix law states that feature density should remain under a constant threshold whatever the zoom level. A way to solve this issue and adapt the data to the visualisation scale is to transform it using generalisation operations like this one or this other one.

3
3

I don't think it is not possible to give solid answer for this question. Rendering point/polygons fully depend on browser and hardware (CPU & memory) not with OpenLayers. I had problem with Openlayers and IE6 for one of the Lake (Polygon) rendering. but, it loaded nicely in Firefox. And best option would be monitor the memory and CPU usage with Chrome or some tools would be better.

2

In OpenLayers 6, there is a WebGL point renderer which should allow you to render 100s of thousands of features, with time based filtering. You May want to check out the latest version of the official workshop at https://openlayers.org/workshop/en/webgl/.

With OpenLayers 2, which I really don’t recommend to use any more, the maximum for acceptable frame rate will be a few hundred features only.

1

As others, I have no answer regarding that question, but applying a BBox strategy could help you keeping just the needed data since it displays only features located within the given bounding box.

0

I stumbled on a similar use case, not sure whether it will suit the above mentioned needs but Clustering in OL 5 is what I adopted.

Clustering as the words suggests takes a group of points and merge them togther in a single point e.g. you have 100 points in particular city all the points will be visible as one point from a zoom of let's say 4 but as individual points from a zoom of let's say 10 so what you can do is when the zoom is 4 you can join those points as one, what this does it helps reducing the number of points to be rendered in a particular area.

In other words, let's say you have 10,000 points to be rendered on the map and they are pretty close to each other, so you can make clusters of them and reduce rendering and when the user zooms in you keep breaking the clusters. This will ensure that you have less rendering and better performance.

Satisfying performance. Link to Clustering examples on Openlayers

1
  • Could you please add a short summary of the page linked? Links may break with time, leaving your answer useless as it is now.
    – Kantan
    Apr 29, 2019 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.