# Store data in array?

**URL:** <https://community.cesium.com/t/store-data-in-array/2279>\
**Category:** CesiumJS\
**Created:** [April 2, 2015, 10:50am UTC](https://community.cesium.com/t/store-data-in-array/2279 "2015-04-02T10:50:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nosigcavok](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nosigcavok](https://community.cesium.com/u/nosigcavok)\
**Post date:** [April 2, 2015, 10:50am UTC](https://community.cesium.com/t/store-data-in-array/2279/1 "2015-04-02T10:50:08Z")

</div>

Hello

I tried to store lots of data (coordinate lists, names, links etc.) in an array (basically this works) for later use. However, when I try to retrieve an element from the array, I always get the following error message:

> "An error occurred while rendering. Rendering has stopped.  
> undefined  
> RangeError: invalid array length  
> Cesium.js:456:14694  
> Cesium.js:456:16540  
> Cesium.js:456:21505  
> Cesium.js:456:27300  
> Cesium.js:462:1912  
> Cesium.js:461:21086  
> " Cesium.js:462:1412

I reduced my “array” to one variable with two elements, but even then I get this message. When I replace the array with a “normal” variable it works perfectly.

Any ideas?

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [April 7, 2015, 8:10pm UTC](https://community.cesium.com/t/store-data-in-array/2279/2 "2015-04-07T20:10:20Z")

</div>

Martin,

It’s impossible to answer your question with a code sample that shows exactly what you are doing. What I can tell you is that the error you are getting is the generic error that usually happens when the app gets bad or undefined data to Cesium. If you can post a small example that reproduces the problem, we’d be happy to help you out.

---

<div class="post-metadata">

**Author:** ![nosigcavok](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nosigcavok](https://community.cesium.com/u/nosigcavok)\
**Post date:** [April 12, 2015, 11:41am UTC](https://community.cesium.com/t/store-data-in-array/2279/3 "2015-04-12T11:41:12Z")

</div>

Ciao

Thanks for the hint with the error-meaning (bad/undefined data). I thought I checked everything, but in fact, shame on me: I tried  
to get the last element of the array, so far so good, but retrieved in fact the last element+1, i.e. an element that does not exist, so of course Cesium got no data.

Sorry for the disturbance 🙂

Regards  
Martin
