<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple markers</title>
    <style>
      html, body, #map-canvas {
        height: 90%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
          function initialize() {
            var vm = this;
            var mapOptions = {
              center: new google.maps.LatLng(52.4847007,6.4848079),
                  zoom: 9,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
              var vm = this;
                map.data.setStyle(function(feature) {
                  var color;
                    if (feature.getProperty('isColorful')) {
                      color = '#009900';
                    }else{
                      color: 'grey';
                    }
                    return /** @type {google.maps.Data.StyleOptions} */({
                      fillColor: color,
                      strokeColor: color,
                      strokeWeight: 2
                    });
                });
          
                map.data.addListener('click', function(event) {
                  event.feature.setProperty('isColorful', true);
                   var name = event.feature.getProperty('name'); 
                  
                    var index = vm.areas.indexOf(name);
                      if(index >= 0){
                        vm.areas.splice(index,1);
                      } else{
                        vm.areas.push(name);
                      }
                      $scope.$apply();
                });
          
                  vm.loadDiggit = function(filename){
                    var promise = $.getJSON(filename);
                      promise.then(function(data){
                        cachedGeoJson = data;
                        map.data.forEach(function(feature) {
                          map.data.remove(feature);
                        });
                        map.data.addGeoJson(cachedGeoJson);
                      })
                  }
          
          }

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
    <script data-require="angular.js@1.4.0" data-semver="1.4.0" src="https://code.angularjs.org/1.4.0/angular.js"></script>
  </head>
  <body>
    <div id="map-canvas"></div>
      <button class="btn btn green" ng-click="vm.loadDiggit('diggitne.geojson')"> Diggit one</button>
      <button class="btn btn green" ng-click="vm.loadDiggit('diggitTwo.geojson')">Diggit two</button>
  </body>
</html>
// Code goes here

/* Styles go here */

{
	"type": "FeatureCollection",
	"features": [
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							5.795082,
							52.806593
						],
						[
							5.977159,
							52.500487
						],
						[
							6.417051,
							52.520692
						],
						[
							6.338356,
							52.790868
						],
						[
							5.795082,
							52.806593
						]
					]
				]
			},
			"properties": {
				"name": "DiggitTwoOne",
				"regioFacetId": "tcm:106-353682-1024",
				"level": 3
			}
		}
	]
}
{
	"type": "FeatureCollection",
	"features": [
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							6.338356,
							52.790868
						],
						[
							6.378572,
							52.648089
						],
						[
							6.10522,
							52.663572
						],
						[
							6.089325,
							52.798539
						],
						[
							6.338356,
							52.790868
						]
					]
				]
			},
			"properties": {
				"name": "DiggitTwoOne",
				"regioFacetId": "tcm:106-353682-1024",
				"level": 3
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							6.105498,
							52.663816
						],
						[
							6.378605,
							52.648187
						],
						[
							6.417051,
							52.520692
						],
						[
							6.173867,
							52.509454
						],
						[
							6.105498,
							52.663816
						]
					]
				]
			},
			"properties": {
				"name": "DiggitTwoTwo",
				"regioFacetId": "tcm:106-353682-1024",
				"level": 3
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							6.105498,
							52.663816
						],
						[
							6.173867,
							52.509454
						],
						[
							5.976935,
							52.500118
						],
						[
							5.8824,
							52.66016
						],
						[
							6.105498,
							52.663816
						]
					]
				]
			},
			"properties": {
				"name": "DiggitTwoThree",
				"regioFacetId": "tcm:106-353682-1024",
				"level": 3
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							6.105498,
							52.663816
						],
						[
							5.8824,
							52.66016
						],
						[
							5.795391,
							52.806868
						],
						[
							6.089325,
							52.798539
						],
						[
							6.105498,
							52.663816
						]
					]
				]
			},
			"properties": {
				"name": "DiggitTwoFour",
				"regioFacetId": "tcm:106-353682-1024",
				"level": 3
			}
		}
	]
}