Google Maps Api inverts KML layer after Zoom

I have a strange problem with the Google Maps API and KML file.

When I initialize the map with KML everything works like a charm. Now my problem: after zooming to a map (zoom level 10) the KML layer is inverted.

Here's an example:

var settings,map,marker,infowindow,consultant_fname,consultant_lname,consultant_zip,consultant_city,mapOptions;
var markers = [];

            mapOptions = {
				zoom: 8,
				center: new google.maps.LatLng(47.643186, 13.760376),
				scrollwheel: false,
				mapTypeControl: false,
				zoomControl: true,
				zoomControlOptions: {
					style: google.maps.ZoomControlStyle.SMALL,
					position: google.maps.ControlPosition.RIGHT_TOP
				scaleControl: true,
				streetViewControl: false,
				panControlOptions : {
					position: google.maps.ControlPosition.RIGHT_TOP

			map = new google.maps.Map(document.getElementById('gmap'),mapOptions);
            var ctaLayer = new google.maps.KmlLayer('',{
				preserveViewport: true,
				suppressInfoWindows: true,
				map: map,

<script src=""></script>
<script src=""></script>
<div id="gmap" style="width:700px;height:700px;"></div>

Run codeHide result

Hope someone can help me.

Best regards M.


source to share

1 answer

Looks like a bug in the KML renderer.

As a workaround you can use a 3rd party KML parser (like geoxml3 or geoxml-v3 ), geoxml3 doesn't seem to have this artifact:

Example using geoxml3 (and slightly modified KML to cover the whole world)

Note that for complex KML, the tile-based rendering of the KmlLayer will be more efficient and you may run into performance issues with third-party parsers.



All Articles