-
Notifications
You must be signed in to change notification settings - Fork 4
/
horizonator.docstring
64 lines (44 loc) · 2.18 KB
/
horizonator.docstring
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Rendering of SRTM terrain from Python
SYNOPSIS
import horizonator
import cv2
h = horizonator.horizonator(34.2884, -117.7134,
3600, 450)
(image, ranges) = h.render(-40, 100)
print(image.shape)
===> (450, 3600, 3)
print(ranges.shape)
===> (450, 3600)
cv2.imwrite("iron-mountain.png", image)
The horizonator tool renders SRTM topography to simulate views at any location
where this data is available. The general call sequence is
- h = horizonator.horizonator(...)
- h.render(...)
- h.render(...)
- h.render(...)
The constructor loads the DEMs centered around some point, and each render(...)
call produces images based on looking at those DEMs from different locations.
The constructor is relatively slow, and the render(...) calls are relatively
fast.
ARGUMENTS
The __init__() function takes
- lat, lon: the latitude and longitude of the center point, around which the
DEMs are loaded. Initially the camera is positioned at this center point, but
this may be moved around with each subsequent render() call
- width, height: the dimensions of the images we will be producing
- render_texture: optional boolean, defaulting to False. if not render_texture:
we color-code the resulting image by distance. If render_texture: we use
openstreetmap tiles to texture the image
- SRTM1: optional boolean, defaulting to False. By default we use 3" SRTM data.
Currently every triangle in the grid is rendered. This is inefficient, but the
higher-resolution 1" SRTM tiles would make it use 9 times more memory and
computational resources, so sticking with the lower-resolution 3" SRTM data is
recommended for now
- dir_dems: optional string, defaulting to "~/.horizonator/DEMs_SRTM3". The path
to the .hgt files containing the SRTM DEMs
- dir_tiles: optional string, defaulting to "~/.horizonator/tiles". Ths
OpenStreetMap tiles are downloaded and stored here.
- allow_downloads: optional boolean, defaulting to True. If True: we try to
download missing OpenStreetMap tiles.
- radius: optional integer, with some reasonable default. Specifies the size of
the DEM to load. This many cells are loaded to the N, S, E and W of the viewer.