Coder Social home page Coder Social logo

Comments (2)

ianjennings avatar ianjennings commented on August 28, 2024

Hey Matthijs. The markers are powered by Leaflet wrapped around Mapbox. You can access the markers in the marker callback exposed by eon.

https://github.com/pubnub/eon-map#marker-customization

This example shows how to change a marker color on click.

https://www.mapbox.com/mapbox.js/example/v1.0.0/change-marker-color-click/

from eon-map.

matthijsphilip avatar matthijsphilip commented on August 28, 2024

Hi Ian,

Thanks for the reply; probably to insufficient programming skills I'm still unable to change a marker's color based on incoming pubnub messages for markers that are already there on a map.

What I can do is publish markers with different colors, but I would like to change an already present marker's color based on a remote event.

Is there a way to access the markers already rendered on the eon map from the message callback function, or can I somehow access the MapBox featureLayer the eon map uses so I can iterate over the markers that are already there? The mapbox example you send doesn't help me much; the layer being added is from local code and not from a distributed (remote) event.

The use case is as follows:

I have a TV screen displaying the EON map in my office.

A remote worker opens a webpage on a tablet that publishes / broadcasts its location: this results in a blue marker on the map. I of course got this to work; that's simple.

The remote worker submits a form, I than publish another event with a different status. I would like that event to change the marker's color (already on my map) from blue to green.

Finally the remote worker logs out: its marker is then removed: I can get this to work too.

Is there some example somewhere that changes a L.marker property based on code in the "message" callback? I tried supplying code in the "marker" callback, but that doesn't re-render the markers when I broadcast a different status.

Hope you can follow me and in your kindness can help me again.. :-D I wish there was more documentation or examples out there, but can't seem to find many others using the eon-map in this way.

from eon-map.

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.