If you need to display data that is in a kml file then the command gotoDefaultViewport will result in a map that is centered and zoomed such that all the data from the kml file appears on the map. But since you have to set the map center before doing anything with the map, people have complained that the map ‘jumps’ from an initial view to the view presented by gotoDefaultViewport. Here is a prior thread pointing out that if you initially center the map above of 85.5 degrees latitude, then the screen will display a blank gray map which in due course will be replaced by map tiles and data from your kml file. http://groups.google.com/group/google-maps-api/browse_thread/thread/804032603bec84f7/c6458743e3302d0f?lnk=gst&q=gotoDefaultViewport#c6458743e3302d0f
However, any features you added to the map outside of the API (i.e. buttons, div with text, etc) will appear on the gray background while you wait for the kml file to load. For various reasons, that wait time might be a few seconds. If you prefer, you can completely suppress the gray map background (and any non-API buttons, etc) during this wait time. To do this, write the map to a ‘hidden’ div and set an event handler that will do two things after the kml loading is done: (1) execute the gotoDefaultViewport command and (2) make the map div visible. Below are two map links. The first one does not use the hidden map div technique and the second one does. They call different kml files (to avoid the google cache) but the contents of those files are identical. Notice the difference in how long the gray background is visible before you see the map. Keep in mind that after you run this test once, the two kml files are in the Google cache and therefore a retest will not be very meaningful until Google flushes its cache at some unknown future point in time. http://www.mappingsupport.com/p/demo_maps/gotoDefaultViewport_grayMore.html http://www.mappingsupport.com/p/demo_maps/gotoDefaultViewport_grayLess.html Joseph Elfelt -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
