{"id":13857689,"url":"https://github.com/adam-gruer/victor","last_synced_at":"2025-07-13T22:30:59.962Z","repository":{"id":81524512,"uuid":"215977085","full_name":"adam-gruer/victor","owner":"adam-gruer","description":"Turn mapbox vector tiles  into static maps in R ","archived":false,"fork":false,"pushed_at":"2019-11-02T00:08:58.000Z","size":627,"stargazers_count":29,"open_issues_count":9,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-22T15:41:15.745Z","etag":null,"topics":["gis","mapbox-vector-tile","mvt","r","simple-features","vector-tiles","visualization"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adam-gruer.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-10-18T08:26:50.000Z","updated_at":"2024-02-06T13:31:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"e197f48a-c6a8-4fb5-9713-8ae13346bd6e","html_url":"https://github.com/adam-gruer/victor","commit_stats":{"total_commits":61,"total_committers":3,"mean_commits":"20.333333333333332","dds":"0.032786885245901676","last_synced_commit":"988ce71dbee593fa5aafbf67a86caf4f36daa0dc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adam-gruer/victor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-gruer%2Fvictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-gruer%2Fvictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-gruer%2Fvictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-gruer%2Fvictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adam-gruer","download_url":"https://codeload.github.com/adam-gruer/victor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-gruer%2Fvictor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218200,"owners_count":23729496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gis","mapbox-vector-tile","mvt","r","simple-features","vector-tiles","visualization"],"created_at":"2024-08-05T03:01:44.204Z","updated_at":"2025-07-13T22:30:59.687Z","avatar_url":"https://github.com/adam-gruer.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# victor\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\u003c!-- badges: end --\u003e\n\nThe goal of victor is to interact with the [Mapbox Vector Tile API](https://docs.mapbox.com/help/glossary/vector-tiles-api/) ( [also here](https://docs.mapbox.com/api/maps/#vector-tiles) ) in R.\nGrab a vector tile(s),  work with it using the simple features package sf.\nPlot static maps with ggplot2, tmap, etc.\n\nInspired and/or fuelled by:\n\n - [protolite](https://github.com/jeroen/protolite)\n - [slippymath](https://github.com/MilesMcBain/slippymath)\n - [ceramic](https://github.com/hypertidy/ceramic)\n - [mapdeck](https://github.com/SymbolixAU/mapdeck)\n - [rmapzen](https://github.com/tarakc02/rmapzen)\n - [sf](https://github.com/r-spatial/sf)\n \n## Installation\n\nInstall the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"adam-gruer/victor\")\n```\n\n## Mapbox Token\n\nYou will need a [Mapbox Access Token](https://docs.mapbox.com/help/how-mapbox-works/access-tokens/) to use their API.\nOnce you have a token add a line to your .Renviron file\n```\nMAPBOX_API_KEY=your_acess_token\n```\nThe 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.\n\n## Example\n\nLet's create a map of Melburn and surrounding cities:\n\nUse the spoils function to retrieve a tile for a given location and zoom\nIt returns a list of simple features data frames.  One for each layer of data provided by mapbox.\n\u003c!-- To view a summary of available layers , call summary(). --\u003e\n\n```{r, message=FALSE, warning=FALSE}\nlibrary(victor)\nlibrary(sf)\nlibrary(tidyverse)\nmelburn \u003c- spoils(zoom = 7, longitude = 144.8430, latitude = -37.7311)\n\nroads \u003c- filter(melburn$road,!st_is(geometry, \"POINT\")) \nroad_shields \u003c-  filter(melburn$road,\n                        st_is(geometry, \"POINT\"),\n                        str_starts(ref, \"M\") ) %\u003e% \n                  group_by(ref) %\u003e% \n                  filter(row_number() == 1)\nplaces \u003c- filter(melburn$place_label, symbolrank \u003c 11) %\u003e% \n  mutate(name = case_when(name == \"Melbourne\" ~ \"Melburn\",\n                          TRUE ~ as.character(name)))\n\nggplot() +\n  geom_sf(data = melburn$water, fill = \"lightblue\") +\n  geom_sf(aes(colour = class), data = roads) +\n  geom_sf_label(aes(label = ref), data = road_shields) +\n  \n  geom_sf_label(aes(label = name, size = symbolrank),\n                data = places) +\n  scale_size(trans = \"reverse\", range = c(4,6)) +\n  theme_void() +\n  theme( panel.grid.major = element_line(size = 0),\n         plot.background = element_rect(fill = \"antiquewhite\"),\n         legend.position = \"none\") \n\n```\n\nMelburn CBD , zoomed in\n\n```{r, message=FALSE, warning=FALSE}\n\ncbd \u003c- spoils(zoom = 15, long = 144.958869, lat =-37.820318)\n\nggplot() + geom_sf(data = cbd$water, fill = \"lightblue\") +\n  geom_sf(data = cbd$building, aes(fill = type )) +\n  geom_sf(data = cbd$road) +\n  geom_sf_label(data = cbd$natural_label,\n                aes (label = name),\n                alpha = 0.4,\n                nudge_x = 0.002) +\n  geom_sf_label(data = filter(cbd$poi_label, \n                              category_en == \"Aquarium\"), \n                aes(label = name),\n                alpha = 0.4) +\n    theme_void() +\n  theme( panel.grid.major = element_line(size = 0),\n         plot.background = element_rect(fill = \"antiquewhite1\")) \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadam-gruer%2Fvictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadam-gruer%2Fvictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadam-gruer%2Fvictor/lists"}