Questions tagged [tmap]

tmap is an actively maintained open-source R-library for drawing thematic maps, written by Martijn Tennekes. The API is based on the Layered Grammar of Graphics, and resembles the syntax of ggplot2, a popular R-library for drawing charts.

tmap is an actively maintained open-source R-library for drawing thematic maps, written by Martijn Tennekes. The API is based on A Layered Grammar of Graphics by Hadley Wickham and resembles the syntax of , a popular R-library for drawing charts.

Repositories

Vignette

Presentation

Other resources

487 questions
1
vote
1 answer

How to specify tm_fill() if I want it to be a variable from a new object?

I am trying to create an R function that would run a GWR on variables that the user specifies from a Spatial Polygons Data Frame. The end result of running the function are two mappings - one of the independent variable's values and one of the…
1
vote
0 answers

render tmap maps inside for loop in html output of a rmarkdown file

I'm trying to generate tmaps with a for loop inside an rmarkdown file. They will not show in the html output. I read elsewhere using the tagList function could help but in my case that did not and returned an error (i'm probably doing it wrong). Any…
Romain
  • 171
  • 11
1
vote
1 answer

Bounding lines by the polygon underneath

I am new to the {tmap} package, and I am having difficulty creating a proper road map. Here is my code (not immediately runnable, because I have an exported OpenStreetMap .osm file on disk). # Load OpenStreetMap (OSM) polygon data of the Holden area…
J. Bortell
  • 33
  • 4
1
vote
1 answer

Mapping how many points are within a radius of every location in R

In R, I am trying to create a choropleth map. I have built a database of businesses, some are part of chains (e.g. McDonalds) and others are independent. I want to calculate how many businesses are within 30km of each point on the map, but treat the…
Novo88
  • 109
  • 1
  • 7
1
vote
0 answers

In proj4string(shp) : CRS object has comment, which is lost in output

Using the code below, I am trying to read a shapefile. This used to work properly but not with my recently upgraded R/Rstudio. I got this error: In proj4string(shp) : CRS object has comment, which is lost in output I used devtools to install…
Nader Mehri
  • 514
  • 1
  • 5
  • 21
1
vote
0 answers

SHP from tmap object

Could someone tell me how to create a shape file (to use in GIS software) from a tmap object created in R? I have something like this: Map <- tm_shape (raster) + tm_raster() + tm_shape(shape) + tm_borders() I know that tmap_save allows me to save…
1
vote
0 answers

Stack legends for border and fill colors in tmap

I have a tmap plot with two layers, a tm_polygon and a tm_borders. A minimal example would be library(tmap) library(sf) library(tidyverse) data("World") continents <- World %>% group_by(continent) %>% summarise() tm_shape(World) + …
dufei
  • 2,166
  • 1
  • 7
  • 18
1
vote
0 answers

Why is tmap/shiny not removing previous layers?

I'm new to tmap and even newer to Shiny, so I hope that this question isn't a mistake on my part. I'm having problems with using tm_remove() with zindex, as the point data that should have been deselected still stays on the map. This is not an issue…
ScriptedChicken
  • 153
  • 1
  • 6
1
vote
1 answer

tmap - changing the behaviour of tm_markers

Here is a reproducible example #load the packages library(easypackages) packages("tidyverse","readxl","sf","tmaptools","tmap","lubridate", "lwgeom","Cairo","nngeo","purrr","scales",…
damo
  • 463
  • 4
  • 14
1
vote
1 answer

R tmap-package legend title in tm_lines and

I'm trying to build a map with "tm_lines" -element without a legend title. There doesn't seem to be an option for the removing the title of the legend. An example with World and Rivers datasets: tm_shape(World) + tm_fill() + tm_shape(rivers)…
brabont
  • 23
  • 4
1
vote
3 answers

how to center TMap on the Blue point ( My GPS Position)

I use Delphi on Rad Studio 10.4 and developp for Android I have 2 put 2 components : TLocationSensor and TMap I know how to specify to the MAP to show a specific location but I do not understand how to mak automaticly my Map open to the position…
1
vote
1 answer

Finding nearest neighbours in time and space in R using sf

I have a made up dataset of polling stations in Wales and I've attached a date column to it. We can imagine this date is the date this polling station was visited to check the facilities (for example). What I'd like to do is work out : I would like…
damo
  • 463
  • 4
  • 14
1
vote
2 answers

Map dropping countries when plotting with ggplot

Ok, I'm having a hard time with mapping some data by country. Here's a trimmed-down version of the data set I'm working with, in an object called 'smaller': COUNTRY ARRIVALS Algeria 16 American Samoa 2 Angola …
matt_lnrd
  • 329
  • 1
  • 9
1
vote
1 answer

Can you switch from tmap to leaflet?

I am trying to see if you can create a tmap map, convert it to a leaflet map, and then add leaflet features. For example: battle_dat<-read.csv("GeoBattleData_YZ.csv") # from https://doi.org/10.7910/DVN/1KCCX2 battle_dat<-battle_dat %>%…
dkro
  • 193
  • 1
  • 8
1
vote
0 answers

How I can create map with coordinates (with different colour of dots)

I have the coordinates of certain sites in the village. Each coordinate means that I took a sample there. After conducting the study, I found that one test is positive, the other is negative. I want to show it on the map. The table has a column…
Kuban
  • 11
  • 1