[Maps] Interpolate line from a set of geopoints & retrieve lastest document with KQL

Hi,

I'm currently playing with Kibana and FlightRadar, to display all of our "active" flights using the latest version of the stack.

To construct this map, I've been using the following datasets:

The map shown above shows the following:

  • a geo-line between the departure and the arrival airport
  • a clickable bubble on the arrival airport showing relevant informations on the airports
  • all airports, depending on zoom level
  • the dots of the actual positions at which the plane's ADS-B transmitters pingged
  • the latest known position of various planes, oriented using the heading value
  • the estimated path between the latest known position of the plane and its arrival airport

All the relevant data for my questions are stored in an index consisting of mostly the following data:

  • actual status date time
  • geopoint of the ping
  • aircraft identification data
  • aircraft origin airport stored as a geopoint
  • aircraft destination airport stored as a geopoint
    => for a single flight, I have as many documents as there are pings

So after this long introduction ( :slight_smile: ) here's my questions:

  • is there a good way to interpolate a line from many geopoints stored within multiple documents in maps ?
  • using KQL is there a way to retrieve the document with the highest timestamp while still matching other criteria ? This would be helpful to draw the line between the latest known aircraft position and its destination...so far I'm doing some weird stuff at ingest time.

Best regards,

Charles.w

is there a good way to interpolate a line from many geopoints stored within multiple documents in maps ?

There is an open enhancement request for a geo_line aggregation that will convert points into a line. You can follow along at https://github.com/elastic/kibana/issues/31396 and https://github.com/elastic/elasticsearch/issues/41649

using KQL is there a way to retrieve the document with the highest timestamp while still matching other criteria ? This would be helpful to draw the line between the latest known aircraft position and its destination...so far I'm doing some weird stuff at ingest time.

You can use top hits to show the latest position for each aircraft. There is no automated way of showing a line between the current location and destination.

Hi,

Thanks for your answer. Regarding the "current" location of the plane and its destination, both are stored within the same document, but the "top hits" aggregation cannot be used to display geo-line. Thus far, I'm using boolean flags to mark document containing the latest known position, it's not pretty nor elegant but thus far it works...I still need to dig a little more on this :slight_smile:

Best regards,

Charles.w

Regarding the "current" location of the plane and its destination, both are stored within the same document, but the "top hits" aggregation cannot be used to display geo-line.

You could also index the line in document as a geo_shape. That way, top hits could just render that stored line. Then you would not need any boolean flags because top hits would only show the most recent document per aircraft

Good idea, I'll try that tomorrow! Thus far - and as we use ArcGIS for most geo data - I haven't used the elastic stack to display / handle this kind of data. :+1:

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