question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance issues with vl-source-cluster

See original GitHub issue

Hi, first of all, I’d like to say that I’m new to OpenLayers and VueLayers and it therefore might be a problem in my understanding of how to use the framework. I’m testing whether to change from Leaflet.js to OpenLayers (with vuelayers) for an already existing application. I used Leaflet with Vue2leaflet and the marker-cluster plugin for Vue2leaflet in my application and I’m now trying to replace this with OpenLayers.

I’m trying to simply add a list of points to the map, where each point is designated by marker. I also then would like to be able to interact with the markers (clicking and hovering). As a first step I simply implemented putting the list of points on the map and adding a vl-source-cluster following the example on the demo site, with some modifications.

The code I have so far is roughly:

<template>
  <vl-map :load-tiles-while-animating="true" 
    :load-tiles-while-interacting="true"
    :controls="false">
    <vl-view :center.sync="center" :zoom.sync="zoom" :rotation.sync="rotation"></vl-view>
    <vl-layer-tile>
        <!--<vl-source-osm></vl-source-osm>-->
        <vl-source-xyz :url="mapUrl"></vl-source-xyz>
    </vl-layer-tile>
    <vl-layer-vector>
      <vl-source-cluster :distance="200">
        <vl-source-vector>
          <vl-feature v-for="client in clientList" 
                      :key="client.customer_id">
              <vl-geom-point :coordinates="invert(client.position)"></vl-geom-point>
              <vl-style-box>
                <vl-style-icon src='../statics/icons/ort.png' :scale="0.5" />
              </vl-style-box>
          </vl-feature>
        </vl-source-vector>
        <vl-style-func :factory="clusterStyleFunc" />
      </vl-source-cluster>
    </vl-layer-vector>
  </vl-map>
</template>

here clientList is an array of about 700 objects. The problem is that it takes the map a really long time to generate the clusters (in comparison with leaflet) and it becomes very slow to interact with, even after it is generated.

Is this a good approach for what I’m trying to do? Or is it better to create the features array programatically and then pass it to the cluster? And if so, can I still make use of the reactivity of vue.js?

I’ve read here about the super cluster library which might be relevant. Is this something already in VueLayers? Do you think it will be difficult to combine with Vuelayers?

I would really appreciate any help you can give! Thanks, Omri

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
naveenrainacommented, Jun 14, 2019

@ghettovoice I figured out the error. It was because I had to set properties of feature through openlayers. I was using these properties in style function and as they were not there, style function was throwing assertion errors. Now I have set the properties with feature.set(key, value) and style is working. Thanks again for your help.

1reaction
ghettovoicecommented, Jun 12, 2019

Hi guys!

@naveenraina I just made the new example https://jsfiddle.net/ghettovoice/baojhrL6/. It is basic example extracted from the demo app. For any vector layer with more than 1 feature I suggest you add features through features property as array of GeoJSON objects.

In the latest project where I use vuelayers, I need to show a lot of tracker markers and all of them should smoothly moving between last -> new coordinate arriving from api. And I also faced performance issues with this layer, because storing huge array as any Vue reactive property blows up CPU and freezes UI.

So I ended up with slightly complex setup: I use VueLayers components only to build object hierarchy, i.e. build map and layers from config, but load features with custom loader function, and then add features through native OpenLayers API. And do not store loaded features in Vue reactive fields. In this setup Vue and its reactivity only used to configure map with layers, but all other work related to loading, animating features made through OpenLayers API without additional overhead.

Note that in any case OpenLayers API will be a bit complex than Leaflet, but in my opinion it gives more opportunities for complex use cases. For the similar effect with clusters (like in marker-cluster plugin for Leaflet) you can try to use this http://viglino.github.io/ol-ext/examples/animation/map.animatedcluster.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance Boost: Getting the Most Out of the WAN - CDW
Trouble starts when this traffic becomes congested and the network experiences latency, which slows down performance and frustrates users.
Read more >
An Overview of Security Issues in Cluster Interconnects
This security performance problem becomes more com- plicated as cluster systems use very high speed cluster interconnects. Traditionally, all communication ...
Read more >
Enabled NFS Datastores in VMware vSphere® 5.0
This test case shows the ability of SIOC to isolate the performance of applications that use small sized I/O requests in the presence...
Read more >
Up to 6.5X Better With Micron's M500DC Enterprise SSD
Micron's M500DC SSD improves per-node performance without additional requirements. Speed and Spin: Oil and Water?
Read more >
Spotlight on Oracle: rapidly find and fix performance bottlenecks
performance issues before they impact the database ... Oracle RAC (Real Application Cluster) environments at the node, ... Diagnose the source of database....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found