3

In OL4 (or, I guess, any version >=3.0), all features have an undefined id unless it is set by any mean. They do have, however, an ol_uid value (as far as I could understand, all ol objects have such property), that seems a "random" number set automatically by openlayers. In order to store feature styles in memory, it is safe to use this variable as a map index? I am doing it already, but want to be sure that there's "no chance" of collision.

1 Answer 1

4

As they said in the comment, there'll be no collision.

https://github.com/openlayers/openlayers/blob/4a2d711fb77703ef708c596452775f4d0eebaf11/src/ol/index.js#L112-L114

Unique IDs are generated as a strictly increasing sequence.

0

Your Answer

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

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