Data Layer: (Multi)Polygon correct
by Stefano
HTML
<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap">
</script>
CSS
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
JavaScript
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: -25, lng: 135}
});
// NOTE: This uses cross-domain XHR, and may not work on older browsers.
var geojson = {
"type": "Feature",
"properties": {
"stroke": "#F0F",
"stroke-width": 6
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[[
[
115.927734375,
-34.016241889667015
],
[
134.560546875,
-34.016241889667015
],
[
134.560546875,
-16.8886597873816
],
[
115.927734375,
-16.8886597873816
],
[
115.927734375,
-34.016241889667015
]
],
[
[
118.65234374999999,
-30.90222470517144
],
[
131.484375,
-30.90222470517144
],
[
131.484375,
-19.808054128088575
],
[
118.65234374999999,
-19.808054128088575
],
[
118.65234374999999,
-30.90222470517144
]
]],[
[
[
120.9375,
-28.998531814051795
],
[
129.7265625,
-28.998531814051795
],
[
129.7265625,
-22.105998799750566
],
[
120.9375,
-22.105998799750566
],
[
120.9375,
-28.998531814051795
]
],
[
[
123.48632812499999,
-27.137368359795584
],
[
127.44140625,
-27.137368359795584
],
[
127.44140625,
-24.126701958681668
],
[
123.48632812499999,
-24.126701958681668
],
[
123.48632812499999,
-27.137368359795584
]
]
]]
}
}
...