Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i am newbie in leaflet & its geojson features...

I am trying to test leaflet's functionalities. In fact i 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);   

and 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!!! Any help?

share|improve this question

1 Answer 1

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

share|improve this answer
    
thanks! i have added geojson layer to map but the problem was wrong coordinates, since geojson uses inverse sequence for declaring coordinates (???) than leaflet... So the points did exist but i could not locate them. –  thanili Sep 11 '12 at 13:52
    
I'm fairly new myself and what I do is create all of my features and attributes with QGIS and then save as a geojson file, (EPSG:4326). Havent had a problem yet. –  geomajor56 Sep 11 '12 at 14:22
    
Try setting attribute tms: true –  Scro Nov 10 '12 at 17:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.