avatarÁngel Molina Laguna

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3715

Abstract

latest/org.knime.xml.node.xpath2.XPathNodeFactory/">XPath node</a>, we select and extract the specific field that we want to analyze. In this case, we extract:</p><ul><li>Spatial coordinates, i.e., latitude and longitude.</li><li>Date and Time.</li><li>Elevation.</li></ul><figure id="a7d9"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*pTzHQRPm4eKlXDXDF0t58w.jpeg"><figcaption>Configuration window of the XPath node (image by author).</figcaption></figure><p id="f415">With this minimal set of data, we are ready to build an analytical application. However, we could further enrich our analysis by importing data about the heart rate monitor, power data if we are riding a bike, cadence, etc.</p><h2 id="2147">Step 4: Format dates with the String to Date&Time node</h2><p id="867f">Time to make sure our dates are readable and easy to manipulate. We use the <a href="https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.time.node.convert.stringtodatetime.StringToDateTimeNodeFactory/">String to Date&Time node</a> to convert dates into the proper format and make future operations easier.</p><h2 id="576d">Step 5: Calculate traveled distances with the Lag Column node and distance between 2 lats and lons</h2><p id="2b26">The analysis of the distances covered in our sport activities is essential to know our achievements. To do that, we use the Lag Column node and the “Distance Between 2 Latitudes and Longitudes using Haversine formula” component.</p><p id="1208">First, with the <a href="https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.base.node.preproc.columnlag.LagColumnNodeFactory/">Lag Column node</a>, we create additional columns in our table, where each row contains the geospatial location (latitude and longitude) of the previous activity. This allows us to easily calculate the distances between consecutive locations.</p><p id="92bf">Then, with the “<a href="https://hub.knime.com/-/spaces/-/latest/~B7vrTMFXCLYSe_xw/">Distance Between 2 Latitudes and Longitudes”</a> component, we take advantage of the <a href="https://en.wikipedia.org/wiki/Haversine_formula">Haversine formula</a> to calculate the distance between geographic locations. The formula takes into account the curvature of the Earth, providing precise results for our sports activities.</p><figure id="40f1"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*o9lm1n6CPZkekzQCjpMemw.jpeg"><figcaption>Configuration window of the “Distance Between 2 Latitudes and Longitudes using Haversine” component (image by author).</figcaption></figure><h2 id="610e">Step 6: Calculate the total distance and clean the table</h2><p id="41b9">In this step, we will address two essential tasks: calculating the total distance travelled and cleaning the table for analysis and visualization.</p><p id="93bd">To get a global perspective of our sports activities, we need to calculate the total distance travelled. We use the <a href="https://hub.knime.com/knime/extensions/org.knime.features.timeseries/latest/org.knime.timeseries.node.movagg.MovingAggregationNodeFactory/">Moving Aggregator node</a> to sum the distances between geographic locations, previously generated with the “Distance Between 2 Latitudes and Longitudes” component.</p><p id="c441">Once we have calculated the total distance, it is important to clean up our table and prepare it for analysis and visualization. We use the <a href="https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.base.node.preproc.manipulator.TableManipulatorNodeFactory/">Table Manipulator node</a> to remove the columns we don’t need and rename the column containing the distan

Options

ce.</p><figure id="9f6a"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*hfkDsggAfRvZlr_Ra_H5aA.jpeg"><figcaption>Configurations of the Moving Aggregator node (image by author).</figcaption></figure><h2 id="1c95">Step 7: Transform Latitude and Longitude with the Lat/Lon to Geometry node</h2><p id="580f">Now that our data is ready, it’s time to perform the final transformation before visualizing it. We use the <a href="https://hub.knime.com/center%20for%20geographic%20analysis%20at%20harvard%20university/extensions/sdl.harvard.features.geospatial/latest/org.knime.python3.nodes.extension.ExtensionNodeSetFactory$DynamicExtensionNodeFactory:668f214a/">Lat/Lon to Geometry node</a> to convert latitude and longitude coordinates into a geometry format that is more suitable for visualization on an interactive map (see results below).</p><figure id="56a0"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Mubznoa2p4kJdIi-Ma2SFA.jpeg"><figcaption>The final table before display (image by author).</figcaption></figure><h2 id="7193">Step 8: Visualize the data with the KNIME Geospatial View node</h2><p id="6830">The <a href="https://hub.knime.com/center%20for%20geographic%20analysis%20at%20harvard%20university/extensions/sdl.harvard.features.geospatial/latest/org.knime.python3.nodes.extension.ExtensionNodeSetFactory$DynamicExtensionNodeFactory:3beb2f06/">Geospatial View node</a> is a powerful tool that allows us to visualize our geospatial data on an interactive map. With this node, we can explore our routes and sport activities visually and without coding.</p><p id="b19d">In this case, we’ll use elevation as the column to change the colour of the track on the map, but we can adjust both thickness and colour in this node based on many other columns, e.g., speed, heart rate, power, etc.</p><p id="92be">By customizing the visualization according to different variables, we can obtain a more detailed and meaningful perspective of our sports activities.</p><figure id="7854"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*rOtcaySjclTURthgEoieUw.gif"><figcaption>Full activity display (GIF by author).</figcaption></figure><h1 id="a014">Conclusion</h1><p id="58a6">Blending KNIME and Strava, we have figured out how to turn our geospatial data into valuable and visually compelling information. From calculating the total distance travelled to preparing and displaying our sporting achievements, KNIME proves its versatility as a powerful tool for analyzing geospatial data without requiring any programming knowledge.</p><p id="f336">But the potential of KNIME goes much further. Imagine what we could achieve by combining data from our sport activities with information from other sources. Take, for example, weather data, hours of sleep, power in cyclists, speed, heart rate — everything you want. With KNIME, we have at our disposal endless possibilities to enrich our analysis and obtain a complete view of our performance.</p><p id="0e34">So do not wait any longer and try it out yourself! If you want to further explore the KNIME universe and find out how to integrate APIs and perform deep analysis, just say so in the comments. We will be happy to share with you more insights and help you boost your sport performance.</p><p id="754e">PS: Don’t forget to follow to me on <a href="https://www.linkedin.com/in/angel-molina-laguna/">LinkedIn</a> and <a href="https://twitter.com/MoLa_data">Twitter</a> to support my work. Or subscribe to my <a href="https://www.linkedin.com/newsletters/ciencia-de-datos-con-knime-7083850184727666688/">weekly KNIME newsletter in Spanish</a> on LinkedIn.</p><p id="261b">Thanks for reading!</p></article></body>

DATA STORIES | SPORT ANALYTICS | KNIME ANALYTICS PLATFORM

Boost your Passion for Sport! Analyze your Sports Data with KNIME + Strava

Discover and visualize your sport feats without the need to be a programmer. Prepare to be amazed!

Photo by Chanan Greenblatt on Unsplash.

Passion for sport and technology come together in this exciting guide, where we’ll explore how to harness the power of KNIME to analyze Strava geospatial data. If you are a sports enthusiast and want to discover new perspectives on your activities, you have come to the right place! We’ll learn how to perform a detailed data analysis step-by-step, from downloading Strava data to viewing routes on a map.

Complete workflow (image by author).

You can download the workflow for free from the KNIME Community Hub.

Step 1: Download geospatial data from Strava

We are going to obtain the data from Strava, but it could be from any other platform. In our case, we chose the GPX format to download the data.

Please note that, to get the data, we could have connected via API to Strava directly. We didn’t do it this way to simplify the workflow, but if you are interested in seeing this way of retrieving the dataset, let us know in the comment below and we will make another article where we will connect to and retrieve data directly from Strava. For example, we could have also connected via API to the website of the State Meteorological Agency of Spain and gotten the temperatures or the wind during training… Interesting, isn’t it?

Step 2: Import the data with the XML Reader node

Once we have our data downloaded locally, we use the XML Reader node to import the dataset and start analyzing it.

Step 3: Extract specific data with the XPath node

With the help of the XPath node, we select and extract the specific field that we want to analyze. In this case, we extract:

  • Spatial coordinates, i.e., latitude and longitude.
  • Date and Time.
  • Elevation.
Configuration window of the XPath node (image by author).

With this minimal set of data, we are ready to build an analytical application. However, we could further enrich our analysis by importing data about the heart rate monitor, power data if we are riding a bike, cadence, etc.

Step 4: Format dates with the String to Date&Time node

Time to make sure our dates are readable and easy to manipulate. We use the String to Date&Time node to convert dates into the proper format and make future operations easier.

Step 5: Calculate traveled distances with the Lag Column node and distance between 2 lats and lons

The analysis of the distances covered in our sport activities is essential to know our achievements. To do that, we use the Lag Column node and the “Distance Between 2 Latitudes and Longitudes using Haversine formula” component.

First, with the Lag Column node, we create additional columns in our table, where each row contains the geospatial location (latitude and longitude) of the previous activity. This allows us to easily calculate the distances between consecutive locations.

Then, with the “Distance Between 2 Latitudes and Longitudes” component, we take advantage of the Haversine formula to calculate the distance between geographic locations. The formula takes into account the curvature of the Earth, providing precise results for our sports activities.

Configuration window of the “Distance Between 2 Latitudes and Longitudes using Haversine” component (image by author).

Step 6: Calculate the total distance and clean the table

In this step, we will address two essential tasks: calculating the total distance travelled and cleaning the table for analysis and visualization.

To get a global perspective of our sports activities, we need to calculate the total distance travelled. We use the Moving Aggregator node to sum the distances between geographic locations, previously generated with the “Distance Between 2 Latitudes and Longitudes” component.

Once we have calculated the total distance, it is important to clean up our table and prepare it for analysis and visualization. We use the Table Manipulator node to remove the columns we don’t need and rename the column containing the distance.

Configurations of the Moving Aggregator node (image by author).

Step 7: Transform Latitude and Longitude with the Lat/Lon to Geometry node

Now that our data is ready, it’s time to perform the final transformation before visualizing it. We use the Lat/Lon to Geometry node to convert latitude and longitude coordinates into a geometry format that is more suitable for visualization on an interactive map (see results below).

The final table before display (image by author).

Step 8: Visualize the data with the KNIME Geospatial View node

The Geospatial View node is a powerful tool that allows us to visualize our geospatial data on an interactive map. With this node, we can explore our routes and sport activities visually and without coding.

In this case, we’ll use elevation as the column to change the colour of the track on the map, but we can adjust both thickness and colour in this node based on many other columns, e.g., speed, heart rate, power, etc.

By customizing the visualization according to different variables, we can obtain a more detailed and meaningful perspective of our sports activities.

Full activity display (GIF by author).

Conclusion

Blending KNIME and Strava, we have figured out how to turn our geospatial data into valuable and visually compelling information. From calculating the total distance travelled to preparing and displaying our sporting achievements, KNIME proves its versatility as a powerful tool for analyzing geospatial data without requiring any programming knowledge.

But the potential of KNIME goes much further. Imagine what we could achieve by combining data from our sport activities with information from other sources. Take, for example, weather data, hours of sleep, power in cyclists, speed, heart rate — everything you want. With KNIME, we have at our disposal endless possibilities to enrich our analysis and obtain a complete view of our performance.

So do not wait any longer and try it out yourself! If you want to further explore the KNIME universe and find out how to integrate APIs and perform deep analysis, just say so in the comments. We will be happy to share with you more insights and help you boost your sport performance.

PS: Don’t forget to follow to me on LinkedIn and Twitter to support my work. Or subscribe to my weekly KNIME newsletter in Spanish on LinkedIn.

Thanks for reading!

Running
Knime
Data Science
Stories
Editors Pick
Recommended from ReadMedium