Giter Club home page Giter Club logo

cl-heatmap's Introduction

cl-heatmap

A tool for generating OpenStreetMap overlay heatmap tiles using OpenCL.

What it does

The tool takes a set of geographical (WGS84) points with assigned values and generates output tiles based on the selected kernel.

Linear approximation of the coordinate transformations

As the kernels are written to run in cartesian coordinate system (though generalizing for using WGS84 directly should be fairly easy), we need to compute a tile->WGS84->cartesian transform. Computing this for each point is however unnecessarily computationally intensive.

cl-heatmap solves this by sampling the transformation a few hundred times and then using linear regression to make a transformation matrix. The transformation is then applied by the GPU for each of the 65536 output pixels. This transformation is relatively precise (at least for the ETRS89-TM33 transformation which was the primary transformation used during development), under one pixel for most zoom levels.

Available kernels

heatmap.cl

This kernel computes weighted average between the input points, the weights decaying with distance. Also properly checks the distance and makes output points which are too far away from any input point transparent.

tdoa.cl

This kernel computes multilateration error function. The tool was originally developed for this application, however given the small number of points involved it outgrew it rapidly. See examples/tdoa for example input data.

Demo

A demo map of the examples/safecast can be found here. This map was generated using about a 1 million points (centered around Prague) from the Safecast dataset.

Command line

Usage: cl-heatmap [OPTION...]

  -b, --boundaries=BOUNDARIES   Boundaries in WGS84 '50.12,14.23,51.23,15.33'
  -c, --clargs=CLARGS        OpenCL compiler arguments
  -d, --device=DEVICE        OpenCL device to use (-d 0.0)
  -f, --prefilter=PREFILTER  Do not pass a point to the kernel if it is further
                             than PREFILTER
  -i, --input=INPUT          Input JSON
  -k, --kernel=KERNEL        Kernel to use
  -m, --colormap=COLORMAP    Colormap to use, available: ["heat"]
  -o, --outdir=OUTDIR        Output directory
  -p, --projection=PROJECTION   Proj4 specification of the cartesian projection
                             (default="+init=epsg:3045")
  -z, --zoom=ZOOM            Zoomlevel
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

TODO:

  • WGS84 great circle distance support
  • Write an actual heatmap kernel (where the points add instead of weighted averaging)
  • Add some timing output
  • Add custom loadable color palletes
  • Support for color gradients with more than 256 colors (currently limited by the PNG output)

Note

This was my first foray to the realm of GPU accelerated computing, so don't expect any sort of stellar performance.

cl-heatmap's People

Contributors

atx avatar

Watchers

 avatar  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.