Instagram photos map

Published on: October 8, 2014 | Reading Time: 2 min | Last Modified: October 8, 2014


{% include JB/setup %}

I have been using instagram for several months. Since all photos I upload are taken with my phone, all of them have location coordinates. In fact, instagram has a cool feature to show them on a map.

The problem is that the map is only available from the mobile app and it can not be shared with other users through the web, or at least I did not find the way. So, I started to find a way to show a map with my instagram photos.

Luckyly there is a plugin for Leaflet to show instagram photos using this great javascript library. The only problem is that instagram API lets get only the last 20 photos from a user by default, but the endpoint allows to pass it the number of media elements to return, and by means of another endpoint we can know the number of media elements by user.

The code below gets all your instagram photos and show them on a map with OpenStreetMap as base layer, you only need your instagram user id and a developer token.

<div id="map"></div>
    <script src=""></script>
    <script src="./Leaflet.Instagram/examples/lib/fancybox/jquery.fancybox.pack.js"></script>       
    <script src="./Leaflet.Instagram/examples/lib/reqwest.min.js"></script>
    <script src="./Leaflet.Instagram/examples/lib/leaflet/leaflet.js"></script>
    <script src="./Leaflet.Instagram/examples/lib/cluster/leaflet.markercluster.js"></script>           
    <script src="./Leaflet.Instagram/dist/Leaflet.Instagram.Fancybox.Cluster.js"></script>      
    var map ='map').setView([40.47, -3.75], 5);
    L.tileLayer('http://{s}{z}/{x}/{y}.png', {
        attribution: '&copy; <a href="">OpenStreetMap</a> contributors'
        type: "GET",
        dataType: "jsonp",
        cache: false,
        url: "",
        success: function (data) {
            var url = '' +;
            L.instagram.cluster(url, {
            featureGroup: L.instagram.fancybox

You can see as it looks like in the About page of this blog.