Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add USGS tileset options #23

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions R/get_maptypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#'
#' \code{"esri"}: Esri (\url{https://www.esri.com/en-us/home})
#'
#' \code{"usgs"}: USGS (\url{https://basemap.nationalmap.gov/arcgis/rest/services})
#'
#' @examples
#' # for all services
#' get_maptypes()
Expand Down
14 changes: 11 additions & 3 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ out <- function(input, type = 1, ll = NULL, msg = FALSE, sign = "", verbose = ge
# download tiles
url <- paste0(
getOption("basemaps.map_api")[[map_service]][[map_type]], tg$zoom, "/", # base URL
if(map_service == "esri") paste0(x[2], "/", x[1]) else paste0(x[1], "/", x[2]), # coordinate order
if(any(map_service != "mapbox", all(map_service == "mapbox", map_type == "terrain"))) ".png", # file suffix or not
if(map_service %in% list("esri", "usgs")) paste0(x[2], "/", x[1]) else paste0(x[1], "/", x[2]), # coordinate order
if(any(!(map_service %in% list("mapbox", "usgs")), all(map_service == "mapbox", map_type == "terrain"))) ".png", # file suffix or not
if(map_service == "mapbox") paste0("?access_token=", map_token), # token or not
if(map_service == "osm_thunderforest") paste0("?apikey=", map_token) # token or not
)
Expand Down Expand Up @@ -501,7 +501,15 @@ out <- function(input, type = 1, ll = NULL, msg = FALSE, sign = "", verbose = ge
world_reference_overlay = "https://services.arcgisonline.com/arcgis/rest/services/Reference/World_Reference_Overlay/MapServer/tile/",
world_transportation = "https://services.arcgisonline.com/arcgis/rest/services/Reference/World_Transportation/MapServer/tile/",
delorme_world_base_map = "https://services.arcgisonline.com/arcgis/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/",
world_navigation_charts = "https://services.arcgisonline.com/arcgis/rest/services/Specialty/World_Navigation_Charts/MapServer/tile/")
world_navigation_charts = "https://services.arcgisonline.com/arcgis/rest/services/Specialty/World_Navigation_Charts/MapServer/tile/"
),
usgs = list(
hydro_cached = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/tile/",
imagery_only = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/",
imagery_topo = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/",
shaded_relief = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/tile/",
topo = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/"
)
))
if(!dir.exists(getOption("basemaps.defaults")$map_dir)) dir.create(getOption("basemaps.defaults")$map_dir)

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ This table lists all currently implemented map services and map types and indica
| `esri` | `world_transportation` | no |
| `esri` | `delorme_world_base_map` | no |
| `esri` | `world_navigation_charts` | no |
| `usgs` | `hydro_cached` (max zoom: 16) | no |
| `usgs` | `imagery_only` (max zoom: 16) | no |
| `usgs` | `imagery_topo` (max zoom: 16) | no |
| `usgs` | `shaded_relief` (max zoom: 16) | no |
| `usgs` | `topo` (max zoom: 16) | no |

## Available functions

Expand Down