Skip to contents

This function converts w80-files, an ascii-format with 80 characters per line for spatial point data used by the German Waterways and Shipping Administration (WSV). Every single row codes for one point:

|_1_|2_|_3______|4|____________5______________|_______6_______|_____7___|_8_|

W0701 55 2594611 1330938065557502425901108035 5795591108035 Bu.15 01

W0701 57 2594611 7330932961457502484041108035 5538181108035 Bu.15 01

Within each row very specific sections code for specific attributes:

section column(s) attribute column name in result
1 1 state id, here W=WSV sid
1 2-5 Federal Waterway ID fwid
2 6-8 WSV point type wsvpt
3 9 blank -
3 10-15 river station (km) station
4 16 bank: 1 left, 2 right bank
4 17-20 continuous id id
5 21-30 easting in GK-coordinates x
5 31-40 northing in GK-coordinates y
6 41-46 datum of measurement date_coor
6 47 accuracy acc_coor
6 48-54 elevation z
6 55-60 date of the elevation measurement date_z
6 61 accuracy of the elevation measurement acc_z
6 62-64 type of measurement tom
7 65-84 comment comment
8 85-86 point status status

In a second step these points are aggregated to a sfc_LINESTRING using the grouping column id.

Usage

w80ToSFL(
  filename,
  crs,
  id = c("sid", "fwid", "wsvpt", "station", "bank", "id", "x", "y", "date_coor",
    "acc_coor", "z", "date_z", "acc_z", "tom", "comment", "status", "lat", "lon",
    "station_int", "station_c")
)

Arguments

filename

argument of length 1 and type character specifying an existing w80-file.

crs

argument of type crs or crs.

id

argument of type character specifying a grouping column.

Value

sfc_LINESTRING.

Examples

  options("hydflood.datadir" = tempdir())
  library(hydflood)
  c <- st_crs("EPSG:25833")
  filename <- tempfile(fileext = ".w80")
  
  # write temporary w80 file
  cat("W0701 55 2594611   1330938065557502425901108035 5795591108035         Bu.15   01\n",
      file = filename)
  cat("W0701 57 2594611   7330932961457502484041108035 5538181108035         Bu.15   01\n",
      file = filename, append = TRUE)
  
  # import temporary w80 file as sf LINESTRING
  sl <- w80ToSFL(filename, c, "station_int")