Friday, September 17, 2010

[Google Maps API v2] Re: 'lat' is null or not found... but marker will still show

On Sep 17, 5:47 pm, Pascal <pascal.berti...@gmail.com> wrote:

> Any idea what I am doing wrong ?

for ( var i in markers )

That's not the way to loop through an array of objects in Javascript.
Even in VB, "i" becomes an array element, not a counter, so the next
line is not compatible.

In Javascript, that loop enumerates the *properties* of "markers". The
first 25 properties are the elements of the array and are numbered, so
map.addOverlay( create_gmarker( markers[ i ] ) );
does what you expect, and creates a marker from markers[0],
markers[1], etc.

When those are exhausted, i becomes "copy" and that doesn't match what
the function is expecting. That's what fails.

For Javascript, you have to count through the elements of an array:
for (var i=0;i<markers.length;i++)
which means that i is an integer limited by the size of the array, and
markers[i] is a valid array element.

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate