Re: [Google Maps API v2] map page with geocoding not working as expected.
This
http://econym.org.uk/gmap/async.htm
is very relevant.
You need to do stuff in the callback, rather than just 'after' the
function. change side_bar actully in the createMarker function.
You should read this too.
http://econym.org.uk/gmap/geomulti.htm
However if this is your first map, you really SHOULDN'T be using v2 of
the Maps API. It been withdrawn, and due to be turned off.
http://www.geocodezip.com/ has many of Mikes tutorials converted to v3.
On Thu, May 3, 2012 at 10:36 PM, jiminwoodstock
<jiminwoodstock@gmail.com> wrote:
> The link to my site with the map page is www.jimbell.us/testmap2a.html
>
> This code is based on Mike Williams tutorial site. The original page
> is http://econym.org.uk/gmap/basic2.htm.
> I wanted to use addresses instead of lon/lat to place the markers and
> populate the side bar. I added 2 small functions which do the lookup
> with the geocoding "getLocations" function.
> I also made a few other changes to accommodate the geocoding addition.
>
> The problem--- The resulting page shows the markers at the correct
> place on the map. However, the side bar is not displayed at all. After
> doing some debugging with firebug, I believe I have found the problem,
> but I don't know how to fix it.
>
> Apparently, the callback function from the geocoder getLocations
> function does not hold up the execution of the following code. I added
> code to the end of the javascript that checks to see if the data has
> been created and it has not. So when the page is executed, you
> immediately see my error message in the sidebar and then later see the
> generated map. The error message in the side bar is the last line of
> code in the whole page. So the page is executed quickly down to the
> end and any global variables have not had data placed in them. Later
> on, the callback function that was called by the getLocations to place
> the markers gets executed and fills in the global variables but it is
> way too late. I would like my page to work the same as the original
> page in Mike's tutorials, but use addresses instead of lng/lat
> coordinates.
>
> --
> 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.
>
--
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