tprebs / fluttermap_heatmap

Heatmap plugin for flutter_map
BSD 3-Clause "New" or "Revised" License
21 stars 17 forks source link

How would I do the same for terrain? #8

Closed jesussmile closed 1 year ago

jesussmile commented 1 year ago

Hi! I am trying to do something similar to yours but for terrain. For example the map will be color coded red if the terrain altitude is the same, yellow if it is 500 feet below and green if clear. My question is, What was the logic behind your heat map ?

tprebs commented 1 year ago

Do you have access to a digital terrain model? Assuming you do, this should be fairly trivial If you are planning on implementing it as a tiled layer this is approximately what I would do:

  1. implement a custom tile provider. This needs to
    • have access to the current altitude
    • convert the x y coordinates to a lat long bounding box
    • For the lat long bounding box, extract the elevations from the digital terrain model (DTM)
    • convert each value in the grid to to red, yellow or green based off the elevation and altitude
    • pass the colour grid to a custom painter and paint each colour. convert the response to an image and return this as your tile