diff --git a/examples/utfgrid.html b/examples/utfgrid.html
index bf2da530e1..e92c206dfb 100644
--- a/examples/utfgrid.html
+++ b/examples/utfgrid.html
@@ -78,8 +78,10 @@
for (var idx in dataLookup) {
// idx can be used to retrieve layer from map.layers[idx]
data = dataLookup[idx];
- msg += "In 2005, " + data.NAME + " had a population of " +
- data.POP2005 + " people. ";
+ if (data) {
+ msg += "In 2005, " + data.NAME + " had a population of " +
+ data.POP2005 + " people. ";
+ }
}
}
document.getElementById("attrsdiv").innerHTML = msg;
diff --git a/lib/OpenLayers/Layer/UTFGrid.js b/lib/OpenLayers/Layer/UTFGrid.js
index 223dfe27a1..a25a4e8519 100644
--- a/lib/OpenLayers/Layer/UTFGrid.js
+++ b/lib/OpenLayers/Layer/UTFGrid.js
@@ -26,9 +26,11 @@
* map.addLayer(world_utfgrid);
*
* var control = new OpenLayers.Control.UTFGrid({
- * 'div': 'attrsdiv',
- * 'layers': [world_utfgrid],
- * 'handlerMode': 'move'
+ * layers: [world_utfgrid],
+ * handlerMode: 'move',
+ * callback: function(dataLookup) {
+ * // do something with returned data
+ * }
* })
* (end code)
*
@@ -45,13 +47,11 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
isBaseLayer: false,
/**
- * APIProperty: sphericalMecator
- * Whether the tile extents should be set to the defaults for
- * spherical mercator. Useful for things like OpenStreetMap.
- * Default is true as most (all?) utfgrid implementations assume
- * sperical mercator.
+ * APIProperty: projection
+ * {}
+ * Source projection for the UTFGrids. Default is "EPSG:900913".
*/
- sphericalMercator: false,
+ projection: new OpenLayers.Projection("EPSG:900913"),
/**
* 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
*/
initialize: function(name, url, options) {
- if (options && options.sphericalMercator || this.sphericalMercator) {
- 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);
+ OpenLayers.Layer.Grid.prototype.initialize.apply(this, [name, url, {}, options]);
},
/**