I have a KML File which is a polygon that overlays the boundaries of a city. Currently my polygon is shaded gray. I would like to invert it, so the rest of the world is greyed out,
Here is a link to the kml, it should take you to Google maps. City of Edmonton
I'm not really sure if this is something I need to change in my KML, or can be accomplished with the Google Maps API.
You need to change your KML. Add an outer boundary to the polygon that covers the whole world. Make sure the winding direction of the outer polygon is opposite the winding direction of the inner polygon.
example (state of Virginia).
Note that KML doesn't seem to work with the Google Maps Javascript API v3 KmlLayer renderer, might need to reverse the winding directions.
code snippet:
function initialize() {
myLatLng = new google.maps.LatLng(37.422104808, -122.0838851);
var myOptions = {
center: {
lat: 37.155939,
lng: -79.497071
},
zoom: 6
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
infowindow = new google.maps.InfoWindow({});
geoXml = new geoXML3.parser({
map: map,
suppressInfoWindows: true,
zoom: false
});
geoXml.parseKmlString(virginia_inverted_kml);
}
google.maps.event.addDomListener(window, 'load', initialize);
var virginia_inverted_kml =
'<kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder id="Fusiontables"><name>Fusiontables folder</name><Style id="BasicStyle"><BalloonStyle><text>$[description]</text></BalloonStyle><IconStyle><color>FFFFFFFF</color><scale>1.1</scale><hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/><Icon><href>http://maps.google.com/mapfiles/kml/paddle/red-blank_maps.png</href></Icon></IconStyle></Style><Placemark><name><![CDATA[ 76 ]]></name><styleUrl>#BasicStyle</styleUrl><description><![CDATA[ <div class="googft-info-window" style="font-family:sans-serif"> <b>objectid:</b> 76<br> <b>vertexcou:</b> 1326.00000000000<br> <b>iso:</b> USA<br> <b>name_0:</b> United States of America<br> <b>name_1:</b> Virginia<br> <b>varname_1:</b> VA<br> <b>hasc_1:</b> US.VA<br> <b>type_1:</b> State<br> <b>engtype_1:</b> State<br> <b>validfr_1:</b> 18630619 </div> ]]></description><MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>180,85 90,85 0,85 -90,85 -180,85 -180,0 -180,-85 -90,-85 0,-85 90,-85 180,-85 180,0 180,85<!-- 180,85 180,0 180,-85 90,-85 0,-85 -90,-85 -180,-85 -180,0 -180,85 -90, 85 0,85 90, 85 180,85 --></coordinates></LinearRing></outerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>-75.914,36.576 -75.909,36.549 -75.927,36.55 -75.943,36.55 -75.942,36.55 -75.949,36.562 -75.932,36.57 -75.914,36.576,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon><Polygon><innerBoundaryIs><LinearRing><coordinates>-75.806,37.23 -75.839,37.228 -75.839,37.234 -75.832,37.234 -75.813,37.244 -75.804,37.264 -75.799,37.285 -75.791,37.303 -75.784,37.303 -75.784,37.27 -75.79,37.245 -75.806,37.23,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon><Polygon><innerBoundaryIs><LinearRing><coordinates>-75.709,37.391 -75.716,37.391 -75.715,37.398 -75.714,37.403 -75.684,37.455 -75.675,37.467 -75.668,37.467 -75.673,37.444 -75.685,37.423 -75.709,37.391,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon><Polygon><innerBoundaryIs><LinearRing><coordinates>-75.423,37.912 -75.441,37.906 -75.43,37.886 -75.438,37.87 -75.476,37.837 -75.558,37.707 -75.57,37.671 -75.589,37.641 -75.603,37.611 -75.608,37.585 -75.592,37.576 -75.603,37.554 -75.621,37.531 -75.641,37.51 -75.661,37.495 -75.67,37.507 -75.681,37.517 -75.69,37.528 -75.694,37.545 -75.701,37.558 -75.717,37.552 -75.733,37.536 -75.743,37.522 -75.729,37.518 -75.714,37.516 -75.702,37.512 -75.694,37.501 -75.771,37.49 -75.784,37.484 -75.788,37.476 -75.807,37.454 -75.812,37.443 -75.81,37.426 -75.809,37.418 -75.81,37.411 -75.819,37.398 -75.84,37.375 -75.845,37.364 -75.849,37.352 -75.857,37.262 -75.864,37.238 -75.873,37.22 -75.869,37.212 -75.865,37.19 -75.86,37.179 -75.883,37.17 -75.89,37.182 -75.886,37.224 -75.891,37.228 -75.9,37.223 -75.91,37.213 -75.914,37.203 -75.919,37.168 -75.922,37.159 -75.934,37.144 -75.95,37.139 -75.963,37.146 -75.968,37.169 -75.976,37.189 -76.001,37.22 -75.996,37.234 -75.996,37.24 -76.017,37.258 -76.015,37.282 -76.0,37.304 -75.982,37.316 -75.996,37.32 -76.001,37.32 -76.01,37.316 -75.991,37.353 -75.985,37.372 -75.99,37.385 -75.974,37.392 -75.962,37.403 -75.956,37.416 -75.955,37.426 -75.956,37.425 -75.962,37.426 -75.966,37.425 -75.968,37.418 -75.976,37.418 -75.973,37.435 -75.966,37.453 -75.954,37.467 -75.926,37.478 -75.925,37.489 -75.934,37.495 -75.955,37.487 -75.952,37.516 -75.938,37.537 -75.917,37.553 -75.894,37.563 -75.935,37.576 -75.921,37.586 -75.911,37.595 -75.909,37.603 -75.922,37.611 -75.904,37.62 -75.883,37.624 -75.871,37.63 -75.886,37.645 -75.876,37.661 -75.861,37.669 -75.842,37.672 -75.819,37.673 -75.825,37.688 -75.824,37.697 -75.789,37.728 -75.79,37.733 -75.812,37.734 -75.812,37.741 -75.791,37.754 -75.777,37.767 -75.778,37.78 -75.798,37.796 -75.787,37.809 -75.775,37.808 -75.764,37.801 -75.753,37.796 -75.694,37.802 -75.704,37.811 -75.708,37.822 -75.708,37.833 -75.702,37.843 -75.695,37.845 -75.671,37.842 -75.661,37.843 -75.669,37.852 -75.674,37.862 -75.674,37.87 -75.668,37.878 -75.671,37.893 -75.689,37.904 -75.717,37.91 -75.743,37.906 -75.743,37.912 -75.719,37.928 -75.694,37.94 -75.662,37.945 -75.646,37.95 -75.633,37.96 -75.643,37.964 -75.635,37.978 -75.627,37.993 -75.62,37.998 -75.595,38.001 -75.552,38.005 -75.518,38.009 -75.469,38.014 -75.424,38.019 -75.396,38.022 -75.375,38.024 -75.378,38.012 -75.391,38.003 -75.407,37.997 -75.421,37.988 -75.426,37.977 -75.428,37.961 -75.428,37.936 -75.424,37.924 -75.42,37.917 -75.423,37.912,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon><Polygon><innerBoundaryIs><LinearRing><coordinates>-75.326,37.892 -75.354,37.872 -75.387,37.871 -75.387,37.878 -75.376,37.877 -75.365,37.878 -75.355,37.881 -75.346,37.884 -75.36,37.9 -75.366,37.908 -75.363,37.912 -75.35,37.913 -75.339,37.916 -75.33,37.923 -75.325,37.933 -75.318,37.94 -75.305,37.974 -75.297,37.985 -75.278,38.008 -75.254,38.031 -75.251,38.037 -75.244,38.038 -75.234,38.039 -75.302,37.922 -75.326,37.892,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon><Polygon><innerBoundaryIs><LinearRing><coordinates>-77.844,39.15 -77.836,39.144 -77.829,39.156 -77.823,39.169 -77.807,39.198 -77.782,39.244 -77.765,39.275 -77.743,39.315 -77.737,39.327 -77.735,39.331 -77.715,39.324 -77.664,39.324 -77.646,39.321 -77.604,39.308 -77.558,39.299 -77.547,39.291 -77.528,39.266 -77.509,39.256 -77.487,39.251 -77.467,39.244 -77.456,39.228 -77.46,39.208 -77.474,39.192 -77.507,39.169 -77.515,39.153 -77.509,39.137 -77.496,39.124 -77.481,39.113 -77.445,39.085 -77.422,39.074 -77.334,39.068 -77.302,39.06 -77.272,39.048 -77.25,39.03 -77.244,39.016 -77.24,39.0 -77.233,38.987 -77.22,38.981 -77.205,38.979 -77.172,38.97 -77.141,38.965 -77.13,38.957 -77.118,38.945 -77.113,38.94 -77.075,38.915 -77.066,38.906 -77.066,38.906 -77.066,38.906 -77.048,38.884 -77.044,38.878 -77.039,38.867 -77.038,38.862 -77.038,38.759 -77.042,38.734 -77.053,38.726 -77.069,38.721 -77.089,38.711 -77.099,38.707 -77.109,38.708 -77.117,38.706 -77.124,38.687 -77.131,38.687 -77.136,38.694 -77.134,38.707 -77.151,38.705 -77.161,38.695 -77.161,38.683 -77.154,38.673 -77.138,38.665 -77.139,38.655 -77.149,38.646 -77.162,38.638 -77.179,38.632 -77.189,38.632 -77.194,38.639 -77.195,38.656 -77.202,38.665 -77.216,38.665 -77.23,38.657 -77.236,38.642 -77.239,38.626 -77.247,38.609 -77.259,38.594 -77.272,38.584 -77.267,38.581 -77.263,38.575 -77.258,38.57 -77.276,38.559 -77.285,38.557 -77.285,38.549 -77.287,38.53 -77.302,38.493 -77.314,38.45 -77.305,38.413 -77.324,38.433 -77.337,38.44 -77.353,38.433 -77.342,38.421 -77.306,38.392 -77.299,38.382 -77.287,38.37 -77.285,38.362 -77.295,38.358 -77.329,38.36 -77.34,38.358 -77.34,38.351 -77.292,38.347 -77.25,38.337 -77.185,38.344 -77.167,38.348 -77.133,38.367 -77.085,38.379 -77.058,38.394 -77.035,38.403 -77.011,38.392 -77.003,38.381 -76.998,38.365 -76.998,38.348 -77.007,38.334 -77.014,38.331 -77.023,38.33 -77.041,38.331 -77.047,38.328 -77.042,38.321 -77.032,38.315 -77.028,38.313 -76.983,38.275 -76.975,38.271 -76.965,38.267 -76.956,38.263 -76.949,38.254 -76.948,38.247 -76.951,38.241 -76.953,38.235 -76.94,38.21 -76.901,38.193 -76.852,38.178 -76.812,38.172 -76.791,38.172 -76.772,38.168 -76.756,38.161 -76.75,38.148 -76.739,38.137 -76.715,38.142 -76.691,38.153 -76.681,38.159 -76.67,38.158 -76.662,38.153 -76.655,38.148 -76.647,38.145 -76.635,38.145 -76.614,38.15 -76.603,38.152 -76.594,38.149 -76.592,38.142 -76.593,38.121 -76.589,38.116 -76.565,38.098 -76.531,38.079 -76.518,38.066 -76.521,38.053 -76.533,38.043 -76.532,38.039 -76.53,38.025 -76.526,38.023 -76.49,38.029 -76.478,38.026 -76.467,38.021 -76.457,38.015 -76.449,38.008 -76.454,38.006 -76.462,38.002 -76.469,38.001 -76.459,37.996 -76.41,37.981 -76.373,37.961 -76.281,37.933 -76.261,37.924 -76.244,37.914 -76.236,37.902 -76.236,37.86 -76.24,37.836 -76.25,37.823 -76.268,37.825 -76.299,37.851 -76.315,37.858 -76.325,37.849 -76.318,37.829 -76.298,37.796 -76.294,37.781 -76.294,37.772 -76.298,37.761 -76.305,37.748 -76.309,37.746 -76.316,37.748 -76.322,37.748 -76.325,37.744 -76.317,37.732 -76.285,37.711 -76.284,37.699 -76.292,37.695 -76.304,37.694 -76.316,37.696 -76.325,37.699 -76.32,37.686 -76.325,37.68 -76.334,37.676 -76.339,37.669 -76.335,37.659 -76.321,37.644 -76.318,37.637 -76.305,37.638 -76.321,37.624 -76.349,37.628 -76.405,37.645 -76.409,37.65 -76.419,37.66 -76.43,37.667 -76.435,37.662 -76.439,37.663 -76.446,37.671 -76.454,37.684 -76.456,37.693 -76.469,37.709 -76.479,37.695 -76.49,37.658 -76.505,37.657 -76.517,37.669 -76.524,37.688 -76.524,37.699 -76.535,37.716 -76.571,37.751 -76.579,37.771 -76.583,37.777 -76.613,37.796 -76.618,37.804 -76.622,37.814 -76.628,37.818 -76.64,37.809 -76.649,37.813 -76.658,37.819 -76.662,37.829 -76.661,37.843 -76.674,37.833 -76.688,37.832 -76.701,37.837 -76.713,37.847 -76.75,37.895 -76.764,37.927 -76.825,37.953 -76.839,37.984 -76.879,38.008 -76.887,38.015 -76.915,38.07 -76.935,38.094 -76.947,38.103 -76.963,38.111 -77.007,38.118 -77.017,38.117 -77.027,38.129 -77.036,38.145 -77.047,38.16 -77.062,38.166 -77.107,38.175 -77.126,38.176 -77.134,38.166 -77.127,38.156 -77.109,38.149 -77.076,38.145 -77.063,38.15 -77.055,38.15 -77.052,38.142 -77.051,38.129 -77.047,38.119 -77.041,38.111 -77.031,38.104 -76.96,38.09 -76.949,38.08 -76.945,38.075 -76.926,38.059 -76.922,38.053 -76.913,37.996 -76.911,37.991 -76.901,37.981 -76.892,37.974 -76.88,37.97 -76.87,37.965 -76.861,37.942 -76.847,37.929 -76.831,37.918 -76.819,37.912 -76.787,37.903 -76.78,37.894 -76.778,37.874 -76.773,37.864 -76.749,37.83 -76.74,37.823 -76.736,37.82 -76.726,37.807 -76.722,37.802 -76.699,37.796 -76.688,37.79 -76.684,37.789 -76.68,37.79 -76.675,37.789 -76.674,37.785 -76.676,37.772 -76.675,37.768 -76.63,37.761 -76.62,37.757 -76.593,37.735 -76.586,37.727 -76.58,37.698 -76.579,37.696 -76.577,37.688 -76.568,37.67 -76.553,37.648 -76.541,37.636 -76.525,37.629 -76.463,37.619 -76.443,37.619 -76.428,37.624 -76.404,37.594 -76.368,37.584 -76.325,37.581 -76.284,37.57 -76.302,37.558 -76.319,37.553 -76.366,37.549 -76.393,37.542 -76.393,37.533 -76.378,37.525 -76.356,37.522 -76.323,37.501 -76.301,37.494 -76.292,37.504 -76.286,37.526 -76.272,37.524 -76.243,37.501 -76.243,37.495 -76.254,37.49 -76.268,37.481 -76.277,37.471 -76.277,37.46 -76.267,37.453 -76.256,37.453 -76.244,37.45 -76.236,37.432 -76.237,37.401 -76.261,37.346 -76.264,37.316 -76.27,37.316 -76.278,37.33 -76.319,37.371 -76.322,37.386 -76.333,37.385 -76.348,37.38 -76.366,37.385 -76.396,37.43 -76.415,37.443 -76.428,37.418 -76.417,37.415 -76.409,37.408 -76.404,37.399 -76.401,37.391 -76.412,37.395 -76.422,37.398 -76.433,37.397 -76.442,37.391 -76.447,37.38 -76.443,37.372 -76.416,37.356 -76.408,37.354 -76.403,37.35 -76.401,37.34 -76.406,37.338 -76.435,37.329 -76.435,37.323 -76.403,37.325 -76.394,37.323 -76.386,37.315 -76.377,37.301 -76.372,37.288 -76.377,37.282 -76.456,37.268 -76.475,37.273 -76.513,37.297 -76.543,37.306 -76.552,37.32 -76.562,37.323 -76.574,37.325 -76.582,37.331 -76.642,37.409 -76.658,37.418 -76.681,37.428 -76.7,37.449 -76.73,37.495 -76.781,37.536 -76.79,37.533 -76.795,37.526 -76.798,37.516 -76.798,37.504 -76.794,37.498 -76.785,37.495 -76.774,37.491 -76.765,37.487 -76.722,37.427 -76.691,37.411 -76.676,37.395 -76.655,37.364 -76.596,37.308 -76.53,37.262 -76.49,37.24 -76.466,37.231 -76.445,37.228 -76.403,37.234 -76.386,37.233 -76.373,37.22 -76.376,37.218 -76.378,37.207 -76.38,37.195 -76.38,37.185 -76.373,37.176 -76.362,37.167 -76.351,37.164 -76.346,37.176 -76.317,37.16 -76.298,37.145 -76.292,37.13 -76.303,37.126 -76.326,37.114 -76.339,37.102 -76.322,37.096 -76.281,37.104 -76.27,37.098 -76.27,37.069 -76.274,37.048 -76.283,37.028 -76.296,37.014 -76.315,37.008 -76.34,37.007 -76.357,37.005 -76.371,36.999 -76.399,36.978 -76.415,36.973 -76.429,36.976 -76.44,37.016 -76.453,37.03 -76.541,37.093 -76.559,37.092 -76.581,37.106 -76.601,37.124 -76.613,37.138 -76.62,37.145 -76.611,37.173 -76.617,37.199 -76.634,37.221 -76.655,37.234 -76.669,37.227 -76.711,37.224 -76.73,37.22 -76.735,37.213 -76.739,37.203 -76.744,37.198 -76.754,37.203 -76.758,37.211 -76.762,37.222 -76.767,37.23 -76.774,37.234 -76.792,37.237 -76.829,37.251 -76.843,37.254 -76.855,37.263 -76.857,37.282 -76.856,37.305 -76.86,37.323 -76.87,37.316 -76.873,37.305 -76.873,37.279 -76.878,37.269 -76.889,37.259 -76.908,37.248 -76.931,37.245 -76.944,37.256 -76.953,37.274 -76.982,37.312 -76.99,37.32 -77.003,37.323 -77.014,37.319 -77.045,37.298 -77.052,37.292 -77.055,37.287 -77.063,37.297 -77.07,37.31 -77.072,37.316 -77.083,37.325 -77.091,37.328 -77.1,37.327 -77.113,37.323 -77.134,37.317 -77.144,37.316 -77.155,37.318 -77.173,37.327 -77.178,37.329 -77.22,37.329 -77.235,37.334 -77.25,37.35 -77.278,37.329 -77.274,37.316 -77.265,37.311 -77.255,37.309 -77.25,37.306 -77.239,37.309 -77.175,37.288 -77.089,37.288 -77.083,37.283 -77.076,37.273 -77.067,37.267 -77.055,37.271 -77.025,37.292 -77.017,37.295 -76.995,37.288 -76.986,37.269 -76.982,37.249 -76.973,37.24 -76.951,37.235 -76.913,37.213 -76.894,37.207 -76.802,37.207 -76.788,37.2 -76.755,37.169 -76.737,37.159 -76.717,37.161 -76.689,37.189 -76.675,37.193 -76.668,37.182 -76.655,37.124 -76.654,37.063 -76.647,37.049 -76.632,37.041 -76.571,37.028 -76.571,37.022 -76.581,37.016 -76.584,37.014 -76.586,37.008 -76.58,37.004 -76.566,37.003 -76.558,37.0 -76.551,36.997 -76.537,36.987 -76.476,36.96 -76.476,36.953 -76.493,36.944 -76.491,36.933 -76.482,36.922 -76.476,36.908 -76.482,36.899 -76.496,36.887 -76.524,36.871 -76.524,36.863 -76.497,36.865 -76.476,36.875 -76.456,36.888 -76.435,36.898 -76.409,36.902 -76.381,36.901 -76.354,36.894 -76.333,36.884 -76.335,36.872 -76.325,36.861 -76.308,36.852 -76.292,36.85 -76.31,36.871 -76.318,36.884 -76.315,36.895 -76.301,36.912 -76.306,36.918 -76.317,36.923 -76.319,36.939 -76.299,36.958 -76.264,36.958 -76.169,36.928 -76.118,36.925 -76.078,36.912 -76.046,36.912 -76.018,36.919 -75.994,36.917 -75.976,36.891 -75.956,36.808 -75.863,36.591 -75.853,36.549 -75.867,36.549 -75.88,36.549 -75.886,36.563 -75.884,36.574 -75.88,36.585 -75.88,36.596 -75.884,36.605 -75.896,36.617 -75.901,36.624 -75.922,36.695 -75.928,36.706 -75.935,36.712 -75.947,36.719 -75.958,36.72 -75.963,36.709 -75.976,36.606 -75.968,36.552 -75.967,36.55 -76.013,36.55 -76.045,36.59 -76.044,36.576 -76.04,36.567 -76.035,36.56 -76.032,36.55 -76.058,36.55 -76.206,36.551 -76.381,36.553 -76.555,36.554 -76.73,36.556 -76.905,36.557 -77.079,36.558 -77.254,36.56 -77.429,36.561 -77.603,36.562 -77.778,36.564 -77.952,36.565 -78.127,36.567 -78.302,36.568 -78.476,36.569 -78.651,36.571 -78.825,36.572 -79.0,36.573 -79.175,36.575 -79.349,36.576 -79.524,36.577 -79.699,36.579 -79.873,36.58 -80.048,36.582 -80.222,36.583 -80.397,36.584 -80.572,36.586 -80.746,36.587 -80.921,36.588 -81.095,36.59 -81.27,36.591 -81.445,36.592 -81.619,36.594 -81.642,36.594 -81.648,36.596 -81.652,36.599 -81.659,36.61 -81.752,36.613 -81.837,36.615 -81.905,36.618 -81.914,36.617 -81.923,36.615 -81.945,36.6 -81.952,36.597 -82.001,36.597 -82.105,36.598 -82.209,36.598 -82.313,36.598 -82.417,36.599 -82.522,36.599 -82.626,36.6 -82.73,36.6 -82.834,36.601 -82.938,36.601 -83.042,36.601 -83.147,36.602 -83.251,36.602 -83.355,36.603 -83.459,36.603 -83.563,36.604 -83.667,36.604 -83.623,36.635 -83.604,36.642 -83.597,36.643 -83.509,36.669 -83.413,36.676 -83.402,36.679 -83.395,36.683 -83.382,36.691 -83.342,36.709 -83.24,36.737 -83.137,36.75 -83.129,36.753 -83.123,36.757 -83.121,36.762 -83.121,36.767 -83.123,36.776 -83.122,36.78 -83.12,36.783 -83.108,36.794 -83.101,36.802 -83.082,36.835 -83.062,36.852 -83.056,36.855 -83.05,36.856 -83.007,36.856 -82.945,36.876 -82.884,36.894 -82.869,36.901 -82.865,36.905 -82.862,36.909 -82.859,36.914 -82.857,36.919 -82.855,36.924 -82.854,36.939 -82.854,36.95 -82.855,36.955 -82.855,36.972 -82.849,36.98 -82.839,36.988 -82.815,37.003 -82.727,37.038 -82.717,37.043 -82.712,37.047 -82.709,37.052 -82.707,37.057 -82.705,37.063 -82.704,37.069 -82.705,37.091 -82.709,37.107 -82.708,37.113 -82.7,37.123 -82.682,37.137 -82.633,37.164 -82.527,37.206 -82.448,37.237 -82.376,37.265 -82.351,37.279 -82.265,37.337 -82.169,37.401 -82.107,37.443 -82.021,37.501 -81.965,37.539 -81.957,37.532 -81.954,37.528 -81.951,37.523 -81.95,37.518 -81.95,37.512 -81.951,37.507 -81.952,37.503 -81.953,37.501 -81.954,37.5 -81.978,37.485 -81.981,37.481 -81.984,37.477 -81.984,37.472 -81.982,37.468 -81.978,37.465 -81.942,37.446 -81.938,37.443 -81.935,37.44 -81.933,37.436 -81.931,37.431 -81.93,37.426 -81.929,37.421 -81.929,37.415 -81.933,37.391 -81.933,37.385 -81.933,37.38 -81.931,37.375 -81.927,37.371 -81.923,37.367 -81.875,37.34 -81.866,37.334 -81.862,37.33 -81.859,37.326 -81.851,37.307 -81.848,37.303 -81.844,37.299 -81.835,37.292 -81.824,37.286 -81.82,37.286 -81.807,37.285 -81.793,37.285 -81.772,37.283 -81.763,37.281 -81.757,37.278 -81.752,37.275 -81.747,37.272 -81.744,37.268 -81.73,37.252 -81.722,37.244 -81.717,37.241 -81.682,37.227 -81.657,37.212 -81.645,37.209 -81.584,37.205 -81.56,37.206 -81.553,37.209 -81.546,37.213 -81.494,37.257 -81.487,37.261 -81.479,37.264 -81.464,37.268 -81.424,37.271 -81.417,37.274 -81.409,37.28 -81.397,37.291 -81.391,37.298 -81.387,37.306 -81.38,37.322 -81.377,37.326 -81.372,37.331 -81.364,37.335 -81.351,37.335 -81.343,37.334 -81.337,37.331 -81.332,37.327 -81.313,37.304 -81.307,37.299 -81.302,37.296 -81.25,37.27 -81.242,37.264 -81.238,37.261 -81.235,37.257 -81.232,37.25 -81.229,37.247 -81.227,37.245 -81.224,37.244 -81.213,37.247 -81.132,37.28 -81.028,37.291 -81.02,37.293 -80.992,37.304 -80.983,37.305 -80.975,37.304 -80.961,37.295 -80.955,37.294 -80.948,37.295 -80.882,37.326 -80.877,37.33 -80.871,37.336 -80.865,37.346 -80.864,37.353 -80.864,37.359 -80.879,37.38 -80.881,37.385 -80.881,37.391 -80.881,37.397 -80.879,37.402 -80.876,37.407 -80.873,37.412 -80.867,37.417 -80.86,37.421 -80.846,37.425 -80.836,37.426 -80.827,37.425 -80.799,37.42 -80.796,37.419 -80.793,37.417 -80.791,37.415 -80.791,37.407 -80.789,37.403 -80.784,37.401 -80.767,37.398 -80.762,37.396 -80.758,37.393 -80.755,37.39 -80.753,37.386 -80.75,37.384 -80.747,37.382 -80.744,37.382 -80.736,37.383 -80.731,37.385 -80.686,37.407 -80.641,37.428 -80.593,37.446 -80.551,37.462 -80.528,37.468 -80.504,37.47 -80.497,37.47 -80.487,37.468 -80.483,37.464 -80.482,37.46 -80.481,37.457 -80.481,37.448 -80.481,37.443 -80.479,37.438 -80.476,37.434 -80.473,37.431 -80.468,37.429 -80.463,37.428 -80.458,37.428 -80.452,37.429 -80.446,37.433 -80.416,37.454 -80.294,37.509 -80.29,37.514 -80.286,37.519 -80.286,37.53 -80.29,37.535 -80.301,37.541 -80.305,37.544 -80.308,37.548 -80.309,37.553 -80.309,37.557 -80.306,37.564 -80.302,37.571 -80.291,37.579 -80.284,37.584 -80.277,37.587 -80.261,37.593 -80.24,37.604 -80.231,37.611 -80.227,37.615 -80.225,37.622 -80.226,37.631 -80.229,37.636 -80.233,37.64 -80.262,37.651 -80.273,37.657 -80.286,37.667 -80.288,37.669 -80.289,37.671 -80.289,37.675 -80.285,37.685 -80.248,37.739 -80.22,37.782 -80.217,37.789 -80.208,37.812 -80.207,37.815 -80.164,37.853 -80.129,37.885 -80.087,37.923 -80.032,37.973 -80.0,38.002 -79.967,38.053 -79.943,38.089 -79.921,38.145 -79.92,38.151 -79.922,38.161 -79.922,38.169 -79.92,38.174 -79.917,38.179 -79.87,38.213 -79.848,38.235 -79.838,38.242 -79.816,38.254 -79.799,38.268 -79.795,38.274 -79.792,38.28 -79.793,38.285 -79.794,38.29 -79.798,38.3 -79.799,38.305 -79.797,38.315 -79.792,38.322 -79.782,38.332 -79.777,38.341 -79.773,38.35 -79.769,38.355 -79.765,38.359 -79.746,38.364 -79.736,38.369 -79.731,38.375 -79.721,38.405 -79.716,38.413 -79.699,38.43 -79.695,38.437 -79.693,38.442 -79.691,38.484 -79.689,38.498 -79.688,38.501 -79.669,38.522 -79.665,38.529 -79.663,38.535 -79.663,38.54 -79.663,38.545 -79.662,38.553 -79.66,38.563 -79.654,38.58 -79.649,38.588 -79.642,38.592 -79.636,38.592 -79.552,38.568 -79.55,38.566 -79.547,38.564 -79.544,38.561 -79.505,38.505 -79.502,38.501 -79.502,38.499 -79.502,38.496 -79.503,38.492 -79.507,38.484 -79.508,38.481 -79.507,38.48 -79.504,38.479 -79.458,38.467 -79.412,38.455 -79.36,38.441 -79.297,38.425 -79.29,38.424 -79.284,38.427 -79.28,38.43 -79.245,38.469 -79.22,38.496 -79.202,38.515 -79.196,38.524 -79.19,38.534 -79.176,38.568 -79.175,38.571 -79.173,38.575 -79.173,38.577 -79.171,38.58 -79.162,38.613 -79.159,38.619 -79.155,38.626 -79.146,38.637 -79.136,38.645 -79.125,38.652 -79.11,38.659 -79.103,38.664 -79.098,38.668 -79.096,38.672 -79.086,38.729 -79.084,38.735 -79.079,38.743 -79.061,38.762 -79.057,38.769 -79.054,38.775 -79.053,38.78 -79.048,38.788 -79.041,38.797 -78.999,38.842 -78.994,38.846 -78.988,38.846 -78.959,38.83 -78.916,38.806 -78.881,38.787 -78.874,38.785 -78.868,38.788 -78.862,38.793 -78.833,38.827 -78.797,38.869 -78.766,38.904 -78.743,38.93 -78.738,38.933 -78.733,38.933 -78.729,38.93 -78.726,38.927 -78.724,38.923 -78.72,38.919 -78.716,38.917 -78.711,38.916 -78.705,38.916 -78.697,38.917 -78.674,38.926 -78.666,38.93 -78.661,38.934 -78.654,38.943 -78.643,38.96 -78.637,38.969 -78.631,38.972 -78.623,38.975 -78.613,38.977 -78.596,38.981 -78.588,38.985 -78.581,38.99 -78.556,39.016 -78.55,39.024 -78.55,39.028 -78.55,39.031 -78.552,39.035 -78.551,39.039 -78.549,39.043 -78.532,39.064 -78.493,39.101 -78.453,39.126 -78.42,39.157 -78.416,39.162 -78.414,39.166 -78.413,39.171 -78.414,39.176 -78.418,39.19 -78.419,39.195 -78.419,39.201 -78.418,39.207 -78.416,39.213 -78.41,39.229 -78.409,39.235 -78.408,39.24 -78.409,39.251 -78.41,39.255 -78.411,39.26 -78.411,39.264 -78.409,39.269 -78.407,39.273 -78.404,39.278 -78.373,39.312 -78.359,39.331 -78.354,39.342 -78.353,39.348 -78.351,39.359 -78.351,39.37 -78.357,39.4 -78.358,39.41 -78.355,39.418 -78.35,39.428 -78.336,39.445 -78.322,39.451 -78.306,39.441 -78.25,39.405 -78.193,39.37 -78.137,39.334 -78.081,39.299 -78.024,39.263 -77.968,39.228 -77.911,39.192 -77.855,39.157 -77.844,39.15,0.0</coordinates></LinearRing></innerBoundaryIs></Polygon></MultiGeometry><ExtendedData><Data name="objectid"><value>76</value></Data><Data name="vertexcou"><value>1326.00000000000</value></Data><Data name="iso"><value>USA</value></Data><Data name="name_0"><value>United States of America</value></Data><Data name="name_1"><value>Virginia</value></Data><Data name="varname_1"><value>VA</value></Data><Data name="hasc_1"><value>US.VA</value></Data><Data name="type_1"><value>State</value></Data><Data name="engtype_1"><value>State</value></Data><Data name="validfr_1"><value>18630619</value></Data><Data name="validto_1"><value>Present</value></Data><Data name="provnumber"><value>12</value></Data><Data name="nev_countr"><value>United States</value></Data><Data name="fips_1"><value>US51</value></Data><Data name="gadm_level"><value>1.00000000000</value></Data><Data name="checkme"><value>0</value></Data><Data name="region_cod"><value>South</value></Data><Data name="region_c_1"><value>South Atlantic</value></Data><Data name="scalerank"><value>0</value></Data><Data name="region_c_2"><value/></Data><Data name="region_c_3"><value/></Data><Data name="country_pr"><value/></Data><Data name="datarank"><value>1</value></Data><Data name="abbrev"><value>Va.</value></Data><Data name="postal"><value>VA</value></Data><Data name="area_sqkm"><value>102867.50000000000</value></Data><Data name="sameascity"><value>-99</value></Data><Data name="adm0_a3"><value>USA</value></Data><Data name="map_color"><value>1</value></Data><Data name="labelrank"><value>0</value></Data><Data name="shape_leng"><value>33.74785311850</value></Data><Data name="shape_area"><value>10.48663802590</value></Data><Data name="Inverted_kml_4326"><value/></Data></ExtendedData></Placemark></Folder></Document></kml>'
html,
body,
#map_canvas {
height: 100%;
width: 100%;
padding: 0px;
margin: 0px;
}
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&libraries=places"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/geocodezip/geoxml3#master/polys/geoxml3.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/geocodezip/geoxml3#master/ProjectedOverlay.js"></script>
<div id="map_canvas"></div>
Now google maps provide method addGeoJson to the map so it's better to convert KML to geojson
you can this tool for this step
https://mapbox.github.io/togeojson/
Then in the coordinates array add this array as a first input in coordinates
[
[0, 90],
[180, 90],
[180, -90],
[0, -90],
[-180, -90],
[-180, 0],
[-180, 90],
[0, 90]
]
It'll do the inversions and you can find examples here
https://github.com/minaalfy/city-map