Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

49 строки
3.2 KiB

  1. var google;
  2. function init() {
  3. // Basic options for a simple Google Map
  4. // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
  5. // var myLatlng = new google.maps.LatLng(40.71751, -73.990922);
  6. var myLatlng = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
  7. // 39.399872
  8. // -8.224454
  9. var mapOptions = {
  10. // How zoomed in you want the map to start at (always required)
  11. zoom: 7,
  12. // The latitude and longitude to center the map (always required)
  13. center: myLatlng,
  14. // How you would like to style the map.
  15. scrollwheel: false,
  16. styles: [{"featureType": "all","elementType": "geometry.fill","stylers": [{"weight": "2.00"}]},{"featureType": "all","elementType": "geometry.stroke","stylers": [{"color": "#9c9c9c"}]},{"featureType": "all","elementType": "labels.text","stylers": [{"visibility": "on"}]},{"featureType": "landscape","elementType": "all","stylers": [{"color": "#f2f2f2"}]},{"featureType": "landscape","elementType": "geometry.fill","stylers": [{"color": "#ffffff"}]},{"featureType": "landscape.man_made","elementType": "geometry.fill","stylers": [{"color": "#ffffff"}]},{"featureType": "poi","elementType": "all","stylers": [{"visibility": "off"}]},{"featureType": "road","elementType": "all","stylers": [{"saturation": -100},{"lightness": 45}]},{"featureType": "road","elementType": "geometry.fill","stylers": [{"color": "#eeeeee"}]},{"featureType": "road","elementType": "labels.text.fill","stylers": [{"color": "#7b7b7b"}]},{"featureType": "road","elementType": "labels.text.stroke","stylers": [{"color": "#ffffff"}]},{"featureType": "road.highway","elementType": "all","stylers": [{"visibility": "simplified"}]},{"featureType": "road.arterial","elementType": "labels.icon","stylers": [{"visibility": "off"}]},{"featureType": "transit","elementType": "all","stylers": [{"visibility": "off"}]},{"featureType": "water","elementType": "all","stylers": [{"color": "#46bcec"},{"visibility": "on"}]},{"featureType": "water","elementType": "geometry.fill","stylers": [{"color": "#c8d7d4"}]},{"featureType": "water","elementType": "labels.text.fill","stylers": [{"color": "#070707"}]},{"featureType": "water","elementType": "labels.text.stroke","stylers": [{"color": "#ffffff"}]}]
  17. };
  18. // Get the HTML DOM element that will contain your map
  19. // We are using a div with id="map" seen below in the <body>
  20. var mapElement = document.getElementById('map');
  21. // Create the Google Map using out element and options defined above
  22. var map = new google.maps.Map(mapElement, mapOptions);
  23. var addresses = ['New York'];
  24. for (var x = 0; x < addresses.length; x++) {
  25. $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address='+addresses[x]+'&sensor=false', null, function (data) {
  26. var p = data.results[0].geometry.location
  27. var latlng = new google.maps.LatLng(p.lat, p.lng);
  28. new google.maps.Marker({
  29. position: latlng,
  30. map: map,
  31. icon: 'img/loc.png'
  32. });
  33. });
  34. }
  35. }
  36. google.maps.event.addDomListener(window, 'load', init);