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
# see also https://github.com/r-spatial/sf/issues/185#issuecomment-304093929 | |
library(sf) | |
library(purrr) | |
library(jsonlite) | |
# devtools::install_github("ropensci/crul") | |
library(crul) | |
x <- HttpClient$new(url = "http://dati.mit.gov.it/catalog/api/action/datastore_search") | |
res <- x$get(query = list(resource_id="484e08bf-3e0d-4b89-81b5-407b80c5f5e8", limit=5)) |
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
#http://www.r-ohjelmointi.org/?p=344 | |
#--aja vanhassa veriossa | |
setwd("E:/") | |
packages <- installed.packages()[,"Package"] | |
save(packages, file="Rpackages.rds") | |
#--aja uudessa versiossa | |
setwd("E:/") | |
load("Rpackages.rds") | |
for (p in setdiff(packages, installed.packages()[,"Package"])) |
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(xml2) | |
library(dplyr) | |
library(purrr) | |
library(tibble) | |
temp <- tempfile(fileext = ".xml") | |
download.file("https://www.dropbox.com/s/en2697k57o79gw8/VIS_DATASET_AMBIENTE_09_1999.xml?raw=1", temp) | |
doc <- read_xml(temp) | |
unlink(temp) |
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
wget "http://fbinter.stadt-berlin.de/fb/wfs/geometry/senstadt/re_brw2010?REQUEST=GetFeature&SERVICE=WFS&VERSION=2.0.0&TYPENAMES=GML2" -O re_brw2010_pat.xml | |
ogr2ogr -f "ESRI Shapefile" pat_2010.shp re_brw2010_pat.xml -s_srs EPSG:25833 -t_srs 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("rvest") | |
stat_Serv_ZTL <- function() { | |
zdate <- Sys.time() | |
res <- read_html("https://ztl.comune.palermo.it/ztl/jsp/home.jsp?modo=info&info=datiZTL.jsp") | |
p1 <- html_table(html_nodes(res, xpath = "//*[@id='colonna2']/div/div/table"), dec = ",") | |
p1 <- do.call("rbind", p1) | |
p1$X2 <- as.numeric(gsub("\\.", "", p1$X2)) | |
p1 <- na.omit(p1) |
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
# http://www.sardegnamobilita.it/opengovernment/opendata/ | |
# see https://github.com/ropenscilabs/gtfsr | |
# package not on CRAN yet | |
# devtools::install_github('ropenscilabs/gtfsr') | |
library("gtfsr") | |
gtfs_data <- c("http://www.ctmcagliari.it/google_transit_feed/google_transit.zip", | |
"http://www.sardegnamobilita.it/opendata/dati_atpnu.zip", | |
"http://www.sardegnamobilita.it/opendata/dati_aspo.zip", |
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
--- | |
title: "Incidenti stradali rilevati - Roma 2015" | |
author: "Patrick Hausmann" | |
date: "`r format(Sys.time(), '%a %b %d %X %Y')`" | |
output: | |
html_document: | |
fig_caption: yes | |
highlight: tango | |
keep_md: yes | |
number_sections: yes |
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("rvest") | |
library("gtfsr") | |
library("dplyr") | |
library('tidyr') | |
amat_url <- "http://www.amat.pa.it/Le_Linee/linee_orario.php" | |
set_date <- function(x) {as.POSIXct(paste("2016/07/01", x, tz = "CET"))} | |
# BOM fixed |
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("rvest") | |
library("gtfsr") | |
library("dplyr") | |
library('tidyr') | |
amat_url <- "http://www.amat.pa.it/Le_Linee/linee_orario.php" | |
# read the AMAT leweb form | |
web_routes <- function(url) { | |
ses <- html_session(url) |
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('pdftools') | |
library('stringi') | |
options(stringsAsFactors = FALSE) | |
getWSaldo <- function(x, id) { | |
k <- sapply(x, "[", id) | |
k <- trimws(k) | |
k <- gsub("\\.", "", k) | |
k <- as.numeric(k) |