find latitude & longitude of saved marker in leaflet - Javascript Leaflet

Javascript examples for Leaflet:Marker

Description

find latitude & longitude of saved marker in leaflet

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Google Maps</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script> 
      <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css"> 
      <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> 
      <style id="compiled-css" type="text/css">

.map {//from  w  w  w  .j a  v  a 2s. co  m
   position: absolute;
   top: 0px;
   left: 0px;
   width:100%;
   height:250px;
   border: 1px solid #4D2722;
   z-index:0;
}


      </style> 
      <script type="text/javascript">
    $(window).load(function(){
var map = L.map('map').setView([55.4411764, 11.7928708], 13);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var stuSplit = L.latLng(55.4411764, 11.7928708);
var myMarker = L.circleMarker(stuSplit,
    { title: 'unselected' })
        .addTo(map);
console.log(myMarker.getLatLng());
    });

      </script> 
   </head> 
   <body> 
      <script src="http://maps.google.com/maps/api/js?sensor=false"></script> 
      <div id="map" class="map"></div>  
   </body>
</html>

Related Tutorials