Created
October 6, 2014 16:20
-
-
Save psanxiao/ac1ccc30340be81e914c to your computer and use it in GitHub Desktop.
Instagram photos map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="map"></div> | |
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></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> | |
<script> | |
var map = L.map('map').setView([40.47, -3.75], 5); | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
$.ajax({ | |
type: "GET", | |
dataType: "jsonp", | |
cache: false, | |
url: "https://api.instagram.com/v1/users/YOUR_USER_ID_HERE?access_token=YOUR_INSTAGRAM_TOKEN_HERE", | |
success: function (data) { | |
var url = 'https://api.instagram.com/v1/users/YOUR_USER_ID_HERE/media/recent?access_token=YOUR_INSTAGRAM_TOKEN_HERE&count=' + data.data.counts.media; | |
L.instagram.cluster(url, { | |
featureGroup: L.instagram.fancybox | |
} | |
).addTo(map); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment