html {
height: 100%;
}
body {
height: 100%;
margin: 0px;
padding: 0px;
}
#map_canvas {
height: 100%;
}
JavaScript
var src1 = 'https://raw.githubusercontent.com/piterat/kmlLink/642e292853adc55d34f4105d94cb024fac104db4/NEWYORK_SNOWLOADS.kml';
var elevator;
//var infowindow = new google.maps.InfoWindow();
var geoXml = null;
var map = null;
var geocoder = null;
var toggleState = 1;
var infowindow = null;
var marker = null;
var geoXmlDoc = null;
var contentString = 'Outside Area';
function initialize()
{
geocoder = new google.maps.Geocoder();
infowindow = new google.maps.InfoWindow({size: new google.maps.Size(150,50) });
var latlng = new google.maps.LatLng(42.80,-75.19);
var myOptions = {
zoom: 6,
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
geoXml = new geoXML3.parser({
map: map,
singleInfoWindow: true,
infoWindow: infowindow,
afterParse: useTheData
});
geoXml.parse('https://raw.githubusercontent.com/piterat/kmlLink/642e292853adc55d34f4105d94cb024fac104db4/NEWYORK_SNOWLOADS.kml');
// Create an ElevationService
elevator = new google.maps.ElevationService();
}
function showAddress(address) {
//var contentString = 'Outside Area';
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var point = results[0].geometry.location;
map.setCenter(point);
if (marker && marker.setMap) marker.setMap(null);
marker = new google.maps.Marker({
map: map,
position: point
});
for (var i=0; i<geoXml.docs[0].gpolygons.length; i++) {
if (geoXml.docs[0].gpolygons[i].Contains(point)) {
var snowloadtext = geoXml.docs[0].placemarks[i].name;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.