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 = [];


$(document).ready(function(){
            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,
				panControl:true,
				panControlOptions : {
					position: google.maps.ControlPosition.RIGHT_TOP
				},
			};

			map = new google.maps.Map(document.getElementById('gmap'),mapOptions);
    
            var ctaLayer = new google.maps.KmlLayer('https://www.creditnet.at/austria_3.kml',{
				preserveViewport: true,
				suppressInfoWindows: true,
				map: map,
			});
			ctaLayer.setMap(map);
});
      

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<div id="gmap" style="width:700px;height:700px;"></div>
      

Run codeHide result


Hope someone can help me.

Best regards M.

+3


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.

+2


source







All Articles