1+
2+ var google ;
3+
4+ function init ( ) {
5+ // Basic options for a simple Google Map
6+ // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
7+ // var myLatlng = new google.maps.LatLng(40.71751, -73.990922);
8+ var myLatlng = new google . maps . LatLng ( 40.69847032728747 , - 73.9514422416687 ) ;
9+ // 39.399872
10+ // -8.224454
11+
12+ var mapOptions = {
13+ // How zoomed in you want the map to start at (always required)
14+ zoom : 7 ,
15+
16+ // The latitude and longitude to center the map (always required)
17+ center : myLatlng ,
18+
19+ // How you would like to style the map.
20+ scrollwheel : false ,
21+ styles : [
22+ {
23+ "featureType" : "administrative.country" ,
24+ "elementType" : "geometry" ,
25+ "stylers" : [
26+ {
27+ "visibility" : "simplified"
28+ } ,
29+ {
30+ "hue" : "#ff0000"
31+ }
32+ ]
33+ }
34+ ]
35+ } ;
36+
37+
38+
39+ // Get the HTML DOM element that will contain your map
40+ // We are using a div with id="map" seen below in the <body>
41+ var mapElement = document . getElementById ( 'map' ) ;
42+
43+ // Create the Google Map using out element and options defined above
44+ var map = new google . maps . Map ( mapElement , mapOptions ) ;
45+
46+ var addresses = [ 'New York' ] ;
47+
48+ for ( var x = 0 ; x < addresses . length ; x ++ ) {
49+ $ . getJSON ( 'http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses [ x ] + '&sensor=false' , null , function ( data ) {
50+ var p = data . results [ 0 ] . geometry . location
51+ var latlng = new google . maps . LatLng ( p . lat , p . lng ) ;
52+ new google . maps . Marker ( {
53+ position : latlng ,
54+ map : map ,
55+ icon : 'images/loc.png'
56+ } ) ;
57+
58+ } ) ;
59+ }
60+
61+ }
62+ google . maps . event . addDomListener ( window , 'load' , init ) ;
0 commit comments