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)
## Type len Def Constr Req Tunable Trafo
## coords numericvector 2 - 1,1 to 408,204 - TRUE -
sf(c(204,103))
## [1] 343
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)
## Type len Def Constr Req Tunable Trafo
## coords numericvector 2 - 1,1 to 1.08e+03,276 - TRUE -
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)