Google Maps Basics
Category: /blog /websiteTags: website
I read this book to learn the basics.
Basic skeleton
create a new Map object
var myMap = new google.maps.Map();
To specify a point in maps:
myLocation = new google.maps.LatLng($lat, $lng);
set Zoom: myMap.setZoom(12)
Sample files:
Localization
<script
src="http://maps.googleapis.com/maps/api/js?language=zh-CN">
</script>
The language code list is at https://developers.google.com/maps/faq#languagesupport
<script
src="http://maps.googleapis.com/maps/api/js?region=gr">
</script>
For a list of region codes, visit http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry.
Zooming with mouse
map.enableKeyDragZoom();
hold one of the control keys (SHIFT, CTRL, ALT) and use mouse to draw a rectangle to zoom to this region.
Controls
var options = {
scaleControl: true,
panControl: true/false,
zoomControl: true,
mapTypeControl: true,
streetViewControl: true,
overviewMapControl: true,
}