Leaflet.timeline | Display arbitrary GeoJSON on a map with a timeline slider | Dataset library
kandi X-RAY | Leaflet.timeline Summary
kandi X-RAY | Leaflet.timeline Summary
Show any changing geospatial data over time, from points to polygons. If you want smooth motion of markers from point to point, this is not your plugin. Please check out LeafletPlayback, or for real-time data, try Leaflet Realtime, both plugins from which I may or may not have pilfered some ideas.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Leaflet.timeline
Leaflet.timeline Key Features
Leaflet.timeline Examples and Code Snippets
Community Discussions
Trending Discussions on Leaflet.timeline
QUESTION
Getting an error trying to load a page. Rails 6, Ruby 2.7.1. Webpacker for javascript and SCSS From the Terminal (similar to the Chrome Console error )
...ANSWER
Answered 2020-Dec-23 at 16:46Webpacker changed from using .babelrc
to babel.config.js
between major versions 3 and 4. (Here is a link to the changelog where that is mentioned.) If this error pops up after the upgrade, it likely means that the legacy .babelrc
file is still in the root of the Rails app. The solution is to delete .babelrc
.
QUESTION
This looks just like the question @rossta answered for Gmaps, but I don't understand the problem and answer well enough to make his suggestion work.
The error is: Uncaught TypeError: L.timeline is not a function
at Object.success (mapTwo.js:14)
Line 14 is var timelineData = L.timeline(data_data, {
. Complete code below.
I removed the leaflet gems that work in Rails 5.2 and in console
...ANSWER
Answered 2020-Jan-13 at 22:38There are a few issues with your setup:
- The
'leaflet.timeline'
plugin assumes the leaflet module is available as the global variable'L'
. The source code of the plugin shows this to be true (on master at the time of this post): https://github.com/skeate/Leaflet.timeline/blob/b7a8406f5a9a66ccdbcaf73465baaedadec76d1f/src/Timeline.js#L1 - (I believe) You are using more than one entry point on the page at one time:
'application.js'
and'mapTwo.js'
. Rails calls entry points "packs", so everything inapp/javascript/packs
is a separate entry point to Webpack. Webpack recommends 1 entry point per page; without extra configuration, multiple entry points on one page can lead to surprising behavior, especially with regards to global variables (see #1).
To elaborate further on issue 2, with your current configuration, Webpack doesn't know you want to use two entry points on the page; it bundles one instance of the Leaflet module in the application pack and another instance of the Leaflet module in the mapTwo pack. It bundles the Leaflet module in mapTwo because you added the ProvidePlugin configuration L: 'leaflet'
, which says, basically, add var L = require('leaflet')
to every module that references L
.
So there are a few possible fixes:
Move your
import 'leaflet.timeline'
into mapTwo.js and removeimport 'leaflet'
from application.js. You don't needimport 'leaflet'
given your ProvidePlugin config. This is the easiest fix to address the short-term issue ofL.timeline is not a function
. It does not prevent you from bundling modules like Leaflet twice when using multiple entry points on the page, say if you were to need to addimport 'leaflet'
somewhere in the application.js dependency graph. ORDon't split up your packs; consolidate all your existing code in the dependency graph of
'application.js'
. You may need to wrap your existing mapTwo code in callback, i.e.,document.addEventListener('DOMContentLoaded', callback)
. ORUse the SplitChunksPlugin, which is a way of sharing modules across Webpack "chunks" which, in your case, means the entry points, application.js and mapTwo.js. This means, keep your existing code in separate packs along with additional changes described in more detail in the Rails Webpack docs: https://github.com/rails/webpacker/blob/master/docs/webpack.md#add-splitchunks-webpack-v4. You may need to also wrap mapTwo.js code in the DOMContentLoaded listener, as in 2.
Finally, remove this code from your configuration; as this was copied from another solution, it's not adding any value to your setup:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Leaflet.timeline
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page