CloudMade/Leaflet — Issue #445: geojson linestring
Author: dacami
Created: 2012-01-22 03:43:14+00:00
State: open

I want to load a linestring with geojson. My geojson looks like this:

{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
15,
47
],
[
15.3,
47.3
],
[
15.1,
47.2
],
[
15.6,
47.1
]
]
},
"properties": {
"name": "der name",
"style": {
"color": "#004070",
"weight": "4",
"opacity": "0.9"
}
}
}

And the Javascript looks like that:

$.each(route, function (fahrt) {
var fahrtenlayer = new L.GeoJSON();
fahrtenlayer.on('featureparse', function (e) {
if (e.properties && e.properties.style){
e.fahrtenlayer.setStyle(et.properties.style);
}
});
fahrtenlayer.addGeoJSON(fahrt);
map.addLayer(fahrtenlayer);
});

I get an error in my Firebug:

throw new Error('Invalid GeoJSON object.');

at row: 3851

Maybe it debends on the "" in the style options in my geojson, i can't see them in the examples. but when i remove them i have no valid json (jsonlint).

thanks, greets