Infowindow Auto-Pan Problem

858 views
Skip to first unread message

doubleg

unread,
Aug 23, 2011, 8:35:08 PM8/23/11
to google-map...@googlegroups.com
Hello,

In my application, I want to initialize a Google Map based on an input address.  To do so, I send an address to my JS function "initializeMap()", which uses the geocoder to get the lat & lng of the address, and upon successful geocode, I use those coordinates to initialize a map at the provided address.  I'm also trying to automatically display an infowindow at that address after creating the map.  So, after initializing the map and creating a marker at the geocode coordinates, I call another JS function "placeMarkerInfo()" to display the infowindow.  All of this works, except that:  if my "placeMarkerInfo()" function is called in the during initialization, the infowindow does not properly pan the view.  However, at some point after the map is created, if I call my "placeMarkerInfo()" function from a button click, the map pans properly to display the infowindow.  Here is an example that demonstrates the behavior:

http://www.twopalm.com/mapinfotest.html

As a total noob to this, I could be missing something obvious, but I would appreciate any ideas on how to get the infowindow to properly pan during initialization.  Thanks.

Andres Ferrate

unread,
Aug 23, 2011, 9:10:20 PM8/23/11
to google-map...@googlegroups.com
You might want to see if setting up an event listener for the tilesloaded event does the trick:


You would call your placeMarkerInfo() function once the map tiles have finished loading.

Cheers,

Andres



--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/XrpyIQApXX8J.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

doubleg

unread,
Aug 23, 2011, 10:41:02 PM8/23/11
to google-map...@googlegroups.com
Andres, Your solution indeed did the trick; worked perfectly.  Thanks!!
Reply all
Reply to author
Forward
0 new messages