Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active August 19, 2025 23:03
Show Gist options
  • Save mdsumner/39bd518172b22a85cc41078302cc031b to your computer and use it in GitHub Desktop.
Save mdsumner/39bd518172b22a85cc41078302cc031b to your computer and use it in GitHub Desktop.

From this URL, we remove the sidebar, and full-screen screenshot to this local PNG file, then georef from the url

https://tasmap.org/#9/-42.8830/147.0026

The file read here with rast() can be read directly with this, or itis attached below.

r <- rast("/vsicurl/https://private-user-images.githubusercontent.com/4107631/479547609-2127f648-d117-457b-ba01-6b181cdd5843.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTU2MTI0NzIsIm5iZiI6MTc1NTYxMjE3MiwicGF0aCI6Ii80MTA3NjMxLzQ3OTU0NzYwOS0yMTI3ZjY0OC1kMTE3LTQ1N2ItYmEwMS02YjE4MWNkZDU4NDMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDgxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA4MTlUMTQwMjUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTQ0NWJmNDk0M2NhNDUzMGI3Njg3YWQ3OWZiYmExMGYzNjY4Y2E4ZjM5OTU0YTNhNTk3YmMxZGE2NTZiMmQyYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.0TjLYya2nBjCNiO9po3uqGNK47gdW9b9x1JJPAiipXM")
## this URL and this screenshot are intimately tied, I screenshot at full screen with sidebar removed (title bar is 50 pixels, which we subtract below)
url <- "https://tasmap.org/#9/-42.8830/147.0026"
r <- terra::rast("2025-08-19 23_53_47-TasMap.org.png")

r <- terra::flip(r, "vertical")

## drop the top 50 rows (before we set the extent)
r <- terra::crop(r, terra::ext(0, ncol(r), 0, nrow(r) - 50))

tx <- strsplit(url, "/")
z <- as.integer(gsub("#", "", tx[[1]][[4]]))
ll <- matrix(as.numeric(unlist(tx[[1]][6:5])), ncol = 2)

crs <- "EPSG:3857"

## this is the centre point
xy <- terra::project(ll, to = crs, from = "EPSG:4326")

## this is the number of pixels
dm <- dim(r)[2:1]

## zero scale
z0 <- 20037508 * 2 / 256

## so width,height of image is
wh <-  dm * z0 / (2^z)

## so extent of it is

ex <- rep(xy, each = 2L) + c(-1, 1, -1, 1) * rep(wh, each = 2L)/2
 
terra::ext(r) <- terra::ext(ex)
terra::crs(r) <- crs
plotRGB(r, asp = 1)

m <- do.call(cbind, maps::map(plot = F)[1:2])
lines(project(m, to = crs, from = "EPSG:4326"), lwd = 4, col = "firebrick")


image
@mdsumner
Copy link
Author

2025-08-19 23_53_47-TasMap org

@mdsumner
Copy link
Author

Ok, listmap doesn't have an explicit url, but you can search for lat,long and then just hit the zoom level on the interface, and then it's exactly the same as the tasmap.org, so I got the layer I wanted:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment