59°F

Aaron Parecki

  • Articles
  • Notes
  • Photos
  • Mapping all the songs we listened to on a road trip!

    July 17, 2013

    Last weekend Amber, Anima and I drove from San Diego to Palm Springs to YxYY. We were streaming music from Spotify on the whole drive, and Spotify was scrobbling to my Last.fm account. Of course I was also tracking my location like I always do. Then it dawned on me that I could put together a map showing all the songs we listened to and where we were for each! Below is the result!

    You can click on any of the pins to see the song that was playing at that point, and can even launch Spotify to play them!

    Code

    You can download the full source code here: github.com/aaronpk/music-map

    First I downloaded my listening from Last.fm from the time period of the drive. Since each entry in the history includes a timestamp, I then query the Geoloqi API for my location at that time. I do this for each song, building up a GeoJSON object with all the needed info like song name, album cover image, etc.

    The end result looks like a bunch of the GeoJSON features below

    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -117.16489882608,
          32.708429871758
        ]
      },
      "properties": {
        "trackName": "Get Lucky",
        "trackAlbum": "Random Access Memories",
        "trackArtist": "Daft Punk",
        "trackURL": "http://www.last.fm/music/Daft+Punk/_/Get+Lucky+(feat.+Pharrell+Williams)",
        "image": "http://userserve-ak.last.fm/serve/126/91455201.png",
        "localDate": "2013-07-12 14:38:01",
        "localDateFormatted": "Jul 12 2:38pm",
        "timestamp": 1373665081,
        "spotifyURL": "http://open.spotify.com/track/69kOkLUCkxIZYexIgSG8rq"
      }
    }
    

    After I generated the large GeoJSON file of all the songs, it was simple to put that onto the map using the Esri-Leaflet library. Leaflet can easily take a GeoJSON object and throw it onto the map with very little code. Most of the code was for formatting the HTML popup when you click one of the pins.

    I then needed to retrieve the full history showing the exact path we drove. One call to the Geoloqi API gave me all the data in the time range, and I just had to re-format it as a GeoJSON LineString object.

    Download the source code and try it yourself!

    Playlist

    Below is the playlist in Spotify so you can listen to the full playlist.

    Have you ever made a project where you synced up songs to your location? Let me know!

    Fork me on GitHub

    Wed, Jul 17, 2013 10:48pm -07:00 #music #spotify #map #leaflet #esri #yxyy
    1 mention

    Other Mentions

    • aaronparecki.com
      Sun, Aug 25, 2013 9:28am -07:00
Posted in /articles

Hi, I'm Aaron Parecki, Director of Identity Standards at Okta, and co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and participate in the OAuth Working Group at the IETF. I also help people learn about video production and livestreaming. (detailed bio)

I've been tracking my location since 2008 and I wrote 100 songs in 100 days. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel. Read more.

  • Director of Identity Standards at Okta
  • IndieWebCamp Founder
  • OAuth WG Editor
  • OpenID Board Member

  • 🎥 YouTube Tutorials and Reviews
  • 🏠 We're building a triplex!
  • ⭐️ Life Stack
  • ⚙️ Home Automation
  • All
  • Articles
  • Bookmarks
  • Notes
  • Photos
  • Replies
  • Reviews
  • Trips
  • Videos
  • Contact
© 1999-2025 by Aaron Parecki. Powered by p3k. This site supports Webmention.
Except where otherwise noted, text content on this site is licensed under a Creative Commons Attribution 3.0 License.
IndieWebCamp Microformats Webmention W3C HTML5 Creative Commons
WeChat ID
aaronpk_tv