Packages

A small library that provides a simple interface to query locations on the earth for elevation data from the NASA Shuttle Radar Topography Mission (SRTM)

Current section

Files

Jump to
srtm lib source cache.ex
Raw

lib/source/cache.ex

defmodule SRTM.Source.Cache do
use SRTM.Source
@moduledoc false
alias SRTM.Client
@impl true
def fetch(%Client{cache_path: cache_path}, {lat, lng}) do
hgt_path = Path.join([cache_path, name(lat, lng) <> ".hgt"])
if File.exists?(hgt_path) do
{:ok, hgt_path}
else
{:error, :not_loaded}
end
end
end