Giter Site home page Giter Site logo

fossabot / alexandra-trackmap-panel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anatolyza/alexandra-trackmap-panel

0.0 2.0 0.0 850 KB

Map plugin using Leaflet and OpenSteetMap to visualize coordinates or geo:json as either a Ant-path, Hexbin, or Heatmap.

License: MIT License

CSS 1.09% JavaScript 81.78% HTML 17.12%

alexandra-trackmap-panel's Introduction

Trackmap Panel for Grafana

license standard-readme compliant FOSSA Status

Map plugin to visualize timeseries data from geo:json or NGSIv2 sources as either a Ant-path, Hexbin, or Heatmap.

Usage

Queries

To use the plugin the data needs to be formatted as a table with either contains location in NGSIv2 format:

{
  ...,
  "location": {
    "type": "geo:json",
    "value": {
      "coordinates": [55.96086,9.75394],
      "type": "Point"
    }
  }
}

Or simply a lat and lon.

A example of a query for location against a crateDB/PostgreSQL:

SELECT time_index, location
FROM doc.table_name
WHERE $__timeFilter(time_index)
ORDER BY time_index

And a example query for lat and lon against a crateDB/PostgreSQL:

SELECT time_index, latitude as lat, longitude as lon
FROM doc.table_name
WHERE $__timeFilter(time_index)
ORDER BY time_index

To only get specific entities from the database a query could look like this:

SELECT location, time_index
FROM doc.table_name
WHERE $__timeFilter(time_index)
AND (entity_id = 'vehicle:WasteManagement:id1' OR entity_id = 'vehicle:WasteManagement:id2')
ORDER BY time_index

Settings

You can change the starting zoom and center of the map, as well as the maximum zoom under the map options:

map

There is a options to enable the use of the maps min and max coordinates. This adds or updates $maxLat, $minLat, $maxLon and $minLon with the maps bounding box. Which can then be used in the query, as an example for crateDB/PostgreSQL:

SELECT time_index, latitude as lat, longitude as lon
FROM doc.table_name
WHERE $__timeFilter(time_index)
AND latitude >= $minLat
AND latitude <= $maxLat
AND longitude >= $minLon
AND longitude <= $maxLon
ORDER BY time_index

To use this with NGSIv2 data, is abit more complex, an example for crateDB/PostgreSQL:

SELECt coordinates[1] as lat, coordinates[2] as lon, time_index
FROM (
  SELECT location['value']['coordinates'] as coordinates, time_index
  FROM doc.table_name
  WHERE $__timeFilter(time_index)
) AS Array
WHERE coordinates[1] >= $minLat
AND coordinates[1] <= $maxLat
AND coordinates[2] >= $minLon
AND coordinates[2] <= $maxLon
ORDER BY 3

The first time this is enabled does it require a move/zoom on the map for it to create the variables.

An option for the map to update the data after moving/zooming, is available when using the maps min and max coordinates. Do note that enabling this might make it spam your database, and can queue op request to it.

There are three visualization options to choose from, Hexbin, Heatmap and Antpath.

Hexbin

hexbin

The hexbin have 2 options.

  • Color range which lets you set the colors of the hexbin based on there value (number of datapoints with the hexbin), with the left color being the lowest count, and the right color being the highest count.
  • And Radius range with the first field being the initial size of the hexbin changing to the size of the second field.

hexbin_settings

Heatmap

heatmap

There are no settings available for Heatmap

Antpath

antpath

The antpath have the following options available:

  • Delay: The delay of the animation flux
  • Dash array: The size of the animated dashes
  • Weight: The weight of the path
  • Color: The color of the path
  • Pulse color: Adds a color to the dashed flux
  • Paused: Toggle stop/start of the animation
  • Reverse: Reverses the animation flow

antpath_settings

Build

To build the plugin, you need either yarn or npm.

First you need to install the dependencies by running:

npm install

After the dependencies are installed, you can build the plugin by running the following command:

npm run build

You can also run the code in development with the following command:

npm run dev

Install

If you are running grafana locally, you can clone or download the repository directly into the plugin directory of grafana, and then reset the grafana-server, and the plugin should be automatically detected.

Or if you are using docker, a guide can be found here.

There are more ways to install plugins for grafana, which can be found on their website.

Contributing

A guide on how to contribute can be found here

Acknowledgements

This plugin was developed as part of the the SynchroniCity Project by The Alexandra Institute. The SynchroniCity project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 732240

License

MIT © Alexandra Institute.

FOSSA Status

alexandra-trackmap-panel's People

Contributors

alkarex avatar anatolyza avatar drazair avatar fossabot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.