Gantry 5
  • Featured
  • Topics
      • Back
      • Coding
          • Back
          • Arduino Coding
          • Databases
      • Inland Waterways
          • Back
          • Trent and Mersey Canal Locations
          • Inland Waterways Database crt canals
          • 3 Locks Around Barton
      • Internet Of Things (IOT)
      • Electronics
          • Back
          • Raspberry Pi
          • Arduino
      • Renewable Energy
          • Back
          • Wind Tubines
          • Water Turbines
      • Electric Vehicles (EV,s)
          • Back
          • Ebikes
          • Drones
      • Blender
  • About
  • Login
  1. You are here:  
  2. Home
  3. Topics
  4. Coding
  5. Maps JavaScript API
  • APi
  • Javascript

Maps Javascript API

Details
Parent Category: Coding
Category: Maps JavaScript API
  • Javascript
  • Mapping

simplemap.html Simple Map (zoom 8 center: { lat: 52.759, lng: -1.709 } Barton Marina)

simplemap2.html Simple Map 2 (zoom 12 center: { lat: 52.534, lng: -1.828 } Lesley's)

 

code used 

simplemap.html

<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div id="map"></div>

<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDiB6PpwXGX9hUmIqddIq2Do2c4p0BIrG0&callback=initMap&v=weekly"
async
></script>
<script src="/script.js"></script>
</body>
</html>

 

style.css

/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}

/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}

 

 

script.js

let map;

function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 52.759, lng: -1.709 },
zoom: 8,
});
}

higher the zoom number the more the zoom 

 

© 2025 M.Norridge
nbMawddach