Guten Tag,
ich benötige für eine statistische Auswertung in R die lon und lat Daten für Straßen mit Hausnummern aus Deutschland.
Wo und wie besteht die Möglichkeit diese Daten in eine csv oder tab Datei zu exportieren? Ich habe den Hinweis bekommen, dass die Software “osmconvert” und seiner Funktion “–all-to-nodes” vielleicht
zum Ziel führen könnte. Wer kann mir hilf mit evtl. Hilfestellung weiterhelfen?
Vielen Dank.
Sebastian
moenk
(Thomas Moenkemeier)
March 4, 2015, 9:26am
#2
Moin,
hier mal ein Schnippsel in R der Dir gefallen könnte:
osm points extractor by moenk
library(sp)
library(raster)
library(spatial)
set working dir
setwd(“~”)
create executables
system(“wget -O - http://m.m.i24.cc/osmfilter.c | cc -x c - -O3 -o osmfilter”)
osmfilter=“~/osmfilter”
system(“wget -O - http://m.m.i24.cc/osmconvert.c | cc -x c - -lz -O3 -o osmconvert”)
osmconvert=“~/osmconvert”
download OSM data
download.file(“http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf",destfile="osmdata.pbf ”)
system(“./osmconvert osmdata.pbf -o=osmdata.o5m”)
run the filter
system(paste(osmfilter,“osmdata.o5m”,“–keep= --keep=‘addr:housenumber=’”,“-o=osmdata.osm”,sep=" "))
export to CSV
system(“./osmconvert osmdata.osm --all-to-nodes --csv=‘@lon @lat name website’ --csv-headline -o=osmdata.csv”)
load to data frame
osmpoints=read.csv(“osmdata.csv”,sep=“\t”)
make shapefile
shapefile=SpatialPointsDataFrame(as.matrix(osmpoints[,1:2]),osmpoints)
projection(shapefile)=“+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs”
plot(shapefile)
save as KML
writeOGR(shapefile, “osmdata.kml”, “osmdata”, “KML”)
LG,
-moenk