This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Démarrer le package cartography | |
library(cartography) | |
# Charger les données stockées sur le web | |
load((url("http://wukan.ums-riate.fr/bond/bondfiles.RData"))) | |
fdim <- getFigDim(spdf = WorldCountries[WorldCountries$ISO3 %in% | |
c( "RUS","NZL", "ARG"),], | |
width = 750, res = 120, | |
mar = c(0,0,1.2,0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load library | |
library(cartography) | |
# load data | |
load(url("http://wukan.ums-riate.fr/panamapapers/panamapapers.RData")) | |
# get the figures dimensions | |
fd <- getFigDim(spdf = grat, width = 800, | |
res = 120, mar = c(0,0,1.2,0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(cartography) | |
library(sp) | |
library(sf) | |
# Load data | |
data(nuts2006) | |
# Save image | |
sizes <- getFigDim(x = nuts0.spdf, width = 700, mar = c(0,0,0,0), res = 100) | |
png('./img/map8.png', width = sizes[1], height = sizes[2], res = 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(SpatialPosition) | |
load("../LargeSpatialPostition/com.RData") | |
# création d'une grille fine (5km) | |
grid <- CreateGrid(w = com, resolution = 5000) | |
# Les calculs de matrices de distances sont (beaucoup) plus rapides quand les | |
# objets spatiaux sont en WGS84 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(cartography) | |
data("nuts2006") | |
# GDP par habitants (en euros) | |
nuts2.df$gdpinh <- 1000000 * nuts2.df$gdppps2008 / nuts2.df$pop2008 | |
boxplot(nuts2.df$gdpinh) | |
hist(nuts2.df$gdpinh) | |
rug(nuts2.df$gdpinh) | |
# Bon d'accord la distribution n'est pas vraiment normale... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sp) | |
library(raster) | |
library(rgeos) | |
## import des données | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/GBR_adm2.rds", | |
destfile = file.path(tempdir(), "GBR_adm2.rds")) | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/IRL_adm0.rds", | |
file.path(tempdir(),"IRL_adm0.rds")) |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"","location","name","housenumber","street","postcode","city","state","country","osm_key","osm_value","lon","lat","msg" | |
"1","Germany, Augsburg, Berliner Allee 30","Hauptfeuerwache - Berufsfeuerwehr Augsburg","30","Berliner Allee","86153","Augsburg","Bayern","Deutschland","amenity","fire_station",10.9151257435963,48.3738761,NA | |
"2","Germany, Bautzen, Gesundbrunnenring 23","Feuerwache Bautzen","23","Gesundbrunnenring","02625","Bautzen","Sachsen","Deutschland","amenity","fire_station",14.4383893321343,51.1871298,NA | |
"3","Germany, Bielefeld, Stadtholz 18","Feuerwache Ost","18","Am Stadtholz","33609","Bielefeld","Nordrhein-Westfalen","Deutschland","amenity","fire_station",8.5537485,52.0256609,NA | |
"4","Germany, Bochum, Brandwacht 1","Freiwillige Feuerwehr Bochum Brandwacht (LE31)","1","Brandwacht","44894","Bochum","Nordrhein-Westfalen","Deutschland","amenity","fire_station",7.2987397,51.4891521,NA | |
"5","Germany, Bonn, Lievelingsweg 112","Leitstelle Berufsfeuerwehr Bonn","112","Lievelingsweg","53119","Bonn","Nordrhein-W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
adresse <- "8 bd du port" | |
resultraw <- httr::GET(utils::URLencode(paste0('https://api-adresse.data.gouv.fr/search/?q=', adresse))) | |
result <-jsonlite::fromJSON(httr::content(resultraw, "text")) | |
result$features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
legpos <- function(pos, x1, x2, y1, y2, delta1, delta2, legend_xsize, legend_ysize){ | |
# Position | |
if (pos == "bottomleft") { | |
xref <- x1 + delta1 | |
yref <- y1 + delta1 | |
} | |
if (pos == "topleft") { | |
xref <- x1 + delta1 | |
yref <- y2 - 2 * delta1 - legend_ysize | |
} |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OlderNewer