Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 0.5'' resolution height data #250

Open
evilstiefel opened this issue May 9, 2024 · 5 comments
Open

Add support for 0.5'' resolution height data #250

evilstiefel opened this issue May 9, 2024 · 5 comments

Comments

@evilstiefel
Copy link

Sonny has recently released new terrain data files for Austria and Switzerland (https://sonny.4lima.de/). The associated .HGT files seem to not fit into the array structure currently supported by Ortho4XP 1.40.

If it's not too much trouble, support for these files would be great (even though I understand that it might be pushing other parts of Ortho4XP or performance limits in XP12).

The following stack trace is produced by Ortho4XP when trying to build a tile:

Exception in thread Thread-2 (build_tile_list):
Traceback (most recent call last):
  File "C:\Users\Steffen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\Steffen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Tools\Ortho4XP_Git\.\src\O4_Tile_Utils.py", line 251, in build_tile_list
    VMAP.build_poly_file(tile)
  File "D:\Tools\Ortho4XP_Git\.\src\O4_Vector_Map.py", line 53, in build_poly_file
    (apt_array, apt_area) = include_airports(vector_map, tile)
  File "D:\Tools\Ortho4XP_Git\.\src\O4_Vector_Map.py", line 207, in include_airports
    tile.dem = DEM.DEM(
  File "D:\Tools\Ortho4XP_Git\.\src\O4_DEM_Utils.py", line 48, in __init__
    self.load_data(source, info_only)
  File "D:\Tools\Ortho4XP_Git\.\src\O4_DEM_Utils.py", line 98, in load_data
    ) = build_combined_raster(
  File "D:\Tools\Ortho4XP_Git\.\src\O4_DEM_Utils.py", line 397, in build_combined_raster
    alt_dem[by:-by, by:-by] = tmparray
ValueError: could not broadcast input array from shape (7201,7201) into shape (3601,3601)

Manually editing the code to increase the array size to 7201 works for some tiles (although I don't know if the results in sim make sense), but still error out for others.

@d41k4n
Copy link
Collaborator

d41k4n commented May 9, 2024

IMO the trickiest part for this to work automatically (incl. download ) are the limitations of having to download the files from Google Drive programmatically (i.e. not using a browser that runs JavaScript). Also, I was unable to download the zip files using an anonymous browser session (tested with Firefox and Chrome) which seems to indicate that an authenticated Google account is required... Again, not trivial to do programmatically...

I understand this issue is only about the raster array size but thought I'd drop that here nonetheless.

@d41k4n
Copy link
Collaborator

d41k4n commented May 9, 2024

Curiously, are you able to create the tile with Ortho4XP 1.30?

@evilstiefel
Copy link
Author

evilstiefel commented May 9, 2024

No, I'm using the current Git master branch, which is basically beta 1.40

Edit: ah I see what you mean, no, 1.30 unsurprisingly throws a similar stack trace

Exception in thread Thread-2:
Traceback (most recent call last):
  File "threading.py", line 917, in _bootstrap_inner
  File "threading.py", line 865, in run
  File "src\O4_Tile_Utils.py", line 158, in build_tile_list
  File "src\O4_Vector_Map.py", line 42, in build_poly_file
  File "src\O4_Vector_Map.py", line 137, in include_airports
  File "src\O4_DEM_Utils.py", line 40, in __init__
  File "src\O4_DEM_Utils.py", line 62, in load_data
  File "src\O4_DEM_Utils.py", line 229, in build_combined_raster
ValueError: could not broadcast input array from shape (7201,7201) into shape (3601,3601)

@d41k4n
Copy link
Collaborator

d41k4n commented May 9, 2024

Ok so it seems this is not 1.40 specific.

FWIW: I was unable to reproduce the problem when I manually select the .hgt file as a value for custom_dem (tested with +47+009).

I therefore assume you left custom_dem empty?

FYI: By leaving custom_dem empty Ortho4XP will fall back to the default DEM provider (viewfinderpanoramas.org) and therefore only expects to see rasters with resolutions 1201x1201 or 3601x3601.

In other words: Ortho4XP supports 0.5" DEMs just fine, as long as the file (either .tif or .hgt) is selected manually for each tile.

IMO the cleanest solution to your problem would be to add a new elevation data provider for Sonny's DTM's including automatic downloads, but that is likely not trivial due to the reasons I mentioned earlier.

@evilstiefel
Copy link
Author

evilstiefel commented May 13, 2024

Thanks for the heads-up: I actually downloaded the HGT files manually and put them into the folder where the default data would be downloaded into, hence "replacing" the viewfinderpanorama downloads and skipping automatic downloading of the files. This has worked flawlessly for all previous releases from sonny (I basically have manually downloaded 1''-resolution from sonny for the entirety of Europe and pretend it's default data).

I didn't want to manually edit 30+ tile config files and select a custom DEM. But maybe I'll just try that in the meantime. Didn't know manually selecting the files would handle them in a different manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants