Exploring the UseR Conferences in one map & UseR 2019 Toulouse

In this article, I explore what the User Conference is, the cities where the conferences took place during the last years, and also I explore the next town where the user conference 2019 will happen: Toulouse.

All the maps for each of these places are created using the ggmap package and the raster package

A UseR Conference

A UseR Conference is the main meeting of the R user and developer community, its program consisting of both invited and user-contributed presentations.

  • The invited keynote lectures cover a broad spectrum of topics ranging from technical and R-related computing issues to general statistical topics of current interest.
  • The user-contributed presentations are submitted as abstracts prior to the conference and may be related to (virtually) any R-related topic. The presentations are typically organized in sessions of either broad or special interest, which also comprise a “free” discussion format. Such a discussion format not only provides a forum for software demonstrations and detailed discussions but also supports the self-organization of the respective communities.

The last UseR Conferences

This list includes all the conference up to date.

.

Toulouse: UseR 2019 Conference

The next UseR conference will take place in the city of Toulouse, situated in the southern of the France, in the department of Haute Garonne.

Let’s explore the location of Toulouse in the southern of France (look the boundaries of the country).

Here, in this map we can observe a view of the department of Haute Garonne in France .

Toulouse, with around 1.2 million people in its metropolis, is the fourth biggest city in France (behind Paris, Lyon, and Marseille).

The center of Toulouse

A general view of Toulouse and a more detailed view of the city and the central area

.

A little of theory and the code

Qmap

Qmap is a smart wrapper for ggmap and get_map. You can obtain a simple map via qmap using the queries the map server of your choosing—Google Maps, OpenStreetMap, or Stamen Maps. In the case of the maps presented in this article because I chose the watercolor maptype, the unique server for that kind of map is Statem maps.

ggmap package

Spatial Visualization with ggplot2: a collection of functions to visualize spatial data and models on top of static maps from various online sources (e.g Google Maps and Stamen Maps). It includes tools common to those tasks, including functions for geolocation and routing.

raster package

The raster package provides classes and functions to manipulate geographic (spatial) data in ’raster’ format.

Using the raster package the process is possible to download various administrative boundaries for any country. 

shapefile

The shapefile format is a popular geospatial vector data format for geographic information system (GIS) software. Developed and regulated by Esri as a (mostly) open specification, the shapefile format spatially describes geometries as either ‘points’, ‘polylines’, or ‘polygons’.

1) World Map with watercolor

This is the code to produce the first map, the world map. The steps are:

1. Create a dataset with the locations.

conf_locations<- c("Vienna, Austria","Vienna, Austria","Ames, IA, USA", "Dortmund, Germany","Rennes, France", "Gaithersburg, MD, USA", "Coventry, UK", "Nashville, TN, USA", "Albacete, Spain", "Los Angeles, CA, USA", "Aalborg, Denmark", "Stanford, CA, USA", "Brussels, Belgium", "Brisbane, Australia","Toulouse, France")
conf_locations <- as.data.frame(conf_locations)

2. Requesting lat / long that found all the locations.

for (i in 1:nrow(conf_locations)) {
  latlon = geocode(conf_locations[i,1])
  conf_locations$lon[i] = as.numeric(latlon[1])
  conf_locations$lat[i] = as.numeric(latlon[2])
}

3. Create the map

This part was complicated because you need to setup the boundaries for the map. This aleatory cities Usuahia, Argentina in the south, Alaska in the east, New Zeland in the west and the Greenland sea in the north are the limits that I choose for this map because in terms of aesthetics are the most adequate.

cities <- c('usuahia','alaska','new_zealand','greenland_sea')
lat <- c(-54.80191, 64.20084, -27.46977,77.870977)
lon <- c(-68.3030, -149.49367, 153.025124,-5.650146)
limits <- data.frame(cities,lat,lon)

mbound <- c(min(limits$lon), #min/max longitude/latitude to display on the map
            min(limits$lat),
            max(limits$lon),
            max(limits$lat))

worldmap <- get_stamenmap(bbox=mbound, zoom = 3, maptype="watercolor")

4. Include the points for all the UseR Conferences

ggmap(worldmap) + 
  geom_point(data=conf_locations, aes(x=lon, y=lat), size = 3, 
             color = "blue", alpha = .7) +
  labs(x = NULL, y = NULL) +
  theme(text = element_text(color = "Black", family = "Verdana")) +
  theme(axis.text = element_blank()) +
  theme(axis.ticks = element_blank()) +
  theme(plot.title = element_text(size = 14)) +
  theme(plot.subtitle = element_text(size = 10))

Takeaways

  • Creating the map including certain boundaries.
  • How to create specific boundaries for a map

.

Exploring France

For these maps I explore how to include boundaries for a geographical region, how overlay several geographical objects and finally, how to display the differences in magnitudes between cities.

Map of Toulouse in the southern of France

The level 0 gives national boundaries in this case for France. You need the three letters from ISO Code for the country of interest.

##France
shapefile_fra <- getData('GADM', country='FRA', level=0)
shapefile_fra <- fortify(shapefile_fra)

The rest of the code integrating the shapefile for France with the point that correspond to the city of Toulouse.

## Toulouse lat and lon
lat = 43.60426
lon = 1.44367

## city of Toulouse and boundaries of France within Europe
data <- shapefile_fra
vis_a <- qmap('europe', zoom = 4, maptype = 'watercolor')+
  geom_point(x = lon, y = lat, size = 3, 
             color = "blue", alpha = .9) +
  geom_polygon(aes(x = long, y = lat, group = group), data = shapefile_fra, colour = "white", fill = "blue", alpha = .2, size = .3) +
  labs(x = NULL, y = NULL) +
  labs(title = "City of Toulouse") +
  theme(text = element_text(color = "Black", family = "Verdana")) +
  theme(axis.text = element_blank()) +
  theme(axis.ticks = element_blank()) +
  theme(plot.title = element_text(size = 14)) 

A view of the department of Haute Garonne in France

Haute-Garonne is a department in the southwest of France named after the Garonne river. Its main city and capital is Toulouse. In order to create the boundaries for this department, I am using the level 2.

##Toulouse
shapefile_fra_1 <- getData('GADM', country='FRA', level=1)
names(shapefile_fra_1)
unique(shapefile_fra_1$NAME_1)
# [1] "Auvergne-Rhône-Alpes" 
# [2] "Bourgogne-Franche-Comté"    
# [3] "Bretagne"                  
# [4] "Centre-Val de Loire"        
# [5] "Corse"                      
# [6] "Grand Est"                 
# [7] "Hauts-de-France"           
# [8] "Île-de-France"              
# [9] "Normandie"                 
# [10] "Nouvelle-Aquitaine"         
# [11] "Occitanie"                  
# [12] "Pays de la Loire"          
# [13] "Provence-Alpes-Côte d'Azur"

shapefile_fra_2 <- getData('GADM', country='FRA', level=2)
names(shapefile_fra_2)
unique(shapefile_fra_2$NAME_2)
# [1] ...
# [78] "Haute-Garonne"          

## [78] Haute-Garonne
haute_garonne <-subset(shapefile_fra_2 ,NAME_2=="Haute-Garonne")

Now we need to integrate two layers for France and Haute-Garonne, plus the point that represent Toulouse, in this case I am drawing first the layers for the “land”, and later the point.

vis_b <- qmap('europe', zoom = 4, maptype = 'watercolor') +
  geom_polygon(aes(x = long, y = lat, group = group), data = data,
               colour = "white", fill = "blue", alpha = .3, size = .2)+
  geom_polygon(aes(x = long, y = lat, group = group), data = shapefile_fra,
               colour = "white", fill = "blue", alpha = .1, size = .3) +
  geom_point(x = lon, y = lat, size = 2, 
               color = "blue", alpha = .9) +
  labs(x = NULL, y = NULL) +
  labs(title = "Map of France", 
       caption = "Author: thinkingondata.com") 

Population of the main cities in France

I selected the first 10 cities in France by population.

cities = c("Paris", "Marseille", "Lyon", "Toulouse", "Nice")
pop = c(2229, 855, 500, 458, 342)
citi_pop <- data.frame(cities, pop, stringsAsFactors=FALSE)

#2.Requesting lat / long that found all the locations. 
for (i in 1:nrow(citi_pop)) {
  latlon = geocode(citi_pop[i,1])
  citi_pop$lon[i] = as.numeric(latlon[1])
  citi_pop$lat[i] = as.numeric(latlon[2])
}

qmap("France", zoom = 6, maptype="watercolor",source="stamen") +
  geom_point(data = citi_pop, aes(x = lon, y = lat, size = pop), color = "blue", alpha = .6)

.

Exploring Toulouse

A simple map exploring Toulouse where the only variations are in the zoom.

qmap('toulouse', zoom = 14, maptype = 'watercolor', source = 'stamen')

.

References and acknowledgment

This post was inspired for this watercolor map of Uruguay created by Daniela @d4tagirl.