The JPGIS (GML) format file provided by FGD as input, the digital elevation models in the file are read as a data.frame or spatial object (raster, stars or terra). Supporting FGD Version 4.1 (2016/10/31)
read_fgd_dem(file, resolution = c(5, 10), return_class)
Path to XML file
the number of dem mesh size resolution: 5m or 10m
one of return object class: 'data.table' for faster than data.frame, 'data.frame', 'raster', 'stars' or 'terra'
fgd_5dem <- system.file("extdata/FG-GML-0000-00-00-DEM5A-dummy.xml", package = "fgdr")
read_fgd_dem(fgd_5dem,
resolution = 5,
return_class = "data.table")
#> type value
#> 1: その他 -9999 [m]
#> 2: 地表面 -9999 [m]
#> 3: 海水面 -9999 [m]
#> 4: 地表面 -9999 [m]
#> 5: データなし NA [m]
#> ---
#> 33746: データなし NA [m]
#> 33747: データなし NA [m]
#> 33748: データなし NA [m]
#> 33749: データなし NA [m]
#> 33750: データなし NA [m]
read_fgd_dem(fgd_5dem,
resolution = 5,
return_class = "data.frame")
#> # A tibble: 33,750 × 2
#> type value
#> <chr> [m]
#> 1 その他 -9999
#> 2 地表面 -9999
#> 3 海水面 -9999
#> 4 地表面 -9999
#> 5 データなし NA
#> 6 その他 -9999
#> 7 内水面 -9999
#> 8 データなし NA
#> 9 内水面 -9999
#> 10 その他 -9999
#> # … with 33,740 more rows
# return as raster
read_fgd_dem(fgd_5dem,
resolution = 5,
return_class = "raster")
#> class : RasterLayer
#> dimensions : 150, 225, 33750 (nrow, ncol, ncell)
#> resolution : 5.555556e-05, 5.553333e-05 (x, y)
#> extent : 140.1, 140.1125, 36.075, 36.08333 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +ellps=GRS80 +no_defs
#> source : memory
#> names : layer
#> values : -9999, -9999 (min, max)
#>
# return as stars
fgd_10dem <- system.file("extdata/FG-GML-0000-10-dem10b-dummy.xml", package = "fgdr")
read_fgd_dem(fgd_10dem,
resolution = 10,
return_class = "stars")
#> stars object with 2 dimensions and 1 attribute
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
#> layer -9999 -9999 -9999 -9999 -9999 -9999 843741
#> dimension(s):
#> from to offset delta refsys point values x/y
#> x 1 1125 140 0.000111111 JGD2011 NA NULL [x]
#> y 1 750 36.0833 -0.000111107 JGD2011 NA NULL [y]