All Projects → riatelab → maptiles

riatelab / maptiles

Licence: other
Download, compose and display map tiles with R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to maptiles

MapCompose
A fast, memory efficient Jetpack Compose library to display tiled maps, with support for markers, paths, and rotation.
Stars: ✭ 82 (+26.15%)
Mutual labels:  map, tiles
game-map-editor
game-map-editor
Stars: ✭ 17 (-73.85%)
Mutual labels:  map, tiles
MinedMap
Minecraft map renderer and viewer
Stars: ✭ 35 (-46.15%)
Mutual labels:  map
CXProvincesMapView
一个基于PaintCode绘制的中国省份地图框架
Stars: ✭ 49 (-24.62%)
Mutual labels:  map
geo-tree
High performance library for geographical map-related operations
Stars: ✭ 51 (-21.54%)
Mutual labels:  map
mapr
Map species occurrence data
Stars: ✭ 34 (-47.69%)
Mutual labels:  map
nycbikemap
A web-based, unified, interactive bike map for NYC that combines information from NYC OpenData, Citi Bike and other sources.
Stars: ✭ 15 (-76.92%)
Mutual labels:  map
opencage
🌐 R package for the OpenCage API -- both forward and reverse geocoding 🌐
Stars: ✭ 82 (+26.15%)
Mutual labels:  rspatial
ChinaMapView
自定义View,可缩放、可平移、可点击的中国地图,有中国地图的全部省份,具备每个省份的点击接口
Stars: ✭ 1,211 (+1763.08%)
Mutual labels:  map
amap
行政区域查询,根据经纬度快速地查找特定的行政区域信息、省市区信息、中国省市区数据。Administrative region query: to quickly find specific administrative region information based on latitude and longitude provincial information urban China data
Stars: ✭ 31 (-52.31%)
Mutual labels:  map
flowing-terrain
Algorithm for creating 3 dimensional terrain maps and their likely watercourses.
Stars: ✭ 27 (-58.46%)
Mutual labels:  map
o2d3m
Wavefront OBJ to Doom3 map converter.
Stars: ✭ 15 (-76.92%)
Mutual labels:  map
node-isochrone
NodeJS isochrone map library
Stars: ✭ 27 (-58.46%)
Mutual labels:  map
adaptive-composite-map-projections
Adaptive composite map projections combine several projections
Stars: ✭ 64 (-1.54%)
Mutual labels:  map
google streetview
A command line tool and module for Google Street View Image API
Stars: ✭ 77 (+18.46%)
Mutual labels:  map
Steam-Tiles
Pin Tiles of your games from Steam to the Windows 10 Start Menu
Stars: ✭ 20 (-69.23%)
Mutual labels:  tiles
vue-qqmap
基于Vue3的腾讯地图地址可视化拾取、描点,路径规划插件
Stars: ✭ 21 (-67.69%)
Mutual labels:  map
examples-android
Android demo application for GLMap framework
Stars: ✭ 14 (-78.46%)
Mutual labels:  map
eurostat-map.js
Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.
Stars: ✭ 32 (-50.77%)
Mutual labels:  map
atlas-for-rust
Atlas is an unofficial interactive map experience for Rust.
Stars: ✭ 34 (-47.69%)
Mutual labels:  map

maptiles

R-CMD-check codecov

To create maps from tiles, maptiles downloads, composes and displays tiles from a large number of providers (e.g. OpenStreetMap, Stamen, Esri, CARTO, or Thunderforest).

Installation

You can install the released version of maptiles from CRAN with:

install.packages("maptiles")

You can install the development version of maptiles from GitHub with:

# install.packages("remotes")
remotes::install_github("riatelab/maptiles")

Note: maptiles uses terra which requires a recent version of GDAL (>= 3.0.4).

Demo

This is a basic example which shows you how to dowload and display OpenStreetMap tiles over North Carolina:

library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.2, PROJ 7.1.0; sf_use_s2() is TRUE
library(maptiles)
# import North Carolina counties
nc_raw <- st_read(system.file("shape/nc.shp", package="sf"), 
                  quiet = TRUE)
# Project to EPSG:3857
nc <- st_transform(nc_raw, "EPSG:3857")
# dowload tiles and compose raster (SpatRaster)
nc_osm <- get_tiles(nc, crop = TRUE)
# display map
plot_tiles(nc_osm)
# add Norh Carolina counties
plot(st_geometry(nc), col = NA, add = TRUE)
# add credit
mtext(text = get_credit("OpenStreetMap"), 
      side = 1, line = -1, adj = 1, cex = .9, 
      font = 3)

maptiles gives access to a lot of tiles servers, but it is possible to add others. The following example demonstrates the setting of a map tiles server and how to cache the original tiles for future use:

# define the tile server parameters
osmpos <- list(src = 'CARTO.POSITRON',
               q = 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
               sub = c('a','b', 'c', 'd'), 
               cit = '© OpenStreetMap contributors © CARTO.')
# dowload tiles and compose raster (SpatRaster)
nc_osmpos <- get_tiles(x = nc, provider = osmpos, crop = TRUE, 
                       cachedir = tempdir(), verbose = TRUE)
#> https://c.basemaps.cartocdn.com/light_all/7/34/50.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_34_50.png
#> https://c.basemaps.cartocdn.com/light_all/7/35/50.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_35_50.png
#> https://b.basemaps.cartocdn.com/light_all/7/36/50.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_36_50.png
#> https://b.basemaps.cartocdn.com/light_all/7/37/50.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_37_50.png
#> https://b.basemaps.cartocdn.com/light_all/7/34/51.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_34_51.png
#> https://c.basemaps.cartocdn.com/light_all/7/35/51.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_35_51.png
#> https://d.basemaps.cartocdn.com/light_all/7/36/51.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_36_51.png
#> https://a.basemaps.cartocdn.com/light_all/7/37/51.png => /tmp/RtmpzdhF4m/CARTO.POSITRON/CARTO.POSITRON_7_37_51.png
#> Zoom:7
#> Data and map tiles sources:
#> © OpenStreetMap contributors © CARTO.
# display map
plot_tiles(nc_osmpos)
# display credits
mtext(text = osmpos$cit, side = 1, line = -1, 
      adj = 1, cex = .9, font = 3)

The following figure shows mini maps for most of the tiles providers available:

Projection

Original tiles use a projection known as “Web Mercator”, “WGS84 / Pseudo Mercator”, “Google Mercator”, “EPSG:3857” or “EPSG:900913”. In most cases get_tiles() uses the projection of its x argument to reproject the tiles. If you wish to avoid any deformation induced by the reprojection process, use “EPSG:3857” for x projection.

Attribution of map tiles

All maps available through maptiles are offered freely by various providers. The only counterpart from the user is to properly display an attribution text on the maps. get_credit() displays a short credit text to add on each map using the downloaded tiles.

Background

Most of maptilescode comes from getTiles() and tilesLayer() functions in cartography. It appears useful to me to have a package focused on the download and display of map tiles only. On the technical side, it uses terra instead of raster for managing raster data.

Alternatives

There are many alternative packages that pursue the same objective as maptiles. Some focus on a specific map tiles provider (e.g. mapbox, google, OpenStreetMap) or on a specific graphics device (ggplot2). The goal of maptiles is to be flexible enough to allow the use of different providers and to have a minimal number of robust and modern dependencies. However, depending on the use case, one of following packages may better suit your needs:

Note

Not to be confused with tilemaps, that “implements an algorithm for generating maps, known as tile maps, in which each region is represented by a single tile of the same shape and size.”

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].