All Projects → adam-gruer → victor

adam-gruer / victor

Licence: MIT license
Turn mapbox vector tiles into static maps in R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to victor

cloud-tileserver
Serve mapbox vectortiles via AWS stack
Stars: ✭ 48 (+71.43%)
Mutual labels:  vector-tiles, gis, mapbox-vector-tile, mvt
postile
Project migrated to: https://gitlab.com/Oslandia/postile
Stars: ✭ 67 (+139.29%)
Mutual labels:  vector-tiles, gis
HMap
:earth: HMap | 基于openlayers的封装组件
Stars: ✭ 64 (+128.57%)
Mutual labels:  vector-tiles, gis
Tegola
Tegola is a Mapbox Vector Tile server written in Go
Stars: ✭ 754 (+2592.86%)
Mutual labels:  vector-tiles, gis
Itowns
A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
Stars: ✭ 517 (+1746.43%)
Mutual labels:  vector-tiles, gis
earthwyrm
Vector tile map server for openstreetmap data
Stars: ✭ 16 (-42.86%)
Mutual labels:  gis, mvt
tidyUSDA
An interface to USDA Quick Stats data with mapping capabilities.
Stars: ✭ 36 (+28.57%)
Mutual labels:  gis
go-kml
Package kml provides convenience methods for creating and writing KML documents.
Stars: ✭ 67 (+139.29%)
Mutual labels:  gis
WhirlyGlobe
WhirlyGlobe Development
Stars: ✭ 767 (+2639.29%)
Mutual labels:  gis
mapmint
Fast and easy webmapping.
Stars: ✭ 51 (+82.14%)
Mutual labels:  gis
Vector-Tile-Spark-Process
🌏 Clip geographic data into MVT files based on Apache Spark
Stars: ✭ 16 (-42.86%)
Mutual labels:  mvt
ExtApp
ExtApp是一个基于三层架构,使用NHibernate、API Controller和ExtJs创建的,用于简化政府和企业应用开发的Web应用程序框架。
Stars: ✭ 14 (-50%)
Mutual labels:  gis
pylandsat
Search, download, and preprocess Landsat imagery 🛰️
Stars: ✭ 49 (+75%)
Mutual labels:  gis
go-mbgl
Go bindings for Mapbox GL Native
Stars: ✭ 16 (-42.86%)
Mutual labels:  gis
ee extra
A ninja python package that unifies the Google Earth Engine ecosystem.
Stars: ✭ 42 (+50%)
Mutual labels:  gis
awesome-maps-ukraine
A curated list of maps of Ukraine, ukrainian mappers and tools that they use or develop for creating and publish maps
Stars: ✭ 35 (+25%)
Mutual labels:  gis
kart
Distributed version-control for geospatial and tabular data
Stars: ✭ 253 (+803.57%)
Mutual labels:  gis
note
一些技术笔记
Stars: ✭ 174 (+521.43%)
Mutual labels:  gis
opentopodata
Open alternative to the Google Elevation API!
Stars: ✭ 163 (+482.14%)
Mutual labels:  gis
turf-go
A Go language port of Turf.js
Stars: ✭ 41 (+46.43%)
Mutual labels:  gis

victor

Lifecycle: experimental

The goal of victor is to interact with the Mapbox Vector Tile API ( also here ) in R. Grab a vector tile(s), work with it using the simple features package sf. Plot static maps with ggplot2, tmap, etc.

Inspired and/or fuelled by:

Installation

Install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("adam-gruer/victor")

Mapbox Token

You will need a Mapbox Access Token to use their API. Once you have a token add a line to your .Renviron file

MAPBOX_API_KEY=your_acess_token

The easiest way to edit .Renviron is with the usethis pavkage usethis::edit_r_environ(). You will have to restart R after editing the file for the token to be available.

Example

Let’s create a map of Melburn and surrounding cities:

Use the spoils function to retrieve a tile for a given location and zoom It returns a list of simple features data frames. One for each layer of data provided by mapbox.

library(victor)
library(sf)
library(tidyverse)
melburn <- spoils(zoom = 7, longitude = 144.8430, latitude = -37.7311)

roads <- filter(melburn$road,!st_is(geometry, "POINT")) 
road_shields <-  filter(melburn$road,
                        st_is(geometry, "POINT"),
                        str_starts(ref, "M") ) %>% 
                  group_by(ref) %>% 
                  filter(row_number() == 1)
places <- filter(melburn$place_label, symbolrank < 11) %>% 
  mutate(name = case_when(name == "Melbourne" ~ "Melburn",
                          TRUE ~ as.character(name)))

ggplot() +
  geom_sf(data = melburn$water, fill = "lightblue") +
  geom_sf(aes(colour = class), data = roads) +
  geom_sf_label(aes(label = ref), data = road_shields) +
  
  geom_sf_label(aes(label = name, size = symbolrank),
                data = places) +
  scale_size(trans = "reverse", range = c(4,6)) +
  theme_void() +
  theme( panel.grid.major = element_line(size = 0),
         plot.background = element_rect(fill = "antiquewhite"),
         legend.position = "none") 

Melburn CBD , zoomed in

cbd <- spoils(zoom = 15, long = 144.958869, lat =-37.820318)

ggplot() + geom_sf(data = cbd$water, fill = "lightblue") +
  geom_sf(data = cbd$building, aes(fill = type )) +
  geom_sf(data = cbd$road) +
  geom_sf_label(data = cbd$natural_label,
                aes (label = name),
                alpha = 0.4,
                nudge_x = 0.002) +
  geom_sf_label(data = filter(cbd$poi_label, 
                              category_en == "Aquarium"), 
                aes(label = name),
                alpha = 0.4) +
    theme_void() +
  theme( panel.grid.major = element_line(size = 0),
         plot.background = element_rect(fill = "antiquewhite1")) 

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].