Mapping Influx data to Maps

I am monitoring a particular vehicle.

I am storing the latitudes and longitudes of the places wherever vehicle goes in Influxdb.

Now, Suppose I have data of the past 15 days, and I want to track the location of the latitudes and longitudes stored in my Influxdb database.

How can I keep a track of all the locations of that vehicle.
Is there any library which connects the data from Influxdb to some Mapping UI?

Adding support for geo queries has been on our roadmap for a long time, but we’re unlikely to get to it in the near future. In the meantime you could store exact lat, long in field values and store geohashes as tags for quick lookup in an area. Would take a little bit of extra work, but I think doable.

1 Like

@Luv

I’ve made an app using the node-influx client to pull data and node-geohash for the geohash decoding. Getting the data into a format for Google Maps or Mapbox from there is pretty easy.

I think @pauldix’s suggestion to store the geohash as a tag and lat, lng as fields is the best way to go.

2 Likes

There are a potential analytics that could be done with geo-data that would not require map integration.

I’d like Grafana charts that show when vehicles are moving, their speed and distance traveled over time. I’d be interested in calculating how far my fleet has traveled in the prior day/week/month. Etc.

1 Like

@pauldix @jackzampolin Do you mean like this?

I am using the world map plugin of grafana, and there is not a good documentation for using Influxdb.
I don’t know how to write and connect those JSON endpoints with grafana.

Here is what I am using,

client = InfluxDBClient('localhost',8086,'first','password','latlnggeo')
    geohash = Geohash.encode('latlnglist[0]', 'latlnglist[1]')
    latlng_json_body = [{
    "measurement": "latlngdata",
    "tags": {
            "vehicle":"Scooter"
    },
    "time":"2017-03-24T09:42:12.358946935Z",
    "fields":{
            "lat":latlnglist[0], #latitude from list
            "lng":latlnglist[1], #longitude from list
            "geohash":geohash,
            "metric":"Count"
    }
    }
    ]
    client.write_points(latlng_json_body)
indent preformatted text by 4 spaces

@luv Acording to the documentation there it looks like you would need geohash as a tag

Yeah, Thank you. I got it.

Its documentation for influxdb should include some examples.

I have another question, may be you people can help me with this. I am not posting in the community as this is related to grafana and not influx.
Its about enhancing the use of grafana’s world map plugin.
Thank you.

Please see this

A question on the subject of Geohashes and their use as a Tag : wouldn’t a 12 characters Geohash count as potential high series cardinality ?

If so, how can collision (and overwrites) be avoided in such a scenario ?

Yes. I suffered a lot because of this. But it was a one time thing only, so I got a bigger machine and did my task.