Wo war ich im 2018?

Hier der nächste meiner Posts zum 2018. Eine Darstellug, wo ich mich aufgehalten habe. Dieser und andere Posts sind unter dem Tag jahresrückblick18 zu finden.

Seit OpenPaths ganz tot ist, speichert mein Telefon seine Position mit WHIB. Dank einer 2$-Premium-Funktion kann ich die Positionsdaten als CSV-Datei exportieren und diese dann mit etwas Python analysieren und darstellen.

Im 2018 war ich eher wenig (ausserhalb der Schweiz) mobil. Wenn mensch den Osterausflug nach Konstanz zur Schweiz zählt, war ich “nur” im Herbst in Sardinien (Ferien) und Anfangs Dezember in Heidelberg (Konferenz) ausserhalb der Landesgrenzen.

Die 13843 Datenpunkte ansprechen einer Position ca. alle 90 Minuten (stimmt nur halb, denn mein Telefon ist in der Nacht immer ausgeschaltet). Vom nördlichsten Punkt am Bahnhof Mannheim bis zum südlichsten Punkt am Strand von Porto Giunco an der Südspitze von Sardinien sind es Luftlinie ca. 1151, vom westlichsten Punkt (Yverdon) zum östlichsten (ebenfalls in Sardinien) wären es 242 km, wenn die Punkte denn auf der gleichen geografischen Höhe wären…
Damit wären auch die Extrem-Positionen auf der Kompassrose geklärt.

Der höchste Punkt war am Ausgang der Tunnelpiste beim Bettmerhorn, bei 2641 müM. Im Durchschnitt war ich im Kandertal bei Kandergrund, im Median habe ich mich im Weissenbühl befunden.

Die Code ist hier auf GitHub zu finden, oder inklusive aller Kartenansichten hier im nbviewer.

Da ich aus offensichtlichen Gründen nicht die gesamte Positions-Historie beilegen will, läuft das Notebook nicht in Binder. Unten ist eine sogenannte Heatmap meiner Position übers ganze 2018 zu sehen, direkt als HTML-Code aus dem Notebook exportiert. Es kann also etwas dauern, bis dein Browser oder Feed-Reader das Ding anzeigt…

Wo war ich im 2017

Anfangs Jahr ist ein guter Zeitpunkt, um aufs vergangene Jahr zurückzublicken. Das heisst, es gibt mal wieder ein paar nerdige Blogeinträge. Der Rest (wenn er dann kommt) ist unter dem Tag jahresrückblick17 zu finden.

Da ich erst Mitte 2017 herausgefunden habe, dass OpenPaths tot ist (die Daten können nicht mehr exportiert werden, auf Mails und Twitter-Nachrichten reagiert niemand), habe ich mich nach Alternativen umgesehen. Leider erst ab Juli, daher fehlen die Daten der ersten Jahreshälfte…
Nachdem Moves ausgeschieden ist, weil es zu Facebook gehört, und Arc ausgeschieden ist, weil die Batterielaufzeit des Telefons massiv verringert wurde, bin ich bei WHIB gelandet. Dank einem 2$-premium-Feature können alle aufgenommenen Daten als CSV exportiert werden, das macht es möglich, mit ein bisschen Python zu schauen, wo ich mich (in der zweiten Hälfte) 2017 rumgetrieben habe, als ich das Telefon dabei hatte.

Dazu brauchen wir ein paar Bibliotheken

import pandas
import matplotlib.pylab as plt
import seaborn
import folium

Laden wir mal das exportierte File in eine Pandas Tabelle

locations = pandas.read_csv('journey.csv')

Das sieht doch schon mal ganz gut aus, wir haben nämlich 6233 Datenpunkte.

locations.describe()
Crumb Latitude Longitude Altitude (in metres) Accuracy (in metres)
count 6233.000000 6233.000000 6233.000000 6233.000000 6233.000000
mean 3116.000000 46.932620 7.437850 533.149527 125.461736
std 1799.456446 0.067238 0.115774 159.792018 596.847400
min 0.000000 46.434918 7.026148 -43.000000 0.000000
25% 1558.000000 46.935265 7.417971 545.000000 47.000000
50% 3116.000000 46.937312 7.424690 555.000000 65.000000
75% 4674.000000 46.948112 7.433138 558.000000 70.000000
max 6232.000000 47.398817 8.577597 2003.000000 23964.000000

Mit etwas Hilfe von Folium können wir dann diese gut 6000 Datenpunkte auf einer schwarz-weissen Karte darstellen. Damit überhaupt ‘richtig’ etwas zu sehen ist, machen wir eine sogenannte Heatmap, dann ist das Ganze etwas übersichtlicher.

from folium.plugins import HeatMap
xy = [[row['Latitude'], row['Longitude']] for index, row in locations.iterrows()]
m = folium.Map(location=[locations['Latitude'].mean(),
                         locations['Longitude'].mean()], tiles='Stamen Toner', zoom_start=9)
folium.plugins.HeatMap(xy).add_to(m)
m

Schlussendlich sieht das dann so aus; da war ich überall in der zweiten Hälfte vom 2017. Rein- und rauszoomen ist erlaubt und erwünscht :)

Recommended readings: August 1, 2017

Wegen einer Woche Quasi-Ferien etwas später und etwas mehr, aber ich kam halt viel zum lesen….

Im letzten Monat las ich folgende Texte und fand diese gut:

Im letzten Monat sah ich folgende Videos und fand diese gut:

Where was I in 2016

Hier einer weiterer Post zum Rückblick aufs 2016. Die anderen sind unter dem Tag jahresrückblick16 zu finden.

Weil ich dieses Jahr viel mehr mit Python gearbeitet habe, habe ich meinen Geodaten-Jahresrückblick von R in Python transferiert. In einem Jupyter-Notebook arbeitet es sich einfach viel schneller und iterativer :)

Leider habe ich es nicht geschafft, den Markdown- oder HTML-Export der “Analyse” so klein zu machen, dass dieser von WordPress-Editor geschluckt wird (> 4 MB ASCII-Text ist scheinbar zuviel).
Deshalb sind die Details meines Bewegungs-Profils von 2016 (in Englisch) entweder hier auf GitHub, hier mit den Jupyter Notebook Viewer oder unten eingebunden zu finden.

Where have I been in 2015

Hier ein weiterer meiner Jahresrückblick 2015-Posts. Die anderen sind unter dem Tag jahresrückblick15 zu finden.

Weil das letzte Mal schon auf Englisch, hier grad wieder.


I’ve updated the RMarkdown-document of the “analysis” of my yearly Geodata a bit. Namely, I parametrized the shizzle out of it, switched to the freely available Stamen maps (based on OpenStreetMap data) and – something which I’m quite prowd of myself – implemented a function to automagically extract the name of a location based on its latitude and longitude from the GeoNames database.

The original file with the full code can be found either on GitHub or on RPubs, the result is pasted below.


Introduction

I tracked my location data with OpenPaths since the beginning of 2014.
OpenPaths comes as an application for your phone, which tracks its location, uploads it to the OpenPath servers.
You can then donate your data for scientific research and also look at the data yourself, which is what we do here.

To be able to do this, we grab a .CSV file with the location data.
Log in to OpenPaths, and click on CSV under Download my data, which gives you a comma separated list of your location data, which can then visualize with R, which is what we’ve done here.

Data

We want to plot the location points on a map, which we can do with the wonderful ggmap library.
To get the place names from the GeoNames Web Services, we need the RCurl library, to parse the output XML, we obviously need the XML library.

First, we load the data file and then remove all the datapoints where we have an altitudes of ‘0’ (which is probably a fluke in the GPS data)
Obviously, we only want to look at this years data, we thus save a subset of the dataset for further processing.

library(ggmap)
library(RCurl)
library(XML)
data <- read.csv("/Users/habi/Dev/R/openpaths_habi.csv")
data$alt[data$alt == 0] <- NA
whichyear <- 2015
thisyear <- subset(data, grepl(whichyear, data$date))

Since we’re going to use it often, we’re making a function to grab the name of a place based on its latitude and longitude.

geoname <- function(lat,lon){
  # Grab GeoNames XML from their API, according to location
  txt = getURL(paste0("http://api.geonames.org/findNearbyPostalCodes?lat=", lat, "&lng=", lon, "&username=habi", collabse = NULL), .encoding = 'UTF-8', .mapUnicode = TRUE)
  # Parse XML tree
  xmldata <- htmlTreeParse(txt, asText=TRUE)
  # Extract <name> node (with empirically found location)
  Name <- xmldata$children[[2]][[1]][[1]][[1]][[2]][[1]]
  # Since we're only using the name as string, we can return it as such
 return(unlist(Name)[[2]])
}

Then, we display a summary of the geographical points.

summary(thisyear$lat)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   45.92   46.94   47.01   47.14   47.45   50.05
summary(thisyear$lon)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   6.562   7.432   7.695   7.826   8.211   9.999
summary(thisyear$alt)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   84.85  363.10  533.00  541.90  554.20 3400.00     228

In 2015 I was in the mean somewhere close to Auswil.
I’ve lived at 541.9 m AMSL in the mean.

The .csv file also contains information about the iPhone we’ve used to collect the data.
Let’s look at these.

summary(thisyear$device)
## iPhone4,1 iPhone6,2 
##         0      8290

We see that in 2015 I have only used one phone, my iPhone 5S (iPhone6,2) and went through 9 different iOS version numbers.

summary(thisyear$os)
## 7.0.4 7.0.6   7.1 7.1.1 7.1.2   8.0 8.0.2   8.1 8.1.1 8.1.2 8.1.3   8.2 
##     0     0     0     0     0     0     0     0     0   614   933   347 
##   8.3   8.4   9.0   9.1   9.2 9.2.1 
##  1653   374  1365  1808   997   199

If we assume that I’ve tracked my location consistently, then I’ve used iOS 9.1 the longest, with 1808 saved data points.

Location data

Extremes

Interesting points in my yearly location data:

  • The minimal and maximal latitudes of 45.917 and 50.047, South and North respectively.
  • the minimal and maximal longitudes of 6.562 to 9.999, East and West respectively.
  • as well as the altitude, which ranges from 84.8 m AMSL to 3399.9 m AMSL.

We can get the extreme points out of the data pretty easily.
To do so, we subset the data depending on the value we want to have, construct a Location from these points, grab the map tile from that location, put a marker on top of it and display this is an image.

For the northmost point, this goes like so:

NLocation = c(lon=subset(thisyear, lat==max(thisyear$lat))$lon[1],
              lat=subset(thisyear, lat==max(thisyear$lat))$lat[1])
mapImage<- get_map(location= NLocation, source='stamen', maptype='toner-hybrid', zoom=10)
ggmap(mapImage) +
  geom_point(aes(x = subset(thisyear, lat==max(thisyear$lat))$lon[1],
                 y = subset(thisyear, lat==max(thisyear$lat))$lat[1]),
             alpha = .125,
             color="darkred",
             size = 10) +
  ggtitle(paste("Northmost point in", whichyear))

North

The northmost point in 2015 is in Kiedrich, which is true.
Even though I’ve not been in Kiedrich exactly, my mobile phone was probably connected to a tower there.
I spent two days in Ingelheim in January, at the International Masters competition in Swimming, which is close by.

The rest of the extremes can be extracted accordingly.

East

The most eastern point was in the Rehmen, during the first vacation with our (then) newborn daughter in the Bregenzer Wald.

South

The most southern point was in Breuil, while skiing in Zermatt.

West

The most western point was in St-Sulpice VD, during a meeting at the EPFL in Lausanne for working on the GlobalDiagnostiX project.

High

The highest point in 2015 at 3399.9 m AMSL was close to Zermatt on the Furgsattel.

Low

The lowest point at 84.8 m AMSL was in Gau-Algesheim, close to Ingelheim.

Where was I in Switzerland?

To plot the obtained data on a map, we have to center the resulting map location.
Since I only want to show the data points in Switzerland, we center the map on that.
Afterwards, we can simply plot all the thisyear geolocation points on top of that image, and you can see where I was in Switzerland in 2015.

HomeBase <- get_map(location= 'Switzerland', source = 'stamen', maptype='toner-hybrid', zoom=8)
AllPoints <- data.frame(lon=thisyear$lon, lat=thisyear$lat)
ggmap(HomeBase) + geom_point(aes(x = lon, y = lat),
                             data = AllPoints,
                             size = 3,
                             alpha = 0.125,
                             color="darkred") +
    ggtitle(paste("Where was Habi in Switzerland in", whichyear))

Switzerland

Where was I in 2014

This is the first second of some of my look back on 2014 posts. To see the other ones, take a look at the jahresrückblick14-tag

Introduction

I tracked my location data with OpenPaths since the beginning of 2014. OpenPaths comes as an application for your phone, which tracks its location, uploads it to the OpenPath servers, where you can donate your data for scientific research, and look at the data yourself.

To do this, we grab a .CSV file with the location data. Log in to OpenPaths, and click on CSV under Download my data, which gives you a comma separated list of your location data, which can then visualize with R, which is what we’ve done here.

Data

We want to plot the location points on a map, which we can do with the wonderful ggmap library. First, we load the CSV file and display a summary of the data.

library(ggmap)
data summary(data$lat)
summary(data$lon)
summary(data$alt)
## lat
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 34.6 46.9 47.2 46.0 47.5 53.6

## lon
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.76 7.50 8.20 21.80 8.22 141.00

## alt
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -48 353 380 463 546 2670

In 2014 I was somewhere in woods somewhere in Romania in the mean, and somewhere in Beromüster as the median.

summary(data$device)
summary(data$os)
## device
## iPhone4,1 iPhone6,2
## 13453 1093

## os
## 7.0.4 7.0.6 7.1 7.1.1 7.1.2 8.0 8.0.2 8.1 8.1.1 8.1.2
## 829 261 2238 2065 1551 145 6095 479 449 434

We see that in 2014 I changed from an iPhone 4S (iPhone4,1) to an iPhone 5S (iPhone6,2) and went through 10 different iOS version numbers.

Location data

Extremes

Interesting points in our data are

  • The minimal and maximal latitudes of 34.601 and 53.5866, South and North.
  • the minimal and maximal longitudes of 4.762 to 141.1744, East and West.
  • as well as the altitude, which ranges from -48 AMSL to 2671 AMSL.

We can get the extreme points out of the data pretty easily. To do so, we subset the data depending on the value we want to have, build a Location from these points, grab the map from that location, display this map and add a pointer.

For the most northern point, this goes like so:

NLocation = c(lon = subset(data, lat == max(data$lat))$lon[1], lat = subset(data,
lat == max(data$lat))$lat[1])
mapImage zoom = 15)
ggmap(mapImage) + geom_point(aes(x = subset(data, lat == max(data$lat))$lon[1],
y = subset(data, lat == max(data$lat))$lat[1]), alpha = 0.5, color = "darkred",
size = 10) + ggtitle("Northmost point in 2014")

where_is_the_northmost_point_

We see that in 2014 I was in Hamburg, which is the northmost point. Correctly, the northmost point would be in Oslo, where I spent New Years Eve 2013/2014, but I’ve only really started to use OpenPaths in mid-January 2014…

The rest of the extremes can be extracted accordingly.

where_are_the_other_cardinal_direction_extremes_1
where_are_the_other_cardinal_direction_extremes_2
where_are_the_other_cardinal_direction_extremes_3

The most eastern point was (unsurprisingly) in Japan, the southmost point in Cyprus and the most eastern point in Amsterdam (while flying to Japan).

The highest peak I reached in 2014 was the Bettmerhorn, probably while skiing. The lowest point at -48 AMSL was at home and is probably a fluke in the GPS data :)

where_is_the_highest_point_

Where was I in Switzerland?

To plot the obtained data on a map, we have to center the resulting map location. Since I only want to show the data points in Switzerland, we center the map on that. Afterwards, we can simply plot all the data points on top of that image, and you can see where I was in Switzerland in 2014.

HomeBase zoom = 8)
AllPoints ggmap(HomeBase) + geom_point(aes(x = lon, y = lat), data = AllPoints, size = 3,
alpha = 0.25)

Swiss_Locations

If you’d like to see the full R code (in R Markdown), you can take a look at the OpenPaths.Rmd on my GitHub account.

Nippon

Schon vor drei Jahren wollten wir eigentlich nach Japan.

Das Erdbeben in Tohoku, der anschliessende Tsunami und die Kernschmelze im Kernkraftwerk Fukushima Daiichi machten dann aber eine Planänderung nötig, die uns (sehr spontan) nach Indien führte.
Das schöne an Planänderungen ist ja, dass die ursprünglichen Pläne zu einem späteren Zeitpunkt immer wieder aus der Schublade genommen werden können…

So flogen wir denn gegen Mitte April für zwei Wochen nach Japan, um uns mit Zug und Bus durchs Land zu bewegen.
Wir verbrachten Nächte in traditionellen Unterkünften, machten kürzere Wanderungen in den japanischen Alpen und assen Sushi bis uns die Ohren wackelten (jedenfalls 50% unserer Reisegruppe).

Die Zeit verging viel zu schnell, die Eindrücke bleiben zum Glück noch lange.Wer ein paar Fotos sehen will, kann dies im Japan-Set auf flickr.com tun.

Ganz in der “Tradition” meiner Ein-Sekunden-Monate habe ich während den Ferien jeden Tag ein (oder mehrere) Videoschnipsel aufgenommen.
Die Zusammenstellung ist unten zu sehen, die Auflistung kommt noch weiter unten.

  • Anstehen, um den Japan Rail Pass einzulösen
  • Styropor-Entsorgung auf dem grössten Fischmarkt der Welt
  • Japanische Videogames sind strange, hier in Tokyo
  • Japanische Läden ebenfalls, hier in Tokyo
  • Klassische Musik beschallt die Strassen Tokyos
  • Ruhe im Ginkaku-ji-Park
  • Eine von vielen Shinkansen-Fahrten, hier in der 700-Serie
  • Kendo auf einer Dachterasse in Matsumoto
  • Wandern in Kamikochi
  • Wind-Fische in Kamikochi
  • Japanische Ampeln sind strange, hier in Nagano
  • Die japanisch-effiziente Art Rolltreppen zu putzen
  • Mickey Mouse rennt um den Tazawa-ko
  • Im Towada-Hachimantai Kokuritsu Koen hat’s noch fei chli Schnee
  • Wenn Japan, dann schon mal Karaoke, hier in Morioka
  • Im Landeanflug nach Basel

Ah, und wer noch wissen möchte, wo wir überall waren, sieht das in dem Bild unten, mit Dank an OpenPaths.
openpaths_japan.png