Skip to contents

Get AHN raster area of a specified area.

AHN Area is retrieved through a circle (x, y and radius), BBOX (x, y and radius, OR BBOX coordinates), or own geometry (polygon).

AHN data is obtained from the AHN3 (default), AHN2 or AHN 1 from the available resolutions.

Available for the Digital Surface Model (DSM) and Digital Terrain Model (DTM).

You can download the AHN data using the WCS method (default, sheets.method = FALSE) returning a GeoTIFF format. The sheets method (sheets.method = TRUE) returns a regular raster GeoTIFF output file that is extracted from the PDOK sheets. The WCS method is recommended if only a few AHN elevation points need to be extracted. The sheets method always requires more data to be downloaded to the client but may be more efficient if many elevations need to be retrieved from a small area. Choosing your method depends on speed and your desired output format. See documentation for all available parameters.

Usage

ahn_area(
  name = "AHNarea",
  output.dir,
  X,
  Y,
  radius,
  bbox,
  polygon,
  AHN = "AHN",
  dem,
  resolution,
  sheets = list(),
  LONLAT = FALSE,
  sheets.method = FALSE,
  sheets.dir,
  sheets.keep = TRUE
)

Arguments

name

Optional. Give a name of the specified area. This name will be used in the output file names.

output.dir

Optional but unnecessary. Set location of output raster files. Leaving blank (default) will make all output point files be temporary files. This output directory excludes the location of the AHN sheets which is depicted with the sheets.dir parameter.

X

Required. X coordinate in RD New or WGS84 (LON).

Y

Required. Y coordinate in RD New or WGS84 (LAT).

radius

Required for circle or BBOX when no BBOX coordinates are provided. Set radius in meters of area around a point to create a buffer area (circle).

bbox

Required when using a BBOX. Create BBOX of an area. Use c(XMIN, YMIN, XMAX, YMAX) OR set to TRUE when a radius is provided. Use RD New or WGS84 (LONLAT) coordinates.

polygon

Required when create an area of custom geometry. Use spatial object as your area. Refer to sf which formats are supported for polygons.

AHN

Default 'AHN'. 'AHN' This is the latest full version made available by PDOK through their OGC Web services. Choose between 'AHN4', 'AHN3', 'AHN2', or 'AHN1'.

dem

Default 'DSM'. Choose type of Digital Elevation Model. 'DSM' or 'DTM'. AHN1 only has 'DTM'.

resolution

Default 0.5 meters for AHN2/AHN3/AHN4, 5 meters for AHN1. Choose resolution of AHN in meters. AHN3 and AHN2 both have 0.5 and 5 meters. AHN1 has 5 and 100 m.

sheets

Only required when only full AHN sheets need to be downloaded. To do so, fill the list() object with strings of the sheet numbers.

LONLAT

Optional. Default FALSE. Set to TRUE if X and Y are in Longitude and Latitude format. Output will be in RD New format.

sheets.method

Default FALSE. When TRUE, it downloads AHN area through the available GeoTIFF AHN sheets available on PDOK.

sheets.dir

Default is the 'AHN_sheets' directory in the working directory or output.dir (when defined). In this sheets directory all the AHN sheets are downloaded. If sheets already exists in this directory, they will be reused and no redownload will take place. Within this sheets directory, a directory structure will be created automatically: if sheets.dir is set to 'myFolder', all sheets will be downloaded in their appropriate AHN version and DEM folder. Eg. 'output.dir/myFolder/AHN_sheets/AHN4/DSM'. You want to use this parameter if you want to have a central location where all the AHN sheets are stored so that they can be accessed elsewhere for other purposes. It is recommended to always use the their original file name after download. Due to the size of these GeoTiff sheets, it is not allowed to download this is the RAM memory (tempdir).

sheets.keep

Default TRUE. Only applicable if sheets.method is set to TRUE and sheets were downloaded. Set to FALSE if you want to delete the downloaded sheet. It is recommended to keep the sheets if ahn elevation extraction will be followed.

Value

GeoTIFF file of AHN area

Author

Jelle Stuurman