Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (48 sloc) 2.037 kb
<html>
<head>
<title>Modest Maps JS</title>
<script type="text/javascript" src="../../src/modestmaps.js"></script>
<script type="text/javascript" src="bluemarble.js"></script>
<script type="text/javascript" src="follower.js"></script>
<script type="text/javascript">
var map;
var jsonFlickrApi;
function initMap() {
var src = document.getElementById('src');
eval(src.textContent || src.innerText);
}
</script>
</head>
<body onload="initMap()">
<h1>Modest Maps JS</h1>
<p><a href="javascript:map.zoomIn()">zoom in</a> | <a href="javascript:map.zoomOut()">zoom out</a>
<br><a href="javascript:map.panLeft()">pan left</a> | <a href="javascript:map.panRight()">pan right</a> | <a href="javascript:map.panDown()">pan down</a> | <a href="javascript:map.panUp()">pan up</a></p>
<div id="map">
</div>
<p>The above div is a map initialized like so:</p>
<pre id="src">
// "import" the namespace
var mm = com.modestmaps;
var provider = new mm.BlueMarbleProvider();
map = new mm.Map('map', provider, new mm.Point(1000,600))
map.setCenterZoom(new mm.Location(37.811530, -122.2666097), 5);
jsonFlickrApi = function(rsp) {
var photos = rsp.photos.photo;
console.log(photos.length);
for (var i = 0; i < photos.length; i++) {
var photo = photos[i];
var url = [ 'http://farm', photo.farm, '.static.flickr.com/', photo.server, '/', photo.id, '_', photo.secret, '_s.jpg' ].join('');
var html = "<" + "img src='" + url + "'" + ">";
var location = new mm.Location(photo.latitude, photo.longitude);
var dimensions = new mm.Point(75, 75);
var f = new mm.Follower(map, location, html, dimensions);
}
}
var script = document.createElement('script');
script.src = 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=a96cbef093a8c0280d3aed4e0c004d4c&tags=clouds&extras=geo&has_geo&format=json';
document.getElementsByTagName('head')[0].appendChild(script);
</pre>
<p>Hands up who wants overlays?</p>
<div id="log"></div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.