-
-
-
- OpenLayers Google with Overlay Example
-
-
-
-
-
-
-
-
-
Google with Overlay Example
-
-
- Google, overlay, mercator, reproject, cleanup
-
-
-
- Demonstrate a Google basemap used with boundary overlay layer.
-
-
-
-
-
-
An overlay in a Geographic projection can be stretched to somewhat
- line up with Google tiles (in a Mercator projection). Results get
- worse farther from the equator. Use the "reproject" option on a
- layer to get this behavior. Use the sphericalMercator option on
- a Google layer to get proper overlays (with other layers in
- Spherical Mercator).
-
-
-
diff --git a/lib/OpenLayers/Layer/WMS.js b/lib/OpenLayers/Layer/WMS.js
index 5e1eaf0290..037a014560 100644
--- a/lib/OpenLayers/Layer/WMS.js
+++ b/lib/OpenLayers/Layer/WMS.js
@@ -31,17 +31,6 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
format: "image/jpeg"
},
- /**
- * Property: reproject
- * *Deprecated*. See http://trac.openlayers.org/wiki/SphericalMercator
- * for information on the replacement for this functionality.
- * {Boolean} Try to reproject this layer if its coordinate reference system
- * is different than that of the base layer. Default is false.
- * Set this in the layer options. Should be set to false in
- * most cases.
- */
- reproject: false,
-
/**
* APIProperty: isBaseLayer
* {Boolean} Default is true for WMS layer
diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js
index fb8b08d931..4cc32df19f 100644
--- a/lib/OpenLayers/Tile.js
+++ b/lib/OpenLayers/Tile.js
@@ -7,8 +7,6 @@
/**
* @requires OpenLayers/BaseTypes/Class.js
* @requires OpenLayers/Util.js
- * @requires OpenLayers/Console.js
- * @requires OpenLayers/Lang.js
*/
/*
@@ -236,43 +234,5 @@ OpenLayers.Tile = OpenLayers.Class({
// to be implemented by subclasses
},
- /**
- * Method: getBoundsFromBaseLayer
- * Take the pixel locations of the corner of the tile, and pass them to
- * the base layer and ask for the location of those pixels, so that
- * displaying tiles over Google works fine.
- *
- * Parameters:
- * position - {}
- *
- * Returns:
- * bounds - {}
- */
- getBoundsFromBaseLayer: function(position) {
- var msg = OpenLayers.i18n('reprojectDeprecated',
- {'layerName':this.layer.name});
- OpenLayers.Console.warn(msg);
- var topLeft = this.layer.map.getLonLatFromLayerPx(position);
- var bottomRightPx = position.clone();
- bottomRightPx.x += this.size.w;
- bottomRightPx.y += this.size.h;
- var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx);
- // Handle the case where the base layer wraps around the date line.
- // Google does this, and it breaks WMS servers to request bounds in
- // that fashion.
- if (topLeft.lon > bottomRight.lon) {
- if (topLeft.lon < 0) {
- topLeft.lon = -180 - (topLeft.lon+180);
- } else {
- bottomRight.lon = 180+bottomRight.lon+180;
- }
- }
- var bounds = new OpenLayers.Bounds(topLeft.lon,
- bottomRight.lat,
- bottomRight.lon,
- topLeft.lat);
- return bounds;
- },
-
CLASS_NAME: "OpenLayers.Tile"
});
diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js
index ee35ed76bb..15646a679b 100644
--- a/lib/OpenLayers/Tile/Image.js
+++ b/lib/OpenLayers/Tile/Image.js
@@ -136,7 +136,9 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
draw: function() {
var drawn = OpenLayers.Tile.prototype.draw.apply(this, arguments);
if (drawn) {
+ // The layer's reproject option is deprecated.
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
+ // getBoundsFromBaseLayer is defined in deprecated.js.
this.bounds = this.getBoundsFromBaseLayer(this.position);
}
if (this.isLoading) {
diff --git a/lib/deprecated.js b/lib/deprecated.js
index 8b573360a6..aa4217b47a 100644
--- a/lib/deprecated.js
+++ b/lib/deprecated.js
@@ -1053,6 +1053,49 @@ if (window.Event) {
var Event = OpenLayers.Event;
}
+/**
+ * Namespace: OpenLayers.Tile
+ */
+OpenLayers.Util.extend(OpenLayers.Tile.prototype, {
+ /**
+ * Method: getBoundsFromBaseLayer
+ * Take the pixel locations of the corner of the tile, and pass them to
+ * the base layer and ask for the location of those pixels, so that
+ * displaying tiles over Google works fine.
+ *
+ * Parameters:
+ * position - {}
+ *
+ * Returns:
+ * bounds - {}
+ */
+ getBoundsFromBaseLayer: function(position) {
+ var msg = OpenLayers.i18n('reprojectDeprecated',
+ {'layerName':this.layer.name});
+ OpenLayers.Console.warn(msg);
+ var topLeft = this.layer.map.getLonLatFromLayerPx(position);
+ var bottomRightPx = position.clone();
+ bottomRightPx.x += this.size.w;
+ bottomRightPx.y += this.size.h;
+ var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx);
+ // Handle the case where the base layer wraps around the date line.
+ // Google does this, and it breaks WMS servers to request bounds in
+ // that fashion.
+ if (topLeft.lon > bottomRight.lon) {
+ if (topLeft.lon < 0) {
+ topLeft.lon = -180 - (topLeft.lon+180);
+ } else {
+ bottomRight.lon = 180+bottomRight.lon+180;
+ }
+ }
+ var bounds = new OpenLayers.Bounds(topLeft.lon,
+ bottomRight.lat,
+ bottomRight.lon,
+ topLeft.lat);
+ return bounds;
+ }
+});
+
/**
* Class: OpenLayers.Control.MouseDefaults
* This class is DEPRECATED in 2.4 and will be removed by 3.0.
diff --git a/tests/Layer/MapServer.html b/tests/Layer/MapServer.html
index 04f73b9e18..59757d89cc 100644
--- a/tests/Layer/MapServer.html
+++ b/tests/Layer/MapServer.html
@@ -229,7 +229,7 @@
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
- layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true, buffer: 2});
+ layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, buffer: 2});
layer.isBaseLayer=false;
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
diff --git a/tests/Layer/WMS.html b/tests/Layer/WMS.html
index 377925926a..3bba3c821b 100644
--- a/tests/Layer/WMS.html
+++ b/tests/Layer/WMS.html
@@ -296,46 +296,6 @@
map.destroy();
}
- function test_Layer_WMS_Reproject (t) {
- var validkey = (window.location.protocol == "file:") ||
- (window.location.host == "localhost") ||
- (window.location.host == "openlayers.org");
- if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
- t.plan(1);
- t.debug_print("Can't test google reprojection in Opera or Safari.");
- } else if(validkey) {
- t.plan(5);
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google("Google");
- map.addLayer(layer);
- var wmslayer = new OpenLayers.Layer.WMS(name, url, params,
- {isBaseLayer: false, reproject:true, buffer: 2});
- wmslayer.isBaseLayer=false;
- map.addLayer(wmslayer);
- map.setCenter(new OpenLayers.LonLat(0,0), 5);
- var tile = wmslayer.grid[0][0];
- t.eq( tile.bounds.left, -22.5, "left side matches" );
- t.eq( tile.bounds.right, -11.25, "right side matches" );
- t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
- t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
- map.destroy();
- } else {
- t.plan(1);
- t.debug_print("can't test google layer from " +
- window.location.host);
- }
-
- var map = new OpenLayers.Map('map');
- layer = new OpenLayers.Layer.WMS(name, url, params, {buffer: 2});
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(0,0), 5);
- var tile = layer.grid[0][0];
- t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay");
-
- map.destroy();
- }
-
function test_Layer_WMS_noGutters (t) {
t.plan(2);
var map = new OpenLayers.Map('map');
diff --git a/tests/Layer/WrapDateLine.html b/tests/Layer/WrapDateLine.html
index 010918e958..15e9d5771a 100644
--- a/tests/Layer/WrapDateLine.html
+++ b/tests/Layer/WrapDateLine.html
@@ -164,7 +164,7 @@
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
"prov_bound,fedlimit,rail,road,popplace",
transparent: "true", format: "image/png"},
- {wrapDateLine: true, reproject: false,encodeBBOX:true, buffer:2});
+ {wrapDateLine: true, encodeBBOX:true, buffer:2});
var m = new OpenLayers.Map('map', {adjustZoom: function(z) {return z;}});
m.addLayers([baselayer,layer]);
m.zoomToMaxExtent();
diff --git a/tests/Tile/Image.html b/tests/Tile/Image.html
index 22aa3ab6fa..fcad0917c7 100644
--- a/tests/Tile/Image.html
+++ b/tests/Tile/Image.html
@@ -255,7 +255,7 @@
var size = new OpenLayers.Size(5,6);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'reproject': true});
+ "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
map.addLayer(layer);
map.zoomToMaxExtent();
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
@@ -263,7 +263,7 @@
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true);
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, "none", "Tile image is invisible.") } );
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'reproject': true, 'alpha':true});
+ "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'alpha':true});
map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw();
diff --git a/tests/deprecated/Layer/WMS.html b/tests/deprecated/Layer/WMS.html
new file mode 100644
index 0000000000..8a2a43eeae
--- /dev/null
+++ b/tests/deprecated/Layer/WMS.html
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/list-tests.html b/tests/list-tests.html
index 199db08c8d..2989999640 100644
--- a/tests/list-tests.html
+++ b/tests/list-tests.html
@@ -229,6 +229,7 @@