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


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


Unique IDs are generated as a strictly increasing sequence.


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.