The Google Map Javascript API is not only a practical API, but one that gives you access to one of the most powerful (and politically dangerous) mapping technologies available to the public.
The Maps API consists of a function initMap(){}
which begins with an new instance of a google.maps.Map()
(this function defines the position, zoom level, map type, etc). In this example we also utilize the HTML5 geolocation method navigator.geolocation
to determine the user’s location (this requires the user’s consent).
Set up your API Key following these instructions. Google Maps asks to set up billing, but the Map API is free.
A basic map template can be found here.
featureType
, elementType
and stylers
can be found here. Notice that these adopt a JSON-style syntax.For custom controls (and limiting interfaces), you can view documentation here.
Your boilerplate file can be downloaded here.
Working files will be added to the site after class.