0

Hi,
I want to show one place in my country on google map in my web page.
But currently that page is not in the Google Maps and also I don't want to add it to the google maps.
What i want is mark that place temporary in google maps and get embed map to my web page.
How can I do it?

2
Contributors
1
Reply
15
Views
3 Years
Discussion Span
Last Post by Masterblank
0

if you want to embed a Google map with a marker placed on a specific place on the map, you can use geographic coordinates (latitude and longitude) of the exact place you are referring to (change new google.maps.LatLng with your coordinates)

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple markers</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
    <script>
function initialize() {
  var myLatlng = new google.maps.LatLng(43.770540, 11.244497);//florence Italy
  var mapOptions = {
    zoom: 4,
    center: myLatlng
  }
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: 'Hello World!'
  });
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>

Edited by Masterblank: code updated

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.