Is Displaying 1000+ Feature Footprint Vectors on OpenLayers Map with Good Performance Possible? [closed]

℡╲_俬逩灬. 提交于 2019-12-06 16:29:50

问题


When loading many feature footprint vectors onto the map, the openlayers map and web application becomes unresponsive. Is there any way to improve the performance of the openlayers map with many vectors?

We would like to be able to support at least 1000 vectors on the map at once.

We are using openlayers 4.

As I can tell, OpenLayers 3+ uses HTML5 canvas to render images and vectors. I've seen the canvas being used to make video games and other high performance graphic applications. I don't understand why it would cause this unresponsive issue with OpenLayers though.

Edit: When I say "vectors" I mean square polygons. This application will run on a desktop with average computing power.


回答1:


TL/DR: Yes.

If not, it's likely your own fault. But there are a few easy fixes for when an OL application becomes slow/unresponsive.

  1. Use the image render mode(previously known as ImageVector) for large vector layers. ol.layer.Vector({ renderMode: 'image', ... })

Great performance, but point symbols and texts are always rotated with the view and pixels are scaled during zoom animations.

  1. When you have many features, do not create new styles for each of them with a styleFunction. Instantiating objects is expensive in JavaScript. Try to switch to static styles.

  2. If you are only displaying points, use an cluster layer . Showing one quadrupillion points isn't very helpful anyway

  3. Try the webgl renderer. It is probably faster, but might also look a bit different

.

if (ol.has.WEBGL) {
  var map2 = new ol.Map({
    renderer: (['webgl', 'canvas']),
    ....
  });
} else { 
  // fallback
}


来源:https://stackoverflow.com/questions/48573480/is-displaying-1000-feature-footprint-vectors-on-openlayers-map-with-good-perfor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!