Leafletjs - GeoJSON layer showing - Javascript Leaflet

Javascript examples for Leaflet:Layer

Description

Leafletjs - GeoJSON layer showing

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Leaflet minimal map</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"> 
      <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> 
      <style id="compiled-css" type="text/css">

#map {/* ww w  .  jav a  2 s  .  com*/
   height: 400px;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){
var map = L.map('map', {
         center: [8.99665, 38.81573],
         zoom: 13
      });
var addis = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
         id: 'addis',
         attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var aa = {
    "type": "Feature",
    "properties": {
        "name": "Megenagna",
    },
    "geometry": {
        "type": "Point",
        "coordinates": [38.802933, 9.019720]
    }
};
new L.GeoJSON(aa).addTo(map);
    }

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

Related Tutorials