Ga naar inhoud

AHN

Download hoogtegegevens met download_ahn. Kies het gebied, de AHN-versie en het hoogtemodel (dtm of dsm).

Bekijk het downloadvoorbeeld

Hoogtegegevens downloaden · download_ahn

waterlagen.ahn.download_ahn

Python-aanroep
download_ahn(
    ahn_dir=None,
    poly_mask=None,
    select_indices=None,
    model="dtm",
    cell_size="05",
    ahn_version=4,
    service="ahn_pdok",
    missing_only=True,
    create_vrt=True,
    save_tiles_index=False,
    *,
    tile_index=None,
    tile_directory=None,
    retries=10,
    timeout=DEFAULT_HTTP_TIMEOUT,
)

Download AHN rasters with validated, atomic tile replacement.

Downloads AHN DTM or DSM rasters on 0.5 m or 5 m resolution. Each response is written to a temporary TIFF beside its target, processed, closed, reopened, and validated before it atomically replaces the final tile. A valid existing tile is reused with missing_only=True. An invalid existing tile is removed and downloaded again.

Wat krijgt u terug?

Type Betekenis
Path

Bij create_vrt=True het pad naar het VRT-mozaïek, anders de map met de gedownloade tegels.

Instellingen en invoer

Naam Type Betekenis Standaardwaarde
ahn_dir Path

Parent directory for an explicit destination. The standard terrain product defaults to the configured AHN generation directory.

None
poly_mask Polygon | None

Mask to select ahn-tiles, by default None

None
select_indices list[str] | None

Indices to select, by default None

None
model Literal['dtm', 'dsm']

Maaiveldmodel (dtm) of oppervlaktemodel inclusief objecten (dsm).

'dtm'
cell_size Literal['05', '5']

Celgrootte van 0,5 of 5 meter. PDOK ondersteunt alleen 0,5 meter.

'05'
ahn_version int

AHN-generatie (3, 4, 5 of 6). Gebruik bij PDOK versie 4.

4
service Literal['ahn_pdok', 'ahn_nl']

Switch for using pdok.nl or ahn.nl for downloading ahn_data

'ahn_pdok'
missing_only bool

Only download rasters not yet existing in download_dir, by default True

True
create_vrt bool

Create a vrt-file so all tiles can be opened as one, by default True

True
save_tiles_index bool

Save the tile index as a GeoPackage in the download-dir, by default False

False
tile_index geopandas.GeoDataFrame

Prepared index with tile identifiers and service download URLs. Avoids an index network request; source data and CRS must match the service.

None
retries int

Maximum total download attempts for each tile, by default 10. Set to 0 to make every requested tile fail without an HTTP request.

10
timeout float

HTTP connection and read inactivity timeout in seconds for the tile index and each tile request. Defaults to DEFAULT_HTTP_TIMEOUT; this is not a total download time limit.

DEFAULT_HTTP_TIMEOUT
Ontbrekende hoogten interpoleren · interpolate_ahn_tiles

waterlagen.ahn.interpolate_ahn_tiles

interpolate_ahn_tiles(
    ahn_vrt_file,
    indices=None,
    max_search_distance=100,
    dir_name="ahn_filled",
    create_vrt=True,
    missing_only=False,
)

Interpolate ahn raster tiles

Wat krijgt u terug?

Type Betekenis
Path

Path to VRT-file (create_vrt=True) or destination directory

Instellingen en invoer

Naam Type Betekenis Standaardwaarde
ahn_vrt_file Path

VRT file referring to AHN tiles

Verplicht
indices list[str] | None

Optional selection of AHN tiles to interpolate, by default None

None
max_search_distance float

Set search_distance for neighbor search and interpolation distance. By default set to 100

100
dir_name str

Optional output dir-name within datastore to store result, by default "ahn_filled"

'ahn_filled'
create_vrt bool

Switch for generating a vrt-file for resulting rasters, by default True

True
missing_only bool

Interpolate only rasters that haven't been interpolated yet, by default False

False

Redactie: AI