Open markuman opened 2 years ago
Yes! I was thinking the same thing, as well as hillshading polygons derived from the same elevation data. Do you have any background knowledge on generating contour lines?
I did some work on graphhopper with elevation data so I know it shouldn't be too hard to access free public data from Java. I'm not too familiar with generating isolines but it looks like marching squares used by d3-contour is pretty standard?
Do you have any background knowledge on generating contour lines?
Unfortunately not.
This guide also contains some useful info: https://github.com/nst-guide/terrain#contours-1 - it looks like DEM files can be processed in isolation then the results merged, which fits in well with Flatmap's goal of saturating cpus and limiting memory and disk usage. If the result gets blocky at higher zoom levels, there's also https://docs.geotools.org/stable/javadocs/org/geotools/geometry/jts/JTS.html#smooth-org.locationtech.jts.geom.Geometry-double-
Some interesting and possibly valuable links I collected when looking for global contour lines and hillshade from open data:
Free terrain tiles from aws:
Terrain Tiles:
Generate hillshade
Generate contours
hillshade/contours and script for France:
I just now found out about client-side generated hillshade and contour-lines with maplibre GL JS.
This works globally, based on the terrain tiles from aws. https://onthegomap.github.io/maplibre-contour/#12.03/46.14026/7.11656
Thanks for the pointers! I was about halfway through implementing contour lines in planetiler but ended up just porting the logic to JavaScript since it lets you generate any number of variations on thresholds from one dem source, and built that into maplibre-contour.
Let me know if people still have use cases for server-side generated hillshading/contour lines. Since maplibre now has client side support for those the biggest gap seems like server-generated global landcover.
What would be amazing is if you could make a version of the javascript contour lines which works in aws lambda or cloudflare workers. Because I would love to use your contour lines in MapLibre Native but don't know how to get there...
@wipfli Did you look at the Terradactile demo I linked above? This generates hillshade tiles on lambda. https://github.com/sparkgeo/terradactile-lambda/blob/master/terradactile/terradactile/app.py
I personally prefer provider-independent self-hosted services. For now I mostly played with tileserver-gl and styles.json to tweak and design map styles. I need to get more familiar with maplibre-gl-js and the plugins.
Last year I wrote a script which I used to generate contour lines for the whole planet. https://github.com/CramericaIndustries/vector-terrain-cli
Downside of this script is that the contour lines are overlapping in the border areas of the DEM files.
Right now I am using the https://github.com/onthegomap/maplibre-contour posted above, which makes contour lines based on the terrain raster-dem.
heres a live example of that https://wifidb.net/demo/contours/contour_lines.html#15/32.24408/76.21147/0/60
The nice thing is this produces vector tile lines, which can be styled as you want. It also lets you adjust what levels you want to see without having to generate a whole new set of contour line tiles.
I'd like to add contour lines.