Skip to content

Instantly share code, notes, and snippets.

@maptastik
Last active February 16, 2016 22:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptastik/b5b294279912a7d84da5 to your computer and use it in GitHub Desktop.
Save maptastik/b5b294279912a7d84da5 to your computer and use it in GitHub Desktop.
Runkeeper Runs

My runs in Lexington as logged by RunKeeper. GPX files of individual runs were downloaded from RunKeeper and tracks were consolidated into a single GPX file using GPS Babel. I converted the combined GPX file into GeoJSON using OGR2OGR via QGIS 2.8.1. I used MapboxJS to pull in CartoDB's Dark Matter tiles and to generally just set up the map. Finally, I used jQuery to pull in the runs.geojson.

Next steps include:

L.mapbox.accessToken = 'pk.eyJ1IjoibWFwdGFzdGlrIiwiYSI6IjNPMkREV1kifQ.2KGPFZD0QaGfvYzXYotTXQ';
var map = L.map('map').setView([38.046441, -84.497019], 16);
var base = L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd',
maxZoom: 19
}).addTo(map);
var runsLayer;
$.getJSON('runs.geojson', function(data) {
runsLayer = L.mapbox.featureLayer(data);
runsLayer.addTo(map);
runsLayer.setStyle({
color: '#f7ff00',
opacity: 0.06,
weight: 4
});
});
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LexingRuns - Dec 2013 - July 11,2015</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.2.1/mapbox.css' rel='stylesheet' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.2.1/mapbox.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src='app.js'></script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment