On Nov 24, 9:34 am, Kevin <kevin.jo...@transcore.com> wrote:
> I am loading KML onto my map. I use preserveViewport to preserve the
> bounds and zoom of the map. That works as expected.
> After loading the KML, I set a timer that after a period of time,
> reloads the same KML using preserveViewport again. This time the map's
> view is changed to fit the contents of the KML - not what I wanted or
> expected. How do I fix this?
>
> Here's a look at the javascript:
> var _googleMapV3 = null;
>
> function loadV3() {
> if (GBrowserIsCompatible()) {
> var mapTypes = new Array();
> mapTypes.push(google.maps.MapTypeId.ROADMAP);
> mapTypes.push(google.maps.MapTypeId.HYBRID);
> mapTypes.push(google.maps.MapTypeId.TERRAIN);
>
> var latlng = new google.maps.LatLng(cityLatitudeCenter,
> cityLongitudeCenter);
>
> var myOptions = {zoom: 8,
> center: latlng,
> mapTypeControlOptions: { mapTypeIds: mapTypes },
> mapTypeId: google.maps.MapTypeId.TERRAIN };
> _googleMapV3 = new
> google.maps.Map(document.getElementById("googlemap"), myOptions);
>
> loadKML();}
>
> else
> {
> alert("Sorry, the Google Maps API is not compatible with this browser");
>
> }
> }
>
> var _kmlLayer = null;
>
> function loadKML() {
> if (_kmlLayer != null) {
> _kmlLayer.setMap(null);
> delete _kmlLayer;}
>
> _kmlLayer = new
> google.maps.KmlLayer("http://geology.utah.gov/geo_guides/st_george/kmz/st_george_field_trip...";,
> { map: _googleMapV3, preserveViewport: true, suppressInfoWindows :
> false });
> InitiatePageTimer(); // This method, loadKML() is called again when the
> timer elapses
>
> }
>
> The first call to loadKML() works as expected. After a 15 second timer,
> loadKML() is called again. This time" preserveViewport: true" is
> ignored; the map view is changed.

Where is the map that shows that problem?

  -- Larry

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

Reply via email to