hypertidy/ceramic

ceramic_tiles() not robust to zero files

Closed this issue · 3 comments

> clear_ceramic_cache(clobber = TRUE)
139 cache files removed.
> ceramic_tiles(zoom = 13)
 Error in strsplit(toks3, "\\D") : non-character argument 

Also not finding these tiles:

(no plot of the geometry)

library(ceramic)
## a point in longlat, and a buffer with in metres
pt <- cbind(136, -34)
im <- cc_location(pt, buffer = c(1e6, 5e5), type = "mapbox.satellite")
library(raster)
plotRGB(im)

## get the matching tiles (zoom is magic here, it's all wrapped - needs thought)

tiles <- ceramic_tiles(zoom = 6, type = "mapbox.satellite")
library(sf)
plot(st_geometry(ceramic:::tiles_to_polygon(tiles)), add = TRUE)
middle <- function(x, y) {
  x + (y - x)/2
}
text(middle(tiles$xmin, tiles$xmax), middle(tiles$ymin, tiles$ymax), lab = sprintf("[%i,%i]", tiles$tile_x, tiles$tile_y), 
     col = "firebrick")

this needs a re-work especially given MVT downloading and check AWS, and see #30

fixed