Simplify constructor by setting projection.
This commit is contained in:
@@ -78,10 +78,12 @@
|
|||||||
for (var idx in dataLookup) {
|
for (var idx in dataLookup) {
|
||||||
// idx can be used to retrieve layer from map.layers[idx]
|
// idx can be used to retrieve layer from map.layers[idx]
|
||||||
data = dataLookup[idx];
|
data = dataLookup[idx];
|
||||||
|
if (data) {
|
||||||
msg += "<strong>In 2005, " + data.NAME + " had a population of " +
|
msg += "<strong>In 2005, " + data.NAME + " had a population of " +
|
||||||
data.POP2005 + " people.</strong> ";
|
data.POP2005 + " people.</strong> ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
document.getElementById("attrsdiv").innerHTML = msg;
|
document.getElementById("attrsdiv").innerHTML = msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,11 @@
|
|||||||
* map.addLayer(world_utfgrid);
|
* map.addLayer(world_utfgrid);
|
||||||
*
|
*
|
||||||
* var control = new OpenLayers.Control.UTFGrid({
|
* var control = new OpenLayers.Control.UTFGrid({
|
||||||
* 'div': 'attrsdiv',
|
* layers: [world_utfgrid],
|
||||||
* 'layers': [world_utfgrid],
|
* handlerMode: 'move',
|
||||||
* 'handlerMode': 'move'
|
* callback: function(dataLookup) {
|
||||||
|
* // do something with returned data
|
||||||
|
* }
|
||||||
* })
|
* })
|
||||||
* (end code)
|
* (end code)
|
||||||
*
|
*
|
||||||
@@ -45,13 +47,11 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
isBaseLayer: false,
|
isBaseLayer: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: sphericalMecator
|
* APIProperty: projection
|
||||||
* Whether the tile extents should be set to the defaults for
|
* {<OpenLayers.Projection>}
|
||||||
* spherical mercator. Useful for things like OpenStreetMap.
|
* Source projection for the UTFGrids. Default is "EPSG:900913".
|
||||||
* Default is true as most (all?) utfgrid implementations assume
|
|
||||||
* sperical mercator.
|
|
||||||
*/
|
*/
|
||||||
sphericalMercator: false,
|
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: zoomOffset
|
* APIProperty: zoomOffset
|
||||||
@@ -106,24 +106,7 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, options) {
|
initialize: function(name, url, options) {
|
||||||
if (options && options.sphericalMercator || this.sphericalMercator) {
|
OpenLayers.Layer.Grid.prototype.initialize.apply(this, [name, url, {}, options]);
|
||||||
options = OpenLayers.Util.extend({
|
|
||||||
maxExtent: new OpenLayers.Bounds(
|
|
||||||
-128 * 156543.03390625,
|
|
||||||
-128 * 156543.03390625,
|
|
||||||
128 * 156543.03390625,
|
|
||||||
128 * 156543.03390625
|
|
||||||
),
|
|
||||||
maxResolution: 156543.03390625,
|
|
||||||
numZoomLevels: 19,
|
|
||||||
units: "m",
|
|
||||||
projection: "EPSG:900913"
|
|
||||||
}, options);
|
|
||||||
}
|
|
||||||
url = url || this.url;
|
|
||||||
name = name || this.name;
|
|
||||||
var newArguments = [name, url, {}, options];
|
|
||||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user