Apply "vector" to Point or LatLng in Leaflet - Javascript Leaflet

Javascript examples for Leaflet:Point

Description

Apply "vector" to Point or LatLng in Leaflet

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script> 
      <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css"> 
      <script type="text/javascript" src="http://api.mapbox.com/mapbox.js/plugins/leaflet-geodesy/v0.1.0/leaflet-geodesy.js"></script> 
      <style id="compiled-css" type="text/css">

html,//w ww.  ja  v  a2  s  .  c o m
body,
#map {
   height: 100%;
   width: 100%;
   padding: 0px;
   margin: 0px;
}


      </style> 
   </head> 
   <body> 
      <div id="map"></div> 
      <script type="text/javascript">
var centerLatLng = [47, 3];
var radiusMeters = 4000;
var map = L.map('map').setView(centerLatLng, 11);
L.tileLayer(
    'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    {maxZoom: 18}).addTo(map);
var circ = LGeo.circle(centerLatLng, radiusMeters, {parts: 144}).addTo(map);
var labelLatLng = [circ.getBounds().getNorth(),centerLatLng[1]];
var labelCenter = L.divIcon({ className: 'center', html: 'center' });
L.marker(centerLatLng, { icon: labelCenter }).addTo(map);
var labelUp = L.divIcon({ className: 'four', html: '4km' });
L.marker(labelLatLng, { icon: labelUp }).addTo(map);

      </script>  
   </body>
</html>

Related Tutorials