Using Rhino Grasshopper to draw and analyze .gpx files from Endomondo

In my work in the BIM group at Pihl I have been using Rhino + Grasshopper more and more. Rhino is an incredibly versatile 3D modelling program and Grasshopper is a scripting language for Rhino that has a graphical interface. The scripting is done by dragging and dropping components and connecting them with noodle-like strings, rather than writing lines and lines of code. This makes Grasshopper an extremely user friendly way into scripting for Rhino.

Lately I have been working a lot with the Rhino Grasshopper combination and getting to know the wealth of plug-ins that have been created for Grasshopper to extend it's functionality. I was lucky enough to be invited to a webinar with Luis Fraguada where he presented a plug-in package he personally has been developing on called gHowl. The package adds read/write functionality for spreadsheets, XML files, writes .KML for Google Earth and can request elevation data from Google Earth among other things.

This webinar inspired me to start trying out these plugins. I have recently got myself a racing bike and have been tracking my routes on Endomondo. It turns out that on Endomondo you can export your tracks to the .gpx format (GPS eXchange format) which is structured like XML. This created a perfect case for trying out gHowl.

I used the gHowl components to read a .gpx file from Endomondo. It turns out that it includes the following data:
  • Metadata about the user
  • Longitude, Latitude, points on the track
  • Elevation data for some points (not all)
  • Timestamp for all points
This is plenty of information. It allows plotting the track to Google Earth. It allows measuring total ascent or descent distance. It allows analyzing velocity and visualizing it in either Rhino or Google Earth. 

This is exactly what I tried. The process looks sort of like this:
  • Import gpx information into Grasshopper using gHowl. 
  • Extract longitude, latitude, timestamp. 
  • Since longitude, latitude cannot be used directly to get distances in meters, which is required for calculating velocity in km/h it has to be converted to a coordinate system that uses meters. The Universal Transverse Mercador Coordinate system does this. I found some python code online (by Han Ul Yoon) that converts from longitude/latitude to UTM. I used it with the GhPython plugin for Grasshopper. 
  • The distance between every two consecutive points on the track is calculated along with the time difference between each point and then the velocity for each segment.  
  • This is then visualized in the Rhino viewport using color gradients to represent the velocity on each segment.
GPX track visualized using the grasshopper script.
The result is a visualization of my track from Endomondo that is color coded based on the velocity on each segment. Green meaning lower velocity and red higher. 

A traffic crossing: Note how the velocity is reduced before and after crossing the junction.
Now that the track data has been acquired it can be analyzed and worked on more thoroughly. One could inspect velocity as a function of grade/slope or it could be exported to Google Earth via a kml file. The possibilities are many. 

If you would be interested in getting your hands on the script or learning more about it, catch me on twitter: @hjorturs

Landeyjahöfn - Reykjavík

I was recently in Vestmannaeyjar, Iceland, a cluster of islands south of Iceland. On the way back from the ferry terminal in Landeyjahöfn, about 150 km from Reykjavík I decided to try Timelapse for iOS. I placed my phone in the window and for about 100 km let it sit and collect images.

The result was not quite perfect, but interesting nonetheless.


The timelapse was captured out of the left window, towards south. This is a map of the route:


Next time I will capture images at a faster rate and will mount the phone pointing forward.

New blog!

This is my new blog. At this point I am hoping the blog will function as an outlet for expressing myself.

My name is Hjörtur Sigurðsson.

I come from Reykjavík, Iceland originally but I have lived in Copenhagen for the past 5 years. English is my second, soon-becoming-third language as my stay here in Copenhagen continues. I plan to write mostly in English, although I might switch to Icelandic in some cases.

I work for a construction company here in Denmark. E. Pihl & Søn. I work with BIM (Building Information Models). Buildings and other structures used to be designed using 2D drawings, first on paper, then by using computer aided design (CAD) processes. These drawings require quite a bit of interpretation to be translated into a physical structure. Today structures are increasingly being designed in 3D in an object based environment, making the design of the structure computer-understandable. This opens the door to a world of possibilities from design to construction to operation of buildings and other structures.

I love the possibilities of new technologies. I love to tinker and experiment. This will hopefully be reflected in the coming blogs.