Route Art [solved] Issues With Lidar Sources For Saarland, Germany

Discussion in 'PC Editor Discussion' started by WabbeLKonG, Mar 8, 2025.

  1. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    LiDAR Data for the Saarland region
    Hey everyone,

    I've been searching for a source of LiDAR data for the Saarland region (Germany), for what feels like an eternity. I've tried everything I could think of, but I'm running out of ideas. Maybe someone here can help. :)

    What I've Tried So Far:
    1. Found a Paid Source:
      I came across a website where the data is available – but at an outrageous price.
      However, I had heard rumors that the data would become freely available in summer 2024 (which was still in the future at the time). So, I decided to wait.
    2. Discovered a Free Source, but...
      Recently, I found another website.
      Here, you can download LiDAR tiles, but unfortunately, they are not georeferenced. I later learned that these tiles are nothing but graphical cutouts from a larger LiDAR map of the entire Saarland region.
    3. (what you‘ll see in the posts below)
    To make the data usable, I wrote a Python script that downloads the tiles and georeferences them based on their download link (which contains information about their position). If you want to test it, make sure to use OSGeo4W shell (should come with QGIS) to run it, otherwise it won’t work.

    Code:
    import subprocess
    import requests
    
    # ---------------------- CONFIGURATION ----------------------
    
    # Define the top-left coordinates of the area
    olx, oly = 347651.02898828, 5461057.4995628
    
    # Define grid size (number of rows & columns)
    rows, cols = 11, 14
    
    # Tile size (in meters)
    tile_size = 1000
    
    # WMS base URL
    wms_base_url = "https://geoportal.saarland.de/http_auth/46159?REQUEST=GetMap&VERSION=1.1.0&SERVICE=WMS&LAYERS=6&STYLES=&SRS=EPSG:25832&BBOX={},{},{},{}&WIDTH=1000&HEIGHT=1000&FORMAT=image/tiff&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage"
    
    # Output folder
    output_folder = "path/to/output/files"
    
    
    # ---------------------- FUNCTIONS ----------------------
    
    def download(xtopleft, ytopleft, xbottomright, ybottomright, tile_index):
        # Downloads a tile from the WMS server and saves it as a TIFF file.
        url = wms_base_url.format(xtopleft, ybottomright, xbottomright, ytopleft)
        output_path = f"{output_folder}tile_{tile_index}.tiff"
    
        response = requests.get(url, stream=True)
        if response.status_code == 200:
            with open(output_path, 'wb') as file:
                for chunk in response.iter_content(1024):
                    file.write(chunk)
            print(f"✅ Downloaded tile {tile_index}")
        else:
            print(f"❌ Failed to download tile {tile_index} (Status: {response.status_code})")
    
        return output_path
    
    
    def georeference(input_path, xtopleft, ytopleft, xbottomright, ybottomright, tile_index):
        # Georeferences a TIFF file using gdal_translate.
        output_path = input_path.replace(".tiff", "_georef.tiff")
    
        subprocess.run([
            "gdal_translate",
            "-a_srs", "EPSG:25832",
            "-a_ullr", str(xtopleft), str(ytopleft), str(xbottomright), str(ybottomright),
            input_path,
            output_path
        ], shell=True)
    
        print(f" Georeferenced tile {tile_index}")
        return output_path
    
    
    # ---------------------- MAIN EXECUTION ----------------------
    
    tile_index = 1
    for r in range(rows):
        for c in range(cols):
            # Calculate bounding box for current tile
            xtopleft = olx + c * tile_size
            ytopleft = oly - r * tile_size
            xbottomright = xtopleft + tile_size
            ybottomright = ytopleft - tile_size
    
            # Download and georeference tile
            tiff_path = download(xtopleft, ytopleft, xbottomright, ybottomright, tile_index)
            if tiff_path:
                georeference(tiff_path, xtopleft, ytopleft, xbottomright, ybottomright, tile_index)
    
            tile_index += 1
    
    print(" All tiles downloaded and georeferenced successfully!")

    This seemed to work at first – until I tried applying the data to the landscape tiles in the editor:
    Screenshot 2025-03-08 193139.png
    Seems like there are two problems with my LiDAR data:
    • The terrain was way too low.
    • It was also far too flat.
    Possible Causes
    I suspect that the issue is caused by the way the tiles are extracted from the larger dataset, meaning that they might not contain the correct elevation values for whatever reason.
    I also started to wonder if the problem could be related to the Coordinate Reference System (CRS) instead. The data is in EPSG:25832 (ETRS89 / UTM zone 32N), and I might need to apply some kind of transformation or conversion factor to get the correct elevation values.​

    What I Need Now:
    • An alternative source for LiDAR data in the Saarland region OR
    • advice on whether the issue could be caused by the CRS and if there’s a conversion factor I need to apply to correct the elevation values. If that’s the case, I could easily implement it in a Python script.
    Does anyone know of a better data source? Or even had a similar issue?
    Any help would be much appreciated! :D
     
    Last edited: Apr 16, 2025
  2. RobertSchulz

    RobertSchulz Well-Known Member

    Joined:
    Oct 10, 2023
    Messages:
    1,863
    Likes Received:
    2,607
    You need to select the part of the map you want and then order them via the OpenData Geoportal of the state of Saarland under the following link. The cart shows 0€ for me so it seems to be free from there (as required per law since June 2024). Only hurdle is you can only select a small part of the map at once. But this is similar to the Geoportal of other german states.

    https://www.shop.lvgl.saarland.de/i...ayout=wega_iframe&virtuemart_category_id=1060
     
    Last edited: Mar 9, 2025
  3. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    [​IMG]
    I fear you forgot to choose a data format for output. The selected area on the screenshot is only one third of the tiles I need, and all of these options are already 66,09€ for 30 km² only :(
    Oh, there really is a law? Looks like I‘m gonna sue the Saarland :D
     
    Last edited: Mar 9, 2025
  4. RobertSchulz

    RobertSchulz Well-Known Member

    Joined:
    Oct 10, 2023
    Messages:
    1,863
    Likes Received:
    2,607
    So, yes I forgot to select a data format for the output and I get what you mean now. Without the tick, all I saw was 0€ (how it actually should be now since June 2024), but there you still get charged. Seems that this particular page is a remainder of the time before the law has been taken in effect.

    You can read about this new EU law here. A short recap: Most of the german states provided Lidar in DGM1 or DGM2 resolution for free already before, but the minority of Baden-Württemberg, Rheinland-Pfalz, Niedersachsen, Mecklenburg-Vorpommern and apparently (but I didn't notice that before) also the Saarland did not.

    Now that we know this
    is the paid website, which still remains online,

    we might have to figure out if there is a way to get the data being able at the GeoPortal website (which apparently intends to be the new place where people can download the Lidar files for free) to work with, which a page of this is:

    1.) That the tiles itself are cutouts from a larger map is not a fault of Saarland. That is okay and so done for all other german states as well.

    2.) They should be indeed georeferenced to EPSG: 25832, as the page itself states. When you open the link and then choose the tabe "Varianten", EPSG: 25832 is said to be the CRS. And my assumption is that if it wouldn't have been georeferenced, the applied Lidar data would not have been shown as that on your screenshot

    So what is the problem now? This:

    The appeared height difference in the screenshot. However here are my thoughts.

    A.) The height of the applied Lidar data profile can sometimes quite heavily vary to the height of the SRTM profile. I remember how I surprised I was when I finally applied Lidar to my route, while I before only were used to the SRTM profile. At some spots, there where differences of 10 to 20 meters height.

    B.) As I'm seeing in the screenshot, the Lidar data does not seem to be completely flat, so there IS some height into it.

    What I would want you to try out is that you apply Lidar to the entire the landscape (not just the five tiles I see in the screenshot) and then see if the landscape in itself illustrates the height profile more or less correctly (don't compare it with the SRTM profile).

    If we the landscape still appears to be too flat, then I would try to instead of using the Lidar DGM 1 scan of 2016, use the Lidar DGM1 scan from 2006 or if that even fails the Lidar DGM5 scan from 2006 see if it works with those tiles better. And maybe try to download the individual tiles directly via the tab "Varianten" and not with your Phyton script!
     
  5. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    Hey,
    first of all, thanks for your willingness and your commitment to help! I really appreciate that :)

    Regarding Source 2 (the free one):
    First off - here‘s the actual website that links the download client I originally linked as the free source. This might be helpful later.
    Yes, the name of the download link that appears when selecting a tile in the “Varianten” tab actually suggests that the tiles are georeferenced. However, if you import a tile into QGIS, it appears at position (0,0), even when manually setting the CRS of the respective Layer, as QGIS doesn't recognize it by default (which is already suspicious).

    I inspected the tile’s metadata using a tool (whose name I can't remember but I think it was online and freely accessible) and didn’t find any data entry regarding the geographic position of the tile where it’s supposed to be, meaning there’s basically no information regarding the location stored in the raw downloaded tile. That’s what I meant when I said the tiles are not georeferenced.

    Finding a Workaround (basically how and why my script actually works)
    In the download client, I noticed that when you hover over the download link (“ATKIS - DGM1 (2016) im CRS EPSG:25832 - image/tiff - Teil X von 4756”), the actual URL of the tile you want to download is displayed in the bottom-left corner (at least in my browser, I‘m using Chrome. But you should also be able to right click the download link and select „copy link“ or something similar to inspect it).

    This URL contains the corner coordinates of the selected tile (...&BBOX=ax,ay,bx,by&...). After some research, I found that I could manually georeference the tiles using a GDAL command if I know these coordinates. But as I need quite a lot of tiles, I wrote the script to automate the process, which does two things:
    1. Download the required tiles:
      • Starting from a given point (line 7 of the script), it fetches the necessary tiles.
      • The number of tiles is determined by the variables rows and cols (line 10).
      • A loop calculates and inserts the correct BBOX values in the URL, ensuring the download link matches the one from the original source.
    2. Georeference the tiles:
      • The script uses the calculated coordinates to apply georeferencing via a GDAL command.
      • I verified this by dragging the processed files into QGIS, and they appeared in the correct location. This is why they also were in correct place later in the editor.
    I also used French LiDAR files for a neighboring region in the same project. These worked fine—there was barely any height difference between SRTM and LiDAR, and the topography looked much more realistic (less flat).

    Additionally, the .ASC file in my screenshot shows only tiny elevation differences, and strangely, all elevation values are whole numbers (no decimal places).

    My Guess
    I suspect that these numbers aren’t actual elevation values. Checking the region in Google Earth, the expected elevations should be much higher. Instead, I think the values represent RGB color values rather than elevation. Because the map the tiles are extracted from is nothing but a plain image.

    Here’s why:
    • The original download format is TIFF, which could indicate it’s just a plain raster image.
    • If the map is just a plain image, then of course the tiles do neither contain usable elevation data nor any metadata important for georeferencing - only pixel color values.
    • I noticed that completely white areas in QGIS have a value of 255 (the RGB values [255,255,255] translate to entirely white in color, if you didn’t know)
    In short
    This source doesn’t seem reliable for any project requiring serious geodata. The tiles lack true elevation information and likely only contain RGB values, making them unsuitable for any sort of project that requires serious geodata.

    Good news
    In the meantime, I did some more research and found this website. :) It links the LiDAR data sources for every state in Germany, and in the table in the „Comment“ column you can read that basically every state offers them as a download, EXCEPT for the Saarland. However, the elevation data is available through a so-called Web Coverage Service (WCS) which I honestly don’t know much about but I’ll dig deeper. (The other download link seemed to extract data from a Web Map Service (WMS), which appears to be something different)
    That said, I am optimistic that this is finally the source that contains serious usable data. However, any help or advice would be greatly appreciated! :D
     
    Last edited: Mar 12, 2025
  6. RobertSchulz

    RobertSchulz Well-Known Member

    Joined:
    Oct 10, 2023
    Messages:
    1,863
    Likes Received:
    2,607
    Yeah, I can't help out much more unfortunately either, if the Lidar tiles at the said free location indeed are erroneous.

    If the web services of WMS or WCS won't help solve the problem either, my last idea would be rather straightforward to ask the responsible authority of the "Landesamt für Vermessung, Geoinformation und Landentwicklung" in Saarbrücken directly in a mail, why the data as provided through the Geoportal won't work and whether they are able to provide you those for free (as the new law requires them). Contacts can be found here and here.

    Geodatenzentrum@umwelt.saarland.de
    shop@lvgl.saarland.de

    zas@lvgl.saarland.de
    verkauf@lvgl.saarland.de

    Other than that, and if all else fails, you might need to find another route project to work on.
     
    Last edited: Mar 11, 2025
  7. average425enjoyer

    average425enjoyer New Member

    Joined:
    Jan 31, 2024
    Messages:
    2
    Likes Received:
    0
    Hey hey. :) Funnily enough, I am currently dealing with the exact same problem as you. The GeoPortal of Saarland is a mess. However, after several hours wasted I have found a way to import the DGM1 layer into QGIS: The Rheinland-Pfalz people have created a plugin for QGIS (download and small tutorial here: https://github.com/mrmap-community/gprlp_metadata_search ) which also covers the Saarland area. However, when trying to export the layer (or parts of it), the GeoTIFF files again consist of three RGB bands, which is strange since the original layer has only one. The three band layer unfortunately does not allow retiling and translating. I have not been able to find a solution or workaround for this problem, but will keep you updated if I make any progress. Likewise, if you manage to get something working, please let me know. I was so excited to see that the Saarland has finally made their data open source because I wanted to build Saarbrücken Hbf to Trier since forever, but I am a *bit* frustrated about how they chose to do it :|
     
  8. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    Hey there, and nice to have a soulmate here :)
    I managed to get something promising into QGIS, but (once again) I ran into a weird issue.

    After doing some research on Web Coverage Services (WCS), I found out that, unlike Web Map Services (WMS) - which are mainly for visualization - WCS actually contains real geospatial data. So, after experimenting in QGIS, I successfully generated a „WCS layer“. These layers require a URL to the data source (which is linked here) and then generate a layer based on that data. (Surprisingly) it worked quite well!

    [​IMG]

    However, there's a problem. When you zoom in, it's clear that the resolution of the layer is nowhere near 1m, even though the source (which has DGM1 in its title, meaning a DEM with 1m resolution) explicitly states it should be. When comparing it to SRTM layers (which have a 30m resolution), it seems to match their quality instead. I'll investigate further, but for now, this is what I've achieved so far.

    [​IMG]
    (here you can see the resolution is obviously too low)

    If you’d like to try it out (and maybe find a solution :D), here’s how to import the pseudo-DGM1 layer (which you can see in the screenshots) from the WCS data source into QGIS:
    1. Open QGIS and select a project.
    2. Set the Project CRS to EPSG:28532 (bottom-right corner).
    3. Add the OSM Standard Layer using the QuickMapServices plugin:
      • If you don’t have the plugin yet:
        • Go to Plugins (top bar) → Manage and Install Plugins…
        • Select "All" (on the left panel)
        • Search for "QuickMapServices", select it, and click Install Plugin
        • Open the plugin window clicking its icon in the toolbar
        • Click Add Layer > OSM > OSM Standard
    4. Install the "Simple WCS 2" plugin using the same steps as above.
    5. Zoom to any location in Saarland (e.g., Saarbrücken). The exact area doesn’t matter for now, but make sure that the area on your canvas is entirely within the Saarland region - if it isn’t, you could run into problems later.
    6. Open the "Simple WCS 2" plugin window (click its icon in the top toolbar with all the symbols).
    7. Enter this as WCS 2.X URL in the input box:
      Code:
      https://geoportal.saarland.de/gdi-sl/inspireraster/inspirewcsel
    8. Set Version to 2.0.1.
    9. Click "Get Capabilities".
    10. Go to the "Get Coverage" tab (if it doesn’t open automatically).
    11. Click "Get Coverage".
    12. The WCS layer should now appear on the canvas :)
    I think I'm on the right track, but I might have overlooked something. The title of the service that can be found in the "Get Coverage" tab (can also be seen on the screenshots above) clearly suggests that the DEM should have a 1m resolution, so it might be a limitation within QGIS that I haven't discovered yet, but it could also be literally anything (like the Saarland is trying to bypass the new law ;) - but seriously, it’s kinda suspicious that this is the only state in Germany not making the LiDAR data accessible through a free download and still putting it behind a paywall on the only reliable-seeming source) As I said, I'll continue investigating.
    I’ll keep you updated on how it goes, but I'd still be very thankful for any advice! :)
     
    Last edited: Mar 31, 2025
  9. average425enjoyer

    average425enjoyer New Member

    Joined:
    Jan 31, 2024
    Messages:
    2
    Likes Received:
    0
    Very cool! Thanks! It is indeeed not 1 meter but it definitely is more detailed than the SRTM data. I also created LIDAR tiles from it, but the terrain is very chunky (maybe it's a 25 m model?). Very strange, but I will keep you updated, if I find a better solution. :) what route do you plan on working on?
     

    Attached Files:

    Last edited: Mar 13, 2025
  10. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    -- Update: March 31, 2025 --

    Some time has passed, but sadly I haven't really made any progress…
    The only real thing I've found out in the meantime is that QGIS is not the problem (I would have been surprised). I tried DEM1 WCS datasets from other regions and everything worked fine.
    I also tried to get a DEM with a resolution of 1m via this site (which also used the WCS data source), but without success. If I select a region there, for example in Rheinland-Pfalz, I get a 1m resolution DEM, but for the Saarland I get the same result as in my previous post (reply #8), or what average425enjoyer showed in the post above. I even tested an area where both states border each other and noticed that the DEM resolution changes along the border (so 1m in Rheinland-Pfalz, 25m or something like that in Saarland).
    I know how discouraging this sounds, but I'm really getting to the end of my rope. I just have no idea what else to try. Maybe I'll contact the people in charge, as law actually requires them to make the DEM1 freely available, but otherwise I'm running out of ideas :(
     
    Last edited: Apr 2, 2025
  11. WabbeLKonG

    WabbeLKonG Active Member

    Joined:
    Apr 19, 2024
    Messages:
    51
    Likes Received:
    103
    -- Update: April 16, 2024 --

    Hey there! :)
    Good news! Yesterday I contacted the LVGL, which is responsible for the DEM, and I got a reply! They told me that their platform for accessing open data is still being built, but kindly they also sent me a link to a cloud platform where all the data, including the DEM1, is contained. I'm currently on vacation so I can't try it out yet, but I can send you the link to the platform so you can access the data already: https://www.shop.lvgl.saarland.de/cloud/index.php/s/86rkmaCeGGHQyHE?path=/OD_DGM1_tiff_LK

    It seems to me like the data is organized by „Landkreis“ which is simply the next smallest administration unit after „Bundesland“. I’ll attach a map of the Saarland here, so you know what to download :D
     

    Attached Files:

    Last edited: Apr 16, 2025
    • Like Like x 2

Share This Page