Skip to content

hypertidy/tilemath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tilemath

The goal of tilemath is to encapsulate the logic needed for image pyramids, tile servers, etc.

I’m working on my habits here. Inspired by slippymath and GDAL.

Installation

You can install the development version of tilemath like so:

remotes::install_github("hypertidy/tilemath")

Example

This is a basic example which shows you how to solve a common problem:

library(tilemath)
x <- tiles_near(147.33, -42.88)
str(x)
#> 'data.frame':    9 obs. of  7 variables:
#>  $ x   : int  7447 7448 7449 7447 7448 7449 7447 7448 7449
#>  $ y   : int  5177 5177 5177 5178 5178 5178 5179 5179 5179
#>  $ zoom: int  13 13 13 13 13 13 13 13 13
#>  $ xmin: num  16392991 16397883 16402775 16392991 16397883 ...
#>  $ xmax: num  16397883 16402775 16407667 16397883 16402775 ...
#>  $ ymin: num  -5293111 -5293111 -5293111 -5298003 -5298003 ...
#>  $ ymax: num  -5288219 -5288219 -5288219 -5293111 -5293111 ...
#>  - attr(*, "extent_snapped")= num [1:4] 16392991 16407667 -5302895 -5288219
ex <- c(min(x$xmin), max(x$xmax), min(x$ymin), max(x$ymax))

## what shape is that (tiles_near assumes 256x256)
nx <- length(unique(x$x))
ny <- length(unique(x$y))
overall_dim <- c(nx, ny) * 256

m <- vapour::gdal_raster_nara(sds::wms_virtualearth(), target_ext  = ex, target_dim = overall_dim)
ximage::ximage(m, asp = 1)

Code of Conduct

Please note that the tilemath project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

About

Tile Math for Map Tile Pyramids

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages