Skip to content

Commit

Permalink
tasmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed May 10, 2023
1 parent 6e93d6a commit 8846a48
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 22 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ceramic dev

* Added a suite of Tasmap sources for 'cc_location()'.


# ceramic 0.8.0

Expand Down
7 changes: 4 additions & 3 deletions R/gdal.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,16 @@ gdal_terrainrgb <- function (extent = c(-180, 180, -90, 90), ..., dimension = NU


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



src <- tasmap_ortho
if (type == "tasmap") type <- "orthophoto"

src <- tasmap_sources[type]


if (is.null(source)) {
Expand Down
17 changes: 10 additions & 7 deletions R/locale.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
#' `cc_elevation` does extra work to unpack the DEM tiles from the RGB format.
#'
#' Available types are 'elevation-tiles-prod' for AWS elevation tiles, and 'mapbox.satellite',
#' and 'mapbox.terrain-rgb'.
#' and 'mapbox.terrain-rgb', 'tasmap' or one of 'tasmap_street' (TTSA), 'tasmap_aerialphoto2020', 'tasmap_aerialphoto2021', 'tasmap_aerialphoto2022',
#' 'tasmap_aerialphoto2023', 'tasmap_esgismapbookpublic', 'tasmap_hillshadegrey', 'tasmap_hillshade', 'tasmap_orthophoto',
#' 'tasmap_simplebasemap', 'tasmap_tasmap100k', 'tasmap_tasmap250k', 'tasmap_tasmap25k', 'tasmap_tasmap500k', 'tasmap_tasmapraster', 'tasmap_topographicgrayscale', 'tasmap_topographic'.
#'
#' Note that arguments `max_tiles` and `zoom` are mutually exclusive. One or both must be `NULL`. If
#' both are NULL then `max_tiles = 16L`.
#'
#' Currently must be considered in-development.
#'
#' @param loc a longitude, latitude pair of coordinates, or a spatial object
#' @param buffer with in metres to extend around the location, ignored if 'loc' is a spatial object with extent
Expand Down Expand Up @@ -61,11 +62,13 @@ cc_location <- function(loc = NULL, buffer = 5000,
# return(invisible(NULL))
#}

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"),
"tasmap_ortho" = gdal_tasmap(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"))
if (type == 'mapbox.satellite') d<- gdal_mapbox(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857")
if (type == "elevation-tiles-prod") d <- gdal_aws(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857")
if (type == "mapbox.terrain-rgb") d <- gdal_terrainrgb(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857")
if (grepl("tasmap", type)) {
if (type == "tasmap") type <- "tasmap_orthophoto"
d <- gdal_tasmap(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857", type = gsub("tasmap_", "", type))
}
d
}

Expand Down
41 changes: 32 additions & 9 deletions R/tasmap.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
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_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?"
# )
#

## bases, gsub("/", "_", bases)
template <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/%s/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=%s,tilematrixset=default028mm"
bases <-
c("Basemaps/AerialPhoto2020", "Basemaps/AerialPhoto2021", "Basemaps/AerialPhoto2022",
"Basemaps/AerialPhoto2023", "Basemaps/ESgisMapBookPUBLIC", "Basemaps/HillshadeGrey",
"Basemaps/Hillshade", "Basemaps/Orthophoto", "Basemaps/SimpleBasemap",
"Basemaps/Tasmap100K", "Basemaps/Tasmap250K", "Basemaps/Tasmap25K",
"Basemaps/Tasmap500K", "Basemaps/TasmapRaster", "Basemaps/TopographicGrayScale",
"Basemaps/Topographic")

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"
names <- unlist(lapply(strsplit(bases, "/"), "[", 2))

tasmap_sources <- sprintf(template, bases, gsub("/", "_", bases))
names(tasmap_sources) <- tolower(names)
## bit more work needed
tasmap_sources <- c(tasmap_sources, street = "https://services.thelist.tas.gov.au/arcgis/rest/services/Raster/TTSA/MapServer/WMTS/1.0.0/WMTSCapabilities.xml")
# tasmap_sources <- c(
# 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",
# street = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Raster/TTSA/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" ,
# mapbook = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/ESgisMapBookPUBLIC/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454",
# hillshade = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/HillshadeGrey/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" ,
# tasmap250 = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Tasmap250K/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" ,
# topo = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Topographic/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",
# tasmap500 = "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Tasmap500K/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=Basemaps_Tasmap500K,tilematrixset=default028mm")
31 changes: 31 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ options(warn = -1)
The goal of ceramic is to obtain web map tiles. Use a spatial object to define the region of interest.




```{r extent1}
library(ceramic)
roi <- ext(100, 160, -50, 10)
Expand Down Expand Up @@ -196,6 +198,35 @@ par(op)
```


## Tasmap maps


```{r tasmap}
library(ceramic)
library(terra)
template <- rast(ext(527358, 527880, 5252204, 5252704), res = 2, crs = "EPSG:32755")
ortho <- cc_location(template, type = "tasmap_orthophoto")
plot(ortho)
plot(cc_location(template, type = "tasmap_street"))
plot(cc_location(template, type = "tasmap_tasmapraster"))
plot(cc_location(template, type = "tasmap_hillshade"))
plot(cc_location(template, type = "tasmap_hillshadegrey"))
plot(cc_location(template, type = "tasmap_esgismapbookpublic")) ## nope
plot(cc_location(template, type = "tasmap_topographic"))
plot(cc_location(template, type = "tasmap_tasmap25k")) ## also 100k, 250k, 500k
```





---

Expand Down
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,67 @@ text(middle(tiles$xmin, tiles$xmax), middle(tiles$ymin, tiles$ymax), lab = sprin
par(op)
```

## Tasmap maps

``` r
library(ceramic)
library(terra)
template <- rast(ext(527358, 527880, 5252204, 5252704), res = 2, crs = "EPSG:32755")
ortho <- cc_location(template, type = "tasmap_orthophoto")

plot(ortho)
```

<img src="man/figures/README-tasmap-1.jpeg" width="100%" />

``` r

plot(cc_location(template, type = "tasmap_street"))
```

<img src="man/figures/README-tasmap-2.jpeg" width="100%" />

``` r

plot(cc_location(template, type = "tasmap_tasmapraster"))
```

<img src="man/figures/README-tasmap-3.jpeg" width="100%" />

``` r

plot(cc_location(template, type = "tasmap_hillshade"))
```

<img src="man/figures/README-tasmap-4.jpeg" width="100%" />

``` r

plot(cc_location(template, type = "tasmap_hillshadegrey"))
```

<img src="man/figures/README-tasmap-5.jpeg" width="100%" />

``` r
plot(cc_location(template, type = "tasmap_esgismapbookpublic")) ## nope
```

<img src="man/figures/README-tasmap-6.jpeg" width="100%" />

``` r
plot(cc_location(template, type = "tasmap_topographic"))
```

<img src="man/figures/README-tasmap-7.jpeg" width="100%" />

``` r


plot(cc_location(template, type = "tasmap_tasmap25k")) ## also 100k, 250k, 500k
```

<img src="man/figures/README-tasmap-8.jpeg" width="100%" />

------------------------------------------------------------------------

Please note that the ‘ceramic’ project is released with a [Contributor
Expand Down
6 changes: 3 additions & 3 deletions man/cc_location.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added man/figures/README-tasmap-1.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-2.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-3.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-4.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-5.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-6.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-7.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-tasmap-8.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8846a48

Please sign in to comment.