Mapbox: Geolocation

Plot location on a real-time, live-updating map

Mapbox's IP-to-Geolocation API plots a user's location on a map based on their IP address, without having to ask the client for the geolocation data.

The Mapbox geolocation block allows you to plot user or device location, and move that marker based on changes in location, in real time. In streaming coordinates, any number of subscribers can watch changes in geolocation on the live-updating map.


Whenever a client publishes to the PubNub network, it's IP is added as a meta value to the request packet and is available in a block under request.client.ip. Then the IP's location is estimated using the free API. It's super simple, all we need to do is make a request to[ip]

The service will respond with an estimated geolocation, city, state, country, as well as information about the internet service provider (ISP). Here's an example of a response from the service:

    "as":"AS36351 SoftLayer Technologies Inc.",
    "city":"San Francisco (Haight-Ashbury)",
    "country":"United States",
    "isp":"SoftLayer Technologies",
    "org":"SoftLayer Technologies",

Now if you subscribe to eon-map-geolocation-output using the same keys supplied into the block, you'll see the EON formatted output ready to be plotted.


This block can take any payload as input, the contents do not matter as the IP is taken from the message's meta properties.



The block publishes information about the client's location onto an output channel.


Talk to an expert