set.seed(123) knitr::opts_chunk$set(cache = TRUE, collapse = FALSE) library(geo2smoof)
This Vignette is supposed to give you a short introduction and a glance at the key features of geo2smoof
.
For updated information make sure to check the GitHub project page:
geo2smoof truns a elevation map into a function that returns the elevation for given coordinate input. More precisely this package generates smoof functions as these contain valuable meta information for each function.
alt_s = raster::getData('alt', country='SVN', mask = FALSE) sf = convertRasterLayerToSmoof(raster.layer = alt_s) getParamSet(sf) sf(c(204,103)) plot2DNumeric(sf, render.levels = TRUE, n.samples = 200)
Generating a function out of the subsection of the alps:
alt_d = raster::getData('alt', country='DEU') alt_a = raster::getData('alt', country='AUT') alt_c = raster::getData('alt', country='CHE', mask = FALSE) alt_i = raster::getData('alt', country='ITA') alt_all = do.call(raster::merge, list(alt_d, alt_a, alt_c, alt_i, alt_s)) alt_cropped = raster::crop(alt_all, raster::extent(7,16,45.5,47.8)) sf = convertRasterLayerToSmoof(raster.layer = alt_cropped) getParamSet(sf) plot2DNumeric(sf, render.levels = TRUE, n.samples = 200)
You can register for a free API-Key here.
Afterwards you can save it using saveGeo2SmoofConfig()
or write it manually in every call of convertGoogleApiToSmoof()
.
We will not use an API-Key here and thus are limited to just a few calls
lat.range = c(28.5, 27.5) lon.range = c(86.5, 87.5) gsf = convertGoogleApiToSmoof(lat.range = lat.range, lon.range = lon.range) gsf(c(29,87)) plot2DNumeric(gsf, render.levels = TRUE, n.samples = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.