Larry, Actually, I just want to load the other KML while the map still show last lat,lon,zoomlevel,maptype. That is more convenient for user to see the difference between each KML overlay on the same background.
On Nov 20, 10:46 pm, "[email protected]" <[email protected]> wrote: > On Nov 20, 7:37 am, Woodyz <[email protected]> wrote: > > > Mike, > > I tried removing the lines you've told me, the map was not loaded. > > I looked at Error console from Firefox, it said "c is undefined" > > It seems that I have to give MapCenter and ZoomLevel everytime before > > requesting KML, which I don't know these values. > > You need to initialize the map before adding overlays. map.setCenter > () initializes the > map:http://code.google.com/apis/maps/documentation/introduction.html#Init... > > If you don't know what the "final" center is going to be, loading the > kml can center it on the contents of the kml or you can call > map.setCenter again when you do know. > > -- Larry > > > > > On Nov 20, 6:14 pm, Mike Williams <[email protected]> wrote: > > > > Wasn't it Woodyz who wrote: > > > > >Hi, > > > > >Can anyone help me look at my webpage? I am very new to Javascript. > > > >I want my script to remember last MapCenter, ZoomLevel and MapType, > > > >then anytime when user select new KML overlay from listbox, the map > > > >will show new KML overlay without moving and don't change ZoomLevel > > > >and MapType. > > > > >My webpage has two listboxes to show Map, here it is; > > > >http://www.wap.ait.ac.th/slr/test.html > > > > >Thank you in advance > > > > Have you tried removing the lines on which you change the map centre and > > > zoom level after requesting the KML? > > > > if (s_a == "1"){ > > > //map.setCenter(coThai, 6); > > > map.setCenter(new GLatLng(curLat, curLng), 6); > > > } else if (s_a == "2") { > > > map.setCenter(coBKK, 10); > > > } else if (s_a == "3") { > > > map.setCenter(coCentral, 8); > > > } else if (s_a == "4") { > > > map.setCenter(coEast, 8); > > > } else if (s_a == "5") { > > > map.setCenter(coSouth, 7); > > > } > > > > Hint: You only need one copy of each GControl, GoogleBar and > > > GClientGeocoder, so your page will be more efficient if you don't do > > > this each time you call SLevel() or SArea() > > > > map.addControl(new GMapTypeControl()); > > > map.addControl(new GLargeMapControl()); > > > map.setUIToDefault(); > > > map.enableGoogleBar(); > > > geocoder = new GClientGeocoder(); > > > > -- > > > Mike Williamshttp://econym.org.uk/gmap-Hide quoted text - > > > - Show quoted text - -- 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=.
