Giter Club home page Giter Club logo

Comments (3)

marcelobbfonseca avatar marcelobbfonseca commented on August 20, 2024

@mattbeets im trying to make something similar you did.
the diference is that i have the same GeoJSON data shown in different layers on my map with a radio button control: points as circleMarker, points as a heatMap and points as a clusterGroup.
I'm trying to add a timeline with these layer control groups.
I have the layergroup working fine and i managed to make the timeline work adding it directly to the map like in the examples:

      timelineControl.addTo(map)
      timelineControl.addTimelines(myTimeLine)
      myTimeLine.addTo(map)

But when i try to add it to a layer so i can toggle using groupedLayer i'm getting similar errors

from leaflet.timeline.

marcelobbfonseca avatar marcelobbfonseca commented on August 20, 2024

@mattbeets i managed to solve it by adding the timeline to a LayerGroup. Notice that the diferent syntax is because im using vue-cli3.

      pointsTimeLineLayer = L.layerGroup()
      timeLineClusters = L.layerGroup()
      timelineHeatLayer = L.layerGroup()

      let baseLayers = {
        "Tile layer": tileLayer,
        "Grayscale": grayscale,
        "Streets": streets
      }
        let overlays = {
        "Timeline layers":{
          "points": pointsTimeLineLayer,
          "Clusters" : timeLineClusters,
          "HeatMap": timelineHeatLayer,          
        }
      }    
      L.control.groupedLayers(baseLayers, overlays).addTo(vm.map)

      let myTimeLine = L.timeline(geoJSONData,
        {
          pointToLayer: bookmarkMarkerOptions, // bookmarkMarkerOptions is a function
          onEachFeature: addBookmarkPopUp, // addBookmarkPopUp  is a function
          getInterval: getInterval // getInterval  is a function
        }
      )

      myTimeLine.addTo(pointsTimeLineLayer)
      timelineControl.addTo(map)
      timelineControl.addTimelines(myTimeLine)
      

i Hope this solves your issue

from leaflet.timeline.

mnortoft avatar mnortoft commented on August 20, 2024

Thank you so much, Marcelo.
Great work. I'll try it as soon as possible :)

from leaflet.timeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.