I've created GeoJSON file with Rails jBuilder and want to read it in to Leaflt. It's OK if I use it directly like so L.mapbox.featureLayer().loadURL('overview/overview_data.geojson').addTo(map)
but I want to use Leaflet.timeline
and work with the GeoJSON.
If I put the GeoJSON in the script like so
let data = {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"start":1903,"end":1908,"name":"part of S. Toluca St. (26). and second block south gone","title":"Was Brook before 1903 and became part of S. Toluca St. (26). and second block south gone until at least 1908."},"geometry":{"type":"LineString","coordinates":[[-118.25862396508458,34.06087254304104],[-118.25933206826451,34.05994816216629]]}},{"type":"Feature","properties":{"start":1903,"end":1928,"name":"part of E. 40th Place","title":"Was 37th St before 1903 and became part of E. 40th Place until at least 1928."},..
the rest of the script works fine, but I need to use dynamically generated data (I did the above for testing).
let data = new L.GeoJSON("overview/overview_data.json");
seems to be an object and not usable. Or can this be parsed?
The other alternative would be if jBuilder could add a callback wrapper around the GeoJSON and I could work with that.
I know this has been addressed, but I can't figure out how to do it.