Ruler on bottom left map

334 views
Skip to first unread message

Muhammad Azhari

unread,
May 28, 2014, 4:04:11 AM5/28/14
to leafl...@googlegroups.com
Hello,

I'm trying to make a ruler on the bottom left of the map so user can know the distance, can some one guide me how to do that?

Historical Atlas

unread,
May 28, 2014, 4:07:32 AM5/28/14
to leafl...@googlegroups.com
Ruler === Scale?
Check out the API for the Scale-Control
http://leafletjs.com/reference.html#control-scale



On 05/28/2014 10:04 AM, Muhammad Azhari wrote:
Hello,

I'm trying to make a ruler on the bottom left of the map so user can know the distance, can some one guide me how to do that?
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Muhammad Azhari

unread,
May 28, 2014, 4:11:31 AM5/28/14
to leafl...@googlegroups.com
already check it but still dont know how to use it, i'm still new a bit blur :D

Muhammad Azhari

unread,
May 28, 2014, 4:38:10 AM5/28/14
to leafl...@googlegroups.com
  <html>
      <head>
             <title>Leaflet Quick Start Guide Example</title>
             <meta charset="utf-8" />
           
             <meta name="viewport" content="width=device-width, initial-scale=1.0">
           
           <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
           </head>
           <body>
             <div id="map" style="width: 1024px; height: 600px"></div>
           
           <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
      <script>
      
          var map = L.map('map').setView([51.505, -0.09], 13);
      
          L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
            maxZoom: 18,
            attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
              '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
              'Imagery © <a href="http://mapbox.com">Mapbox</a>',
            id: 'examples.map-i86knfo3'
          }).addTo(map);
      

          
          L.marker([51.5, -0.09]).addTo(map)
            .bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
      
          L.circle([51.508, -0.11], 500, {
            color: 'red',
            fillColor: '#f03',
            fillOpacity: 0.5
          }).addTo(map).bindPopup("I am a circle.");
      
          L.polygon([
            [51.509, -0.08],
            [51.503, -0.06],
            [51.51, -0.047]
          ]).addTo(map).bindPopup("I am a polygon.");
      
      
          var popup = L.popup();
      
          function onMapClick(e) {
            popup
              .setLatLng(e.latlng)
              .setContent("You clicked the map at " + e.latlng.toString())
              .openOn(map);
          }
      
          map.on('click', onMapClick);
          
         L.control.scale().addTo(map);
      
        </script>

           </body>
</html>

still no display

On Wednesday, May 28, 2014 4:07:32 PM UTC+8, Historical Atlas wrote:
Reply all
Reply to author
Forward
0 new messages