---
title: "elevation-sources"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{elevation-sources}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

whatarelief provides two sources of topography, the first is a global topography and bathymetry dataset for the entire world in longitude/latitude (at roughly 500m resolution). 


To use these with GDAL we prepend '/vsicurl/' which nominates the virtual handler to treat a url as a data source. 

```R
gebco <- "/vsicurl/https://public.services.aad.gov.au/datasets/science/GEBCO_2019_GEOTIFF/GEBCO_2019.tif"
srtm <- "/vsicurl/https://opentopography.s3.sdsc.edu/raster/COP30/COP30_hh.vrt"

```

GEBCO 2021 is a global bathymetric product released by the [General Bathymetric Chart of the Oceans (GEBCO)](https://www.gebco.net/data_and_products/gridded_bathymetry_data/gebco_2021/) The data was downloaded in its original NetCDF form and converted to tiled GeoTIFF with overviews (Cloud-optimized COG profile), and is provided by the Australian Antarctic Data Centre in COG form](https://data.aad.gov.au/metadata/GEBCO_2021_GEOTIFF). 



```R
writeLines(vapour:::gdalinfo_internal(gebco, json = FALSE))

Driver: GTiff/GeoTIFF
Files: /vsicurl/https://public.services.aad.gov.au/datasets/science/GEBCO_2019_GEOTIFF/GEBCO_2019.tif
Size is 86400, 43200
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
PROJ.4 string is:
'+proj=longlat +datum=WGS84 +no_defs'
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.004166666666667,-0.004166666666667)
Metadata domains:
  IMAGE_STRUCTURE
  (default)
  DERIVED_SUBDATASETS
Metadata:
  AREA_OR_POINT=Area
  elevation#long_name=Elevation relative to sea level
  elevation#sdn_parameter_name=Sea floor height (above mean sea level) {bathymetric height}
  elevation#sdn_parameter_urn=SDN:P01::ALATZZ01
  elevation#sdn_uom_name=Metres
  elevation#sdn_uom_urn=SDN:P06::ULAA
  elevation#standard_name=height_above_reference_ellipsoid
  elevation#units=m
  lat#axis=Y
  lat#long_name=latitude
  lat#sdn_parameter_name=Latitude north
  lat#sdn_parameter_urn=SDN:P01::ALATZZ01
  lat#sdn_uom_name=Degrees north
  lat#sdn_uom_urn=SDN:P06::DEGN
  lat#standard_name=latitude
  lat#units=degrees_north
  lon#axis=X
  lon#long_name=longitude
  lon#sdn_parameter_name=Longitude east
  lon#sdn_parameter_urn=SDN:P01::ALONZZ01
  lon#sdn_uom_name=Degrees east
  lon#sdn_uom_urn=SDN:P06::DEGE
  lon#standard_name=longitude
  lon#units=degrees_east
  NC_GLOBAL#comment=The data in the GEBCO_2019 Grid should not be used for navigation or any purpose relating to safety at sea.
  NC_GLOBAL#Conventions=CF-1.6
  NC_GLOBAL#history=Information on the development of the data set and the source data sets included in the grid can be found in the data set documentation available from https://www.gebco.net
  NC_GLOBAL#institution=On behalf of the General Bathymetric Chart of the Oceans (GEBCO), the data are held at the British Oceanographic Data Centre (BODC).
  NC_GLOBAL#node_offset=1
  NC_GLOBAL#references=DOI: 10.5285/836f016a-33be-6ddc-e053-6c86abc0788e
  NC_GLOBAL#source=The GEBCO_2019 Grid is the latest global bathymetric product released by the General Bathymetric Chart of the Oceans (GEBCO) and has been developed through the Nippon Foundation-GEBCO Seabed 2030 Project. This is a collaborative project between the Nippon Foundation of Japan and GEBCO. The Seabed 2030 Project aims to bring together all available bathymetric data to produce the definitive map of the world ocean floor and make it available to all.
  NC_GLOBAL#title=The GEBCO_2019 Grid - a continuous terrain model for oceans and land at 15 arc-second intervals
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
  LAYOUT=COG
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=512x512 Type=Float32, ColorInterp=Gray
  NoData Value=9.96920996838686905e+36
  Overviews: 43200x21600, 21600x10800, 10800x5400, 5400x2700, 2700x1350, 1350x675, 675x337, 337x168
  Unit Type: m
  Metadata domains:
    (default)
  Metadata:
    long_name=Elevation relative to sea level
    NETCDF_VARNAME=elevation
    sdn_parameter_name=Sea floor height (above mean sea level) {bathymetric height}
    sdn_parameter_urn=SDN:P01::ALATZZ01
    sdn_uom_name=Metres
    sdn_uom_urn=SDN:P06::ULAA
    standard_name=height_above_reference_ellipsoid
    units=m
```

The Copernicus DEM is a Digital Surface Model (DSM) which represents the surface of the Earth including buildings, infrastructure and vegetation. This DSM is derived from an edited DSM named WorldDEM, where flattening of water bodies and consistent flow of rivers has been included. In addition, editing of shore- and coastlines, special features such as airports, and implausible terrain structures has also been applied. [OpenTopography data source](https://portal.opentopography.org/raster?opentopoID=OTSDEM.032021.4326.3) URIs of GeoTIFF files that are
all included in one VRT (GDAL virtual format) file. 

```R
writeLines(vapour:::gdalinfo_internal(srtm, json = FALSE))

...
/vsicurl/https://opentopography.s3.sdsc.edu/raster/COP30/COP30_hh/Copernicus_DSM_COG_10_S07_00_E026_00_DEM.tif
Size is 1296005, 626400
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
PROJ.4 string is:
'+proj=longlat +datum=WGS84 +no_defs'
Origin = (-180.001388888888897,84.000138888888884)
Pixel Size = (0.000277777777778,-0.000277777777778)
Metadata domains:
  DERIVED_SUBDATASETS
Corner Coordinates:
Upper Left  (-180.0013889,  84.0001389) (180d 0' 5.00"W, 84d 0' 0.50"N)
Lower Left  (-180.0013889, -89.9998611) (180d 0' 5.00"W, 89d59'59.50"S)
Upper Right ( 180.0000000,  84.0001389) (180d 0' 0.00"E, 84d 0' 0.50"N)
Lower Right ( 180.0000000, -89.9998611) (180d 0' 0.00"E, 89d59'59.50"S)
Center      (  -0.0006944,  -2.9998611) (  0d 0' 2.50"W,  2d59'59.50"S)
Band 1 Block=128x128 Type=Float32, ColorInterp=Gray
  Metadata domains:
    LocationInfo
```

Show spatial coverage of SRTM tiles ... TBD






## References

GEBCO Compilation Group (2021) GEBCO 2021 Grid (doi:10.5285/c6612cbe-50b3-0cff-e053-6c86abc09f8f)

European Space Agency, Sinergise (2021). Copernicus Global Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G9028PQB. Accessed: 2022-07-19


