Line between Geopoints from index


I would like to draw a line between geopoints that I get from an index. I want to create a "tracking route" for the last 10 positions of an item in my index : Get the last 10 positions (lon, lat) of an item, plot the 10 geopoints on the map and draw a line between the geopoints.

I have already read the Mapping Airport Connections Tutorial, I know how to plot my geopoints. However in my case, I dont really have a field "source" and "target" in my index, I only have the fields @timestamp and position (lon, lat). I think that the source is my tenth oldest element, pointing to the position of the ninth. Then this becomes the source and points to the eighth...etc. And I have no idea on how to do that.

How to get the last 10 items of an index by their timestamp and plot lines between them ?

I am not sure if I am clear, sorry if it's not the case !


You'll have to change the way you index your documents in Elasticsearch, as there isn't any way to specify which points should be connected to which others. Also, I believe Maps only currently supports drawing lines between two points: Origin and Destination.

What you might be able to do is, for each document, instead of only indexing one point, you could index the previous point and the current point. Then, you could probably accomplish what you're trying to do.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.