[GIS] Adding GeoJSON layer Leaflet map

geojsonleaflet

I am new to leaflet & its geojson features.

I am trying to test leaflet's functionalities and have built a map and its layer:

var map = new L.map('map', {scrollWheelZoom:true, doubleClickZoom:true, boxZoom:true, zoomControl:true});
var osmTiles = new L.TileLayer('http://localhost/googleapi/images/image1/tiles/{z}_{x}_{y}.png', {
maxZoom: 7,     minZoom: 3
}).addTo(map);   

Now i want to draw a second layer (geoJson) upon it with a marker, so following the tutorila (cloudmate):

var geojsonLayer = new L.GeoJSON();
var geojsonFeature = {
"type": "Feature",
"properties": {
    "name": "Coors Field",
    "amenity": "Baseball Stadium",
    "popupContent": "This is where the Rockies play!"
},
"geometry": {
    "type": "Point",
    "coordinates": [83.06877, -156.35742]
}
};
geojsonLayer.addData(geojsonFeature);

I am testing in my local PC (have not installed node + built leaflet) so maybe i am missing something.

Best Answer

You have to add the geojsonLayer to your leaflet map like you did with your tile layer with .addTo(map)