[go: up one dir, main page]

FeatureCollection: assigning IDs to features is extremely slow

Summary

While profiling an abnormally long time to load a GeoJSON file (albeit very big), I notices that 95% of the time spent was when the Feature.setId() method was called. This is due to the fact that assigning an ID to a feature forces OpenLayers to re-index it.

We use the ID to map OpenLayers features to Giro3D meshes.

Steps to reproduce

  1. Load a big GeoJSON file, such as https://github.com/lbartoletti/lbartoletti.github.io/blob/master/archives/sfcgal/sk_ex_poly_wgs84.geojson

Expected behaviour:

The file loads pretty quick (a few seconds after download is finished).

Actual behaviour:

The file takes much longer and freezes the main thread.

Informations

  • Giro3D version: 0.39
  • Browser (Firefox, Chrome, Opera, Safari...) and version: N/A
  • OS (Linux, MacOS, Windows...) N/A