Permalink
Browse files

Merge pull request #98 from stamen/nocoerce

Nocoerce
  • Loading branch information...
tmcw committed Feb 1, 2012
2 parents bef04e2 + c889439 commit 7927b5d3c2535c365cd655fa4838fcc8a8109120
@@ -15,7 +15,7 @@
var template = 'http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png';
var subdomains = [ '', 'a.', 'b.', 'c.' ];
- var provider = new MM.TemplatedMapProvider(template, subdomains);
+ var provider = new MM.TemplatedLayer(template, subdomains);
map = new MM.Map('map', provider, null, [
new MM.MouseWheelHandler(null, true)
@@ -23,9 +23,9 @@ <h1>Modest Maps JS</h1>
// "import" the namespace
var mm = com.modestmaps;
-var provider = new mm.TemplatedMapProvider('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg');
+var layer = new mm.TemplatedLayer('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg');
-map = new mm.Map('map', provider, new mm.Point(1024,768))
+map = new mm.Map('map', layer, new mm.Point(1024,768))
var f = new mm.Follower(map, new mm.Location(37.811530, -122.2666097), 'Broadway and Grand');
@@ -89,13 +89,9 @@ if (!com) {
dimensions: null,
margin: null,
- draw: function(map)
- {
- console.log(Date.now());
-
+ draw: function(map) {
try {
var point = map.coordinatePoint(this.coord);
-
} catch(e) {
console.error(e);
// too soon?
@@ -148,4 +144,4 @@ if (!com) {
};
-})(com.modestmaps)
+})(com.modestmaps)
@@ -10,33 +10,25 @@
function initMap() {
// "import" the namespace
- var mm = com.modestmaps;
-
// please use your own API key, see http://developers.cloudmade.com/ for more details
- var provider = new mm.CloudMadeProvider('1a914755a77758e49e19a26e799268b7','999');
-
- map = new mm.Map('map', provider, new mm.Point(640,480))
-
- map.setCenterZoom(new mm.Location(37.774, -122.422), 11);
+ var provider = new MM.Layer(new MM.CloudMadeProvider('1a914755a77758e49e19a26e799268b7','999'));
+ map = new MM.Map('map', provider, new MM.Point(640,480))
+ map.setCenterZoom(new MM.Location(37.774, -122.422), 11);
loadYQL("http://cabspotting.org/cabs.xml.php", 'cablist');
}
-
function loadYQL(url, callback) {
var yqlURL = 'http://query.yahooapis.com/v1/public/yql';
-
- var yqlArgs = {
+ var yqlArgs = {
q: 'select * from xml where url="'+url+'"',
format: 'json',
callback: callback
};
-
var queries = [];
for (var prop in yqlArgs) {
queries.push(prop + '=' + yqlArgs[prop]);
}
-
var script = document.createElement('script');
script.src = yqlURL + '?' + queries.join('&');
document.getElementsByTagName('head')[0].appendChild(script);
@@ -7,7 +7,7 @@
window.onload = function() {
var MM = com.modestmaps;
- var provider = new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
+ var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var map = new MM.Map(document.body, provider)
.setCenter(new MM.Location(51.5001524, -0.1262362))
.setZoom(11);
@@ -5,10 +5,8 @@
<script type="text/javascript" src="../../modestmaps.js"></script>
<script type="text/javascript">
window.onload = function() {
- // "import" the namespace
- var provider = new MM.TemplatedMapProvider("http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png");
-
- map = new MM.Map(document.body, provider)
+ var layer = new MM.TemplatedLayer("http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png");
+ map = new MM.Map(document.body, layer)
var minZoom = 2;
var maxZoom = 10;
@@ -22,14 +20,14 @@
];
// override provider limits so that tiles are not loaded unless they are inside these bounds:
- provider.tileLimits = [
+ layer.tileLimits = [
map.locationCoordinate(topLeft).zoomTo(minZoom),
map.locationCoordinate(bottomRight).zoomTo(maxZoom)
];
// override sourceCoordinate so that it doesn't use coord limits to wrap tiles
// but so that it rejects any tile coordinates that lie outside the limits
- provider.sourceCoordinate = function(coord) {
+ layer.sourceCoordinate = function(coord) {
// don't need .container() stuff here but it means *something* will get loaded at low zoom levels
// e.g. at level 0 the base tile could contain the entire extent
// skip the .container() stuff if you don't want to load/render tiles outside the extent *at all*
@@ -10,8 +10,8 @@
function initMap() {
// the map
- var provider = new MM.TemplatedMapProvider("http://acetate.geoiq.com/tiles/acetate-base/{Z}/{X}/{Y}.png");
- map = new MM.Map("map", provider);
+ var layer = new MM.TemplatedLayer("http://acetate.geoiq.com/tiles/acetate-base/{Z}/{X}/{Y}.png");
+ map = new MM.Map("map", layer);
// the initial extent
var extent = new MM.MapExtent(37.837, -122.522, 37.691, -122.350);
@@ -1,10 +1,10 @@
-com.modestmaps.BlueMarbleProvider = function() {
- com.modestmaps.MapProvider.call(this, function(coordinate) {
+MM.BlueMarbleProvider = function() {
+ MM.MapProvider.call(this, function(coordinate) {
coordinate = this.sourceCoordinate(coordinate);
if (!coordinate) return null;
var img = coordinate.zoom.toFixed(0) +'-r'+ coordinate.row.toFixed(0) +'-c'+ coordinate.column.toFixed(0) + '.jpg';
return 'http://s3.amazonaws.com/com.modestmaps.bluemarble/' + img;
});
};
-com.modestmaps.extend(com.modestmaps.BlueMarbleProvider, com.modestmaps.MapProvider);
+com.modestmaps.extend(MM.BlueMarbleProvider, MM.MapProvider);
@@ -25,7 +25,7 @@ <h1>Modest Maps JS</h1>
// "import" the namespace
var MM = com.modestmaps;
-var provider = new MM.BlueMarbleProvider();
+var provider = new MM.Layer(new MM.BlueMarbleProvider());
map = new MM.Map('map', provider, new MM.Point(1024,512))
@@ -7,8 +7,7 @@ if (!com) {
}
(function(MM){
-MM.Follower = function(map, location, content, dimensions)
-{
+MM.Follower = function(map, location, content, dimensions) {
this.coord = map.locationCoordinate(location);
this.offset = new MM.Point(0, 0);
@@ -10,7 +10,7 @@
markers;
function initMap() {
- var provider = new MM.TemplatedMapProvider("http://ecn.t{S}.tiles.virtualearth.net/tiles/r{Q}?g=689&mkt=en-us&lbl=l0&stl=m", [0,1,2,3,4,5,6,7]);
+ var provider = new MM.TemplatedLayer("http://ecn.t{S}.tiles.virtualearth.net/tiles/r{Q}?g=689&mkt=en-us&lbl=l0&stl=m", [0,1,2,3,4,5,6,7]);
map = new MM.Map("map", provider);
map.setCenterZoom(new MM.Location(37.764, -122.419), 12);
@@ -137,7 +137,7 @@
var container = document.getElementById('container');
map = new com.modestmaps.Map('map',
- new com.modestmaps.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'),
+ new com.modestmaps.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'),
new com.modestmaps.Point(container.offsetWidth, container.offsetHeight));
map.setCenterZoom(new com.modestmaps.Location(0, 0), 1);
@@ -9,7 +9,7 @@
window.onload = function() {
- var provider = new com.modestmaps.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
+ var provider = new com.modestmaps.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
map = new com.modestmaps.Map(document.body, provider);
View
@@ -8,7 +8,7 @@
map, hash;
function initMap() {
- var provider = new MM.TemplatedMapProvider("http://acetate.geoiq.com/tiles/acetate/{Z}/{X}/{Y}.png");
+ var provider = new MM.TemplatedLayer("http://acetate.geoiq.com/tiles/acetate/{Z}/{X}/{Y}.png");
map = new MM.Map("map", provider);
map.setCenterZoom(new MM.Location(37.804, -122.252), 12);
hash = new MM.Hash(map);
@@ -14,15 +14,15 @@
var subdomains = [ 'a.', 'b.', 'c.', '' ];
var providers = [
- new MM.TemplatedMapProvider('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.png'),
- new MM.TemplatedMapProvider('http://oakland-1967.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
- new MM.TemplatedMapProvider('http://oakland-1950s.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
- new MM.TemplatedMapProvider('http://oakland-sf-1936.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
- new MM.TemplatedMapProvider('http://oakland-1912.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
- new MM.TemplatedMapProvider('http://oakland-1877.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
- new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/997/256/{Z}/{X}/{Y}.png', subdomains),
- new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/998/256/{Z}/{X}/{Y}.png', subdomains),
- new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/999/256/{Z}/{X}/{Y}.png', subdomains)
+ new MM.TemplatedLayer('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.png'),
+ new MM.TemplatedLayer('http://oakland-1967.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
+ new MM.TemplatedLayer('http://oakland-1950s.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
+ new MM.TemplatedLayer('http://oakland-sf-1936.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
+ new MM.TemplatedLayer('http://oakland-1912.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
+ new MM.TemplatedLayer('http://oakland-1877.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
+ new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/997/256/{Z}/{X}/{Y}.png', subdomains),
+ new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/998/256/{Z}/{X}/{Y}.png', subdomains),
+ new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/999/256/{Z}/{X}/{Y}.png', subdomains)
];
for (var i = 0; i < providers.length; i++) {
@@ -160,7 +160,7 @@
function initMap() {
- var provider = new MM.TemplatedMapProvider('http://oatile1.mqcdn.com/naip/{Z}/{X}/{Y}.jpg')
+ var provider = new MM.TemplatedLayer('http://oatile1.mqcdn.com/naip/{Z}/{X}/{Y}.jpg')
// new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png')
var handler = new MM.ThrowableHandler();
@@ -11,10 +11,10 @@
{
var mm = com.modestmaps,
bust = '?q=005',
- bg = new MM.Layer(new mm.TemplatedMapProvider('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust)),
- fg = new MM.Layer(new mm.TemplatedMapProvider('http://acetate.geoiq.com/tiles/acetate-fg/{Z}/{X}/{Y}.png'+bust)),
- osm = new MM.Layer(new mm.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'+bust)),
- mq = new MM.Layer(new mm.TemplatedMapProvider('http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.jpg'+bust));
+ bg = new MM.Layer(new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust)),
+ fg = new MM.Layer(new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/acetate-fg/{Z}/{X}/{Y}.png'+bust)),
+ osm = new MM.Layer(new mm.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'+bust)),
+ mq = new MM.Layer(new mm.TemplatedLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.jpg'+bust));
var map = new mm.Map('map', [bg, fg], new mm.Point(800, 360));
@@ -95,7 +95,7 @@
function initMap() {
map = new MM.Map('map',
- new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'));
+ new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'));
map.setCenterZoom(new MM.Location(0, 0), 1);
@@ -11,7 +11,7 @@
var key = "AjBbdc2nn_71Hyc__uvinjvuHX5g8GLMiVYCJdx7XLLfiSenf1qtnmbv_VO8iyOj",
style = 'AerialWithLabels',
provider = new MM.BingProvider(key, style, function() {
- map = new MM.Map(document.body, provider)
+ map = new MM.Map(document.body, new MM.Layer(provider))
map.setCenterZoom(new MM.Location(37.804656, -122.263606), 14);
});
}
@@ -9,7 +9,7 @@
var map, nav;
window.onload = function() {
- var provider = new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
+ var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
map = new MM.Map('map', provider);
nav = new MM.Map('nav', provider);
@@ -101,7 +101,7 @@ renderStaticMap(provider, dimensions, 11, location, function(err, canvas) {
// just one for now...
var providers = {
- osm: new MM.TemplatedMapProvider("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png")
+ osm: new MM.TemplatedLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png")
}
var app = express.createServer();
@@ -9,7 +9,7 @@
// "import" the namespace
var MM = com.modestmaps;
- var provider = new MM.TemplatedMapProvider("http://placehold.it/256/ccc/000.png&text={Z}/{X}/{Y}");
+ var provider = new MM.TemplatedLayer("http://placehold.it/256/ccc/000.png&text={Z}/{X}/{Y}");
map = new MM.Map('map', provider)
map.setCenterZoom(new MM.Location(37.804656, -122.263606), 14);
}
@@ -15,7 +15,7 @@
// defaults to Google-style Mercator projection, so works
// out of the box with OpenStreetMap and friends:
var template = 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png';
- var provider = new MM.TemplatedMapProvider(template);
+ var provider = new MM.TemplatedLayer(template);
// without a size, it will expand to fit the parent:
map = new MM.Map(parent, provider);
@@ -57,4 +57,4 @@
<div id='map_div'></div>
<a href='#' id='toggle'>toggle map visibility</a>
</body>
-</html>
+</html>
Oops, something went wrong.

0 comments on commit 7927b5d

Please sign in to comment.