active_vector_layer

by Irakli Bardavelidze

HTML

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<div id="map"></div>

CSS

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

JavaScript

var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/d4fc77ea4a63471cab2423e66626cbb6/997/256/{z}/{x}/{y}.png',
    cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
    cloudmade = new L.TileLayer(cloudmadeUrl, {
        maxZoom: 18,
        attribution: cloudmadeAttribution
    });
var MAP = new L.Map("map", {
    center: [48, 4],
    layers: [cloudmade],
    zoom: 9
});
var layer = new L.GeoJSON({
    "type": "FeatureCollection",
    "features": [{
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [10.162353515625, 49.18170338770663],
                [9.84375, 48.68370757165361],
                [7.393798828125, 49.088257784724675],
                [7.00927734375, 49.63917719651036],
                [6.08642578125, 49.95828842806968]
            ]
        },
        "type": "Feature",
        "id": 3517,
        "properties": {
            "options": {
                "opacity": null,
                "weight": null,
                "color": "",
                "stroke": true,
                "smoothFactor": null,
                "dashArray": "",
                "fillOpacity": null,
                "fill": false,
                "fillColor": ""
            },
            "name": "une ligne",
            "icon": {},
            "datalayer_id": 887
        }
    }]
});
MAP.addLayer(layer);