Mapbox: Geolocation

Plot location on a realtime, live-updating map
Back to BLOCKS

About Mapbox: Geolocation

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 realtime. In streaming coordinates, any number of subscribers can watch changes in geolocation on the live-updating map.

Try it Now
Geolocation Geolocation
Internet of Things
Internet of Things
Last Updated:
20160803 at 15:03:22
Ian Jennings


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.
    "text" : "Hi" 


The block publishes information about the client's location onto an output channel.
    '': { 
        latlng: [ 28.4667, 77.0333 ],
		data: {
            as: 'AS24560 Bharti Airtel Ltd., Telemedia Services',
			city: 'Gurgaon',
			country: 'India',
			countryCode: 'IN',
			isp: 'Airtel Broadband',
			lat: 28.4667,
			lon: 77.0333,
			org: 'Airtel Broadband',
			query: '',
			region: 'HR',
			regionName: 'Haryana',
			status: 'success',
			timezone: 'Asia/Kolkata',
			zip: '122001'