Skip to content

Commit

Permalink
begin add tasmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed May 10, 2023
1 parent 3edf52e commit 6e93d6a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
38 changes: 38 additions & 0 deletions R/gdal.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,41 @@ gdal_terrainrgb <- function (extent = c(-180, 180, -90, 90), ..., dimension = NU
nrow = attr(vals, "dimension")[2L], crs = "EPSG:3857", vals = d)
xraster
}




gdal_tasmap <- function (extent = c(-180, 180, -90, 90), ..., dimension = NULL,
projection = "OGC:CRS84", resample = "near", source = NULL)
{
xraster <- extent
x <- format_out(list(extent = extent, dimension = dimension,
projection = projection))



src <- tasmap_ortho


if (is.null(source)) {
rso <- src
} else {
rso <- source
}
if (is.na(x$projection)) {
message("no projection specified, calling warper without a target projection: results not guaranteed")
x$projection <- ""
}
suppressWarnings(

vals <- vapour::gdal_raster_image(rso, target_ext = x$extent,
target_dim = x$dimension, target_crs = x$projection,
resample = resample, ..., bands = 1:3)
)


xraster <- terra::rast(terra::ext(attr(vals, "extent")),
ncol = attr(vals, "dimension")[1L],
nrow = attr(vals, "dimension")[2L], crs = "EPSG:3857", vals = unlist(vals))
xraster
}
3 changes: 2 additions & 1 deletion R/locale.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ cc_location <- function(loc = NULL, buffer = 5000,
d <- switch(type,
mapbox.satellite = gdal_mapbox(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"),
"elevation-tiles-prod" = gdal_aws(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"),
"mapbox.terrain-rgb" = gdal_terrainrgb(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"))
"mapbox.terrain-rgb" = gdal_terrainrgb(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"),
"tasmap_ortho" = gdal_tasmap(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"))
d
}

Expand Down
11 changes: 11 additions & 0 deletions R/tasmap.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tasmap_layers <- tibble::tribble(
~Name, ~ServiceUrl,
"TTSA", "https://services.thelist.tas.gov.au/arcgis/services/Raster/TTSA/MapServer/WMSServer?",
"ESgisMapBookPUBLIC", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/ESgisMapBookPUBLIC/MapServer/WMSServer",
"HillshadeGrey", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/HillshadeGrey/MapServer/WMSServer?",
"Tasmap250K", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Tasmap250K/MapServer/WMSServer?",
"Topographic","https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Topographic/MapServer/WMSServer?"
)


tasmap_ortho <- "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Orthophoto/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data%20Boundaries&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454"

0 comments on commit 6e93d6a

Please sign in to comment.