{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.8.3+52.g2758dc7.dirty\n" ] } ], "source": [ "import os\n", "import folium\n", "\n", "print(folium.__version__)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1 track(s)\n", "1 segment(s)\n", "1027 point(s)\n" ] } ], "source": [ "import gpxpy\n", "import requests\n", "\n", "\n", "url = 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data'\n", "fname = f'{url}/2014_08_05_farol.gpx'\n", "gpx = gpxpy.parse(requests.get(fname).text)\n", "\n", "print('{} track(s)'.format(len(gpx.tracks)))\n", "track = gpx.tracks[0]\n", "\n", "print('{} segment(s)'.format(len(track.segments)))\n", "segment = track.segments[0]\n", "\n", "print('{} point(s)'.format(len(segment.points)))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "data = []\n", "segment_length = segment.length_3d()\n", "for point_idx, point in enumerate(segment.points):\n", " data.append(\n", " [\n", " point.longitude,\n", " point.latitude,\n", " point.elevation,\n", " point.time,\n", " segment.get_speed(point_idx)\n", " ]\n", " )" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Longitude | \n", "Latitude | \n", "Altitude | \n", "Time | \n", "Speed | \n", "
---|---|---|---|---|---|
0 | \n", "-38.502595 | \n", "-13.005390 | \n", "10.9 | \n", "2014-08-05 17:52:49.330000+00:00 | \n", "NaN | \n", "
1 | \n", "-38.502605 | \n", "-13.005415 | \n", "11.8 | \n", "2014-08-05 17:52:49.770000+00:00 | \n", "2.677749 | \n", "
2 | \n", "-38.502575 | \n", "-13.005507 | \n", "11.7 | \n", "2014-08-05 17:52:54.730000+00:00 | \n", "3.065225 | \n", "
3 | \n", "-38.502545 | \n", "-13.005595 | \n", "11.6 | \n", "2014-08-05 17:52:57.750000+00:00 | \n", "4.228354 | \n", "
4 | \n", "-38.502515 | \n", "-13.005680 | \n", "11.4 | \n", "2014-08-05 17:53:00.720000+00:00 | \n", "3.947037 | \n", "