Markercluster, google maps cant get location object
I want to make a markercluster, where i get my lat/lng values from my database.
When i use this example here:
Then those location values are objects and those are working.
Now I have a loop where i create an array:
- lnglatarr.push({
- lat: parseFloat(i[l].getAttribute("lat")),
- lng: parseFloat(i[l].getAttribute("lng"))
- });
// AFTER THAT i send the array to this function:
- createcustom (lnglatarr);
Here the function
- function createcustom(arr)
- {
- locations = JSON.stringify(arr);
- console.log( locations ); // 15
- localStorage.setItem('gameStorage', JSON.stringify(locations));
- }
When i see the log i get:
en:2910 [{'lat':-6.1472845,'lng':106.81507789999999},{'lat':-6.1463909999999995,'lng':106.815356},{'lat':-3.566773,'lng':102.788227},{'lat':-3.994781,'lng':138.513722},{'lat':-6.1463076,'lng':106.8157078}]
Now, that data is not accepted by markerclusterer .
When i use the location data from the example link of google i get this in the console:
- [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
- 0:Object
- 1:Object
- 2:Object
- 3:Object
- 4:Object
- 5:Object
- 6:Object
- 7:Object
- 8:Object
- 9:Object
- 10:Object
- 11:Object
- 12:Object
- 13:Object
- 14:Object
- 15:Object
- 16:Object
- 17:Object
- 18:Object
- 19:Object
- 20:Object
- 21:Object
- 22:Object
- length:23
Now, how do i create these objects so , i can use my own data?