ccc

Google Maps: Añadir market a partir de coordenadas

<!DOCTYPE html>
<html>
  <head>
    <style>
      /* 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;
      }
  </style>
  </head>
  <body>

<div id="map"></div>
    <script>

      var map;
      function initMap() {
  var myLatLng = {lat: <?=$_GET["lat"];;?>, lng: <?=$_GET["long"];?>};
 
        map = new google.maps.Map(document.getElementById('map'), {
          center: myLatLng,
          zoom: 18
        });

var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hola'
});
      }
    </script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBxx8JJmUPajgFsJDavU6JD8nbyXXXXi3o&callback=initMap" async defer></script>
</body>
</html>

No hay comentarios:

Publicar un comentario