In this example we layout the basic boiler plate code that is used to create a Google Map instance and add a geoScore overlay.
var mapOptions = {
zoom: 12,
center: new google.maps.LatLng(37.8, -122.3),
mapTypeId: google.maps.MapTypeId.ROADMAP
},
map = new google.maps.Map(document.getElementById("map"), mapOptions);
var overlayOptions = {
geography: geoscore.geography.COUNTIES,
opacity: 0.75
},
overlay = geoscore.maps.Overlay(overlayOptions);
The geography option controls what set of shapes will be used in your maps. The current options are:
COUNTIES - Mainland US Counties: 3,111 regions
ZIPCODES - 2013 US Census Zip Code Tabulation Areas, 33,144 regions
US_CENSUS_BLOCKGROUPS - 2010 US Census Blockgroups: 219,774 regions
The opacity option ranges from 0 to 1 and sets the overall or global opaticy of the layer. Opacity for individual colors can be set via a ColorScheme. The opacity can be adjusted using the set_opacity method of the layer.
map.overlayMapTypes.push(overlay);
<html>
<body>
<div style="width:100%; height:500px;" id=map></div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://geoscore.com/static/geoscore.v1.min.js"></script>
<script>
// Step 1 - Create a google map
var mapOptions = {
zoom: 4,
center: new google.maps.LatLng(39.83, -96.0),
mapTypeId: google.maps.MapTypeId.ROADMAP
},
map = new google.maps.Map(document.getElementById("map"), mapOptions);
// Step 2 - Create a geoscore overlay
var myGeography = geoscore.geography.COUNTIES,
overlayOptions = {
geography: myGeography,
opacity: 0.75
},
overlay = geoscore.maps.Overlay(overlayOptions);
// Step 3 - Add overlay to map
map.overlayMapTypes.push(overlay);
</script>
</body>
</html>
See it in action here