Block lists

I have a Google Maps ranking service (for my geography of Pennsylvania students) that works great with click points on basic Google files. I would like to add a kml layer showing PA counties. When I add it, height level information is no longer displayed. Is there a way to add kml but suppress its response to a click to show the response to the elevation?

Current code (partial):

function initialize() { var mapOptions = { zoom: 7, center: centerOfPA, mapTypeId: 'roadmap' } map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var paCounties = new google.maps.KmlLayer('http://mapmaker.millersville.edu/arcgis/services/PAcounties/MapServer/KmlServer', {suppressInfoWindows: true}); paCounties.setMap(map); // Create an ElevationService elevator = new google.maps.ElevationService(); // Add a listener for the click event and call getElevation on that location google.maps.event.addListener(map, 'click', getElevation); } 
+4
source share
1 answer

Either disable click events on KmlLayer (clickable: false), or process click events and call the elevation service (using latLng from this click event ).

Here is a working example

+1
source

Source: https://habr.com/ru/post/1440352/


All Articles