vendredi 27 avril 2018

Openlayers 4 ol.map.forEachFeatureAtPixel is Slow and Freezes UI for Lines that Wrap Around World

When I try to display a very long line that completely wraps around the entire world (e.g., satellite orbits) in an ol.layer.Vector layer, and then call ol.map.forEachFeatureAtPixel, the UI is completely frozen until this call is finished. Typically forEachFeatureAtPixel takes 1 to 8 seconds to finish (depending on how many lines are being displayed).

From what I understand, forEachFeatureAtPixel's algorithm uses spatial indexing to quickly narrow down the area it compares. However, with lines that wrap around the entire world, spatial indexing does not work.

Now, I don't much mind the 1 to 8 second processing time, but having the UI freeze up is unnacceptable. I've looked into using web workers, but am unable to pass the map into the web worker. Web workers also do not have access to the document window which is required for openlayers library to work.

Am I completely boned here? What other options do I have?

Thanks




Aucun commentaire:

Enregistrer un commentaire