With review from elem, and oversight from tschaub, rolling in
SphericalMercator changes. Note that this explicitly does *not* include r4182 , so as to keep changes to a single logical set: that should be filed in a seperate bug if it can be reproduced against trunk after this commit. Hooray for Tim, thanks for all the feedback, onward and upward! (Closes #686) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4221 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 512px;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- this gmaps key generated for http://openlayers.org/dev/ -->
|
||||||
|
<!--<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>-->
|
||||||
|
<!-- dev.openlayers.org key -->
|
||||||
|
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeDjUod8ItM9dBg5_lz0esxTk5UTxNMOJaMwpeYJby65YwI0-cxSmHf2_ZfIP7bDb_moMph5qZy25YA" type="text/javascript"></script>
|
||||||
|
<!-- Localhost key -->
|
||||||
|
<!-- <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>-->
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var map, gmap, merc;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
var options = {
|
||||||
|
projection: "EPSG: 54004",
|
||||||
|
units: "m",
|
||||||
|
maxResolution: 156543.0339,
|
||||||
|
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
|
||||||
|
20037508, 20037508.34)
|
||||||
|
};
|
||||||
|
map = new OpenLayers.Map('map', options);
|
||||||
|
|
||||||
|
gmap = new OpenLayers.Layer.GoogleMercator("Google", {'minZoomLevel': 4});
|
||||||
|
var twms = new OpenLayers.Layer.WMS( "World Map",
|
||||||
|
"http://world.freemap.in/tiles?",
|
||||||
|
{layers: 'factbook-overlay', 'format':'png'}, {'reproject': false, isBaseLayer: false} );
|
||||||
|
map.addLayers([gmap, twms]);
|
||||||
|
map.addLayer(twms);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
map.zoomToMaxExtent()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1>OpenLayers With Google Layer Example</h1>
|
||||||
|
<div id="map"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 512px;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- this gmaps key generated for http://openlayers.org/dev/ -->
|
||||||
|
<!--<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>-->
|
||||||
|
<!-- dev.openlayers.org key -->
|
||||||
|
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeDjUod8ItM9dBg5_lz0esxTk5UTxNMOJaMwpeYJby65YwI0-cxSmHf2_ZfIP7bDb_moMph5qZy25YA" type="text/javascript"></script>
|
||||||
|
<!-- Localhost key -->
|
||||||
|
<!-- <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>-->
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var map, gmap, merc;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
var options = {
|
||||||
|
projection: "EPSG: 54004",
|
||||||
|
units: "m",
|
||||||
|
maxResolution: 156543.0339,
|
||||||
|
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
|
||||||
|
20037508, 20037508.34)
|
||||||
|
};
|
||||||
|
map = new OpenLayers.Map('map', options);
|
||||||
|
|
||||||
|
gmap = new OpenLayers.Layer.GoogleMercator("Google", {'minZoomLevel': 4});
|
||||||
|
var twms = new OpenLayers.Layer.WMS( "World Map",
|
||||||
|
"http://world.freemap.in/cgi-bin/mapserv?",
|
||||||
|
{map: '/www/freemap.in/world/map/factbooktrans.map', transparent:'true',
|
||||||
|
layers: 'factbook', 'format':'png'}, {'reproject': false} );
|
||||||
|
map.addLayers([gmap, twms]);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
map.zoomToMaxExtent()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1>OpenLayers With Google Layer Example</h1>
|
||||||
|
<div id="map"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 512px;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script>
|
||||||
|
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var map, ve, merc, vector;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
var options = {
|
||||||
|
projection: "EPSG:900913",
|
||||||
|
units: "m",
|
||||||
|
maxResolution: 156543.0339,
|
||||||
|
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
|
||||||
|
20037508, 20037508)
|
||||||
|
};
|
||||||
|
map = new OpenLayers.Map('map', options);
|
||||||
|
|
||||||
|
ve = new OpenLayers.Layer.MultiMap(
|
||||||
|
"multimap",
|
||||||
|
{'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
merc = new OpenLayers.Layer.WMS("World Map",
|
||||||
|
"http://world.freemap.in/tiles/",
|
||||||
|
{'layers': 'factbook-overlay',
|
||||||
|
'format':'png'},
|
||||||
|
{'reproject': false,
|
||||||
|
'opacity': 0.4,
|
||||||
|
'isBaseLayer': false,
|
||||||
|
'wrapDateLine': true});
|
||||||
|
|
||||||
|
// create a vector layer for drawing
|
||||||
|
vector = new OpenLayers.Layer.Vector("Editable Vectors");
|
||||||
|
|
||||||
|
map.addLayers([ve, merc, vector]);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
map.addControl(new OpenLayers.Control.EditingToolbar(vector));
|
||||||
|
map.zoomToMaxExtent()
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h3>OpenLayers VE Mercator Example</h3>
|
||||||
|
<div id="map"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 512px;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
|
||||||
|
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeDjUod8ItM9dBg5_lz0esxTk5UTxNMOJaMwpeYJby65YwI0-cxSmHf2_ZfIP7bDb_moMph5qZy25YA" type="text/javascript"></script>
|
||||||
|
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
|
||||||
|
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
// make map available for easy debugging
|
||||||
|
var map;
|
||||||
|
|
||||||
|
// avoid pink tiles
|
||||||
|
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
|
||||||
|
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
var options = {
|
||||||
|
projection: "EPSG:900913",
|
||||||
|
units: "m",
|
||||||
|
maxResolution: 156543.0339,
|
||||||
|
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
|
||||||
|
20037508, 20037508.34)
|
||||||
|
};
|
||||||
|
map = new OpenLayers.Map('map', options);
|
||||||
|
|
||||||
|
// create Google Mercator layers
|
||||||
|
var gmap = new OpenLayers.Layer.Google(
|
||||||
|
"Google Streets",
|
||||||
|
{'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var gsat = new OpenLayers.Layer.Google(
|
||||||
|
"Google Sattelite",
|
||||||
|
{type: G_SATELLITE_MAP, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var ghyb = new OpenLayers.Layer.Google(
|
||||||
|
"Google Hybrid",
|
||||||
|
{type: G_HYBRID_MAP, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
|
||||||
|
// create Virtual Earth layers
|
||||||
|
var veroad = new OpenLayers.Layer.VirtualEarth(
|
||||||
|
"Virtual Earth Raods",
|
||||||
|
{'type': VEMapStyle.Road, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var veaer = new OpenLayers.Layer.VirtualEarth(
|
||||||
|
"Virtual Earth Aerial",
|
||||||
|
{'type': VEMapStyle.Aerial, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var vehyb = new OpenLayers.Layer.VirtualEarth(
|
||||||
|
"Virtual Earth Hybrid",
|
||||||
|
{'type': VEMapStyle.Hybrid, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
|
||||||
|
// create Yahoo layer
|
||||||
|
var yahoo = new OpenLayers.Layer.Yahoo(
|
||||||
|
"Yahoo Street",
|
||||||
|
{'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var yahoosat = new OpenLayers.Layer.Yahoo(
|
||||||
|
"Yahoo Sattelite",
|
||||||
|
{'type': YAHOO_MAP_SAT, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
var yahoohyb = new OpenLayers.Layer.Yahoo(
|
||||||
|
"Yahoo Hybrid",
|
||||||
|
{'type': YAHOO_MAP_HYB, 'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
|
||||||
|
// create OSM layer
|
||||||
|
var mapnik = new OpenLayers.Layer.TMS(
|
||||||
|
"OpenStreetMap",
|
||||||
|
"http://tile.openstreetmap.org/",
|
||||||
|
{
|
||||||
|
type: 'png', getURL: osm_getTileURL,
|
||||||
|
displayOutsideMaxExtent: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// create WMS layer
|
||||||
|
var wms = new OpenLayers.Layer.WMS(
|
||||||
|
"World Map",
|
||||||
|
"http://world.freemap.in/tiles/",
|
||||||
|
{'layers': 'factbook-overlay', 'format':'png'},
|
||||||
|
{
|
||||||
|
'reproject': false, 'opacity': 0.4,
|
||||||
|
'isBaseLayer': false,'wrapDateLine': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// create a vector layer for drawing
|
||||||
|
var vector = new OpenLayers.Layer.Vector("Editable Vectors");
|
||||||
|
|
||||||
|
map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb,
|
||||||
|
yahoo, yahoosat, yahoohyb, mapnik, wms]);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
map.addControl(new OpenLayers.Control.EditingToolbar(vector));
|
||||||
|
map.zoomToMaxExtent()
|
||||||
|
}
|
||||||
|
|
||||||
|
function osm_getTileURL(bounds) {
|
||||||
|
var res = this.map.getResolution();
|
||||||
|
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
|
||||||
|
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
|
||||||
|
var z = this.map.getZoom();
|
||||||
|
var limit = Math.pow(2, z);
|
||||||
|
|
||||||
|
if (y < 0 || y >= limit) {
|
||||||
|
return OpenLayers.Util.getImagesLocation() + "404.png";
|
||||||
|
} else {
|
||||||
|
x = ((x % limit) + limit) % limit;
|
||||||
|
return this.url + z + "/" + x + "/" + y + "." + this.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h3>OpenLayers Spherical Mercator Example</h3>
|
||||||
|
<div id="map"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -88,6 +88,7 @@
|
|||||||
"OpenLayers/Tile/Image.js",
|
"OpenLayers/Tile/Image.js",
|
||||||
"OpenLayers/Tile/WFS.js",
|
"OpenLayers/Tile/WFS.js",
|
||||||
"OpenLayers/Layer/Image.js",
|
"OpenLayers/Layer/Image.js",
|
||||||
|
"OpenLayers/Layer/SphericalMercator.js",
|
||||||
"OpenLayers/Layer/EventPane.js",
|
"OpenLayers/Layer/EventPane.js",
|
||||||
"OpenLayers/Layer/FixedZoomLevels.js",
|
"OpenLayers/Layer/FixedZoomLevels.js",
|
||||||
"OpenLayers/Layer/Google.js",
|
"OpenLayers/Layer/Google.js",
|
||||||
|
|||||||
@@ -4,17 +4,20 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @requires OpenLayers/Layer/SphericalMercator.js
|
||||||
* @requires OpenLayers/Layer/EventPane.js
|
* @requires OpenLayers/Layer/EventPane.js
|
||||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||||
*
|
*
|
||||||
* Class: OpenLayers.Layer.Google
|
* Class: OpenLayers.Layer.Google
|
||||||
*
|
*
|
||||||
* Inherits:
|
* Inherits:
|
||||||
|
* - <OpenLayers.Layer.SphericalMercator>
|
||||||
* - <OpenLayers.Layer.EventPane>
|
* - <OpenLayers.Layer.EventPane>
|
||||||
* - <OpenLayers.Layer.FixedZoomLevels>
|
* - <OpenLayers.Layer.FixedZoomLevels>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
OpenLayers.Layer.Google = OpenLayers.Class(
|
||||||
OpenLayers.Layer.FixedZoomLevels, {
|
OpenLayers.Layer.EventPane,
|
||||||
|
OpenLayers.Layer.FixedZoomLevels, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant: MIN_ZOOM_LEVEL
|
* Constant: MIN_ZOOM_LEVEL
|
||||||
@@ -62,6 +65,14 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
*/
|
*/
|
||||||
type: null,
|
type: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: sphericalMercator
|
||||||
|
* {Boolean} Should the map act as a mercator-projected map? This will
|
||||||
|
* cause all interactions with the map to be in the actual map projection,
|
||||||
|
* which allows support for vector drawing, overlaying other maps, etc.
|
||||||
|
*/
|
||||||
|
sphericalMercator: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Layer.Google
|
* Constructor: OpenLayers.Layer.Google
|
||||||
*
|
*
|
||||||
@@ -74,6 +85,10 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
this.addContainerPxFunction();
|
this.addContainerPxFunction();
|
||||||
|
if (this.sphericalMercator) {
|
||||||
|
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
|
||||||
|
this.initMercatorParameters();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,7 +166,6 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
this.mapObject.checkResize();
|
this.mapObject.checkResize();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getZoomForExtent
|
* APIMethod: getZoomForExtent
|
||||||
*
|
*
|
||||||
@@ -199,10 +213,17 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
if (moBounds != null) {
|
if (moBounds != null) {
|
||||||
var sw = moBounds.getSouthWest();
|
var sw = moBounds.getSouthWest();
|
||||||
var ne = moBounds.getNorthEast();
|
var ne = moBounds.getNorthEast();
|
||||||
olBounds = new OpenLayers.Bounds(sw.lng(),
|
if (this.sphericalMercator) {
|
||||||
sw.lat(),
|
sw = this.forwardMercator(sw.lng(), sw.lat());
|
||||||
ne.lng(),
|
ne = this.forwardMercator(ne.lng(), ne.lat());
|
||||||
ne.lat() );
|
} else {
|
||||||
|
sw = new OpenLayers.LonLat(sw.lng(), sw.lat());
|
||||||
|
ne = new OpenLayers.LonLat(ne.lng(), ne.lat());
|
||||||
|
}
|
||||||
|
olBounds = new OpenLayers.Bounds(sw.lon,
|
||||||
|
sw.lat,
|
||||||
|
ne.lon,
|
||||||
|
ne.lat );
|
||||||
}
|
}
|
||||||
return olBounds;
|
return olBounds;
|
||||||
},
|
},
|
||||||
@@ -220,17 +241,18 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
getMapObjectBoundsFromOLBounds: function(olBounds) {
|
getMapObjectBoundsFromOLBounds: function(olBounds) {
|
||||||
var moBounds = null;
|
var moBounds = null;
|
||||||
if (olBounds != null) {
|
if (olBounds != null) {
|
||||||
var sw = new GLatLng(olBounds.bottom, olBounds.left);
|
var sw = this.sphericalMercator ?
|
||||||
var ne = new GLatLng(olBounds.top, olBounds.right);
|
this.inverseMercator(olBounds.bottom, olBounds.left) :
|
||||||
moBounds = new GLatLngBounds(sw, ne);
|
new OpenLayers.LonLat(olBounds.bottom, olBounds.left);
|
||||||
|
var ne = this.sphericalMercator ?
|
||||||
|
this.inverseMercator(olBounds.top, olBounds.right) :
|
||||||
|
new OpenLayers.LonLat(olBounds.top, olBounds.right);
|
||||||
|
moBounds = new GLatLngBounds(new GLatLng(sw.lat, sw.lon),
|
||||||
|
new GLatLng(ne.lat, ne.lon));
|
||||||
}
|
}
|
||||||
return moBounds;
|
return moBounds;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: addContainerPxFunction
|
* Method: addContainerPxFunction
|
||||||
* Hack-on function because GMAPS does not give it to us
|
* Hack-on function because GMAPS does not give it to us
|
||||||
@@ -396,7 +418,9 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
* {Float} Longitude of the given MapObject LonLat
|
* {Float} Longitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.lng();
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lon :
|
||||||
|
moLonLat.lng();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -409,7 +433,10 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
* {Float} Latitude of the given MapObject LonLat
|
* {Float} Latitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.lat();
|
var lat = this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lat :
|
||||||
|
moLonLat.lat();
|
||||||
|
return lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -423,7 +450,14 @@ OpenLayers.Layer.Google = OpenLayers.Class(OpenLayers.Layer.EventPane,
|
|||||||
* {Object} MapObject LonLat built from lon and lat params
|
* {Object} MapObject LonLat built from lon and lat params
|
||||||
*/
|
*/
|
||||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||||
return new GLatLng(lat, lon);
|
var gLatLng;
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
var lonlat = this.inverseMercator(lon, lat);
|
||||||
|
gLatLng = new GLatLng(lonlat.lat, lonlat.lon);
|
||||||
|
} else {
|
||||||
|
gLatLng = new GLatLng(lat, lon);
|
||||||
|
}
|
||||||
|
return gLatLng;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pixel
|
// Pixel
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||||
*
|
*
|
||||||
* Class: OpenLayers.Layer.MultiMap
|
* Class: OpenLayers.Layer.MultiMap
|
||||||
|
* Note that MultiMap does not fully support the sphericalMercator
|
||||||
|
* option. See Ticket #953 for more details.
|
||||||
*
|
*
|
||||||
* Inherits:
|
* Inherits:
|
||||||
* - <OpenLayers.Layers.EventPane>
|
* - <OpenLayers.Layers.EventPane>
|
||||||
@@ -69,6 +71,11 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
|
|||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
|
if (this.sphericalMercator) {
|
||||||
|
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
|
||||||
|
this.initMercatorParameters();
|
||||||
|
this.RESOLUTIONS.unshift(10);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,7 +208,9 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
|
|||||||
* {Float} Longitude of the given MapObject LonLat
|
* {Float} Longitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.lon;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.lon, moLonLat.lat).lon :
|
||||||
|
moLonLat.lon;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,7 +223,9 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
|
|||||||
* {Float} Latitude of the given MapObject LonLat
|
* {Float} Latitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.lat;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.lon, moLonLat.lat).lat :
|
||||||
|
moLonLat.lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,7 +239,14 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
|
|||||||
* {Object} MapObject LonLat built from lon and lat params
|
* {Object} MapObject LonLat built from lon and lat params
|
||||||
*/
|
*/
|
||||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||||
return new MMLatLon(lat, lon);
|
var mmLatLon;
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
var lonlat = this.inverseMercator(lon, lat);
|
||||||
|
mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon);
|
||||||
|
} else {
|
||||||
|
mmLatLon = new MMLatLon(lat, lon);
|
||||||
|
}
|
||||||
|
return mmLatLon;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pixel
|
// Pixel
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/**
|
||||||
|
* @requires OpenLayers/Layer.js
|
||||||
|
*
|
||||||
|
* Class: OpenLayers.Layer.SphericalMercator
|
||||||
|
* A mixin for layers that wraps up the pieces neccesary to have a coordinate
|
||||||
|
* conversion for working with commercial APIs which use a spherical
|
||||||
|
* mercator projection. Using this layer as a base layer, additional
|
||||||
|
* layers can be used as overlays if they are in the same projection.
|
||||||
|
*
|
||||||
|
* A layer is given properties of this object by setting the sphericalMercator
|
||||||
|
* property to true.
|
||||||
|
*
|
||||||
|
* More projection information:
|
||||||
|
* - http://spatialreference.org/ref/user/google-projection/
|
||||||
|
*
|
||||||
|
* Proj4 Text:
|
||||||
|
* +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
|
||||||
|
* +k=1.0 +units=m +nadgrids=@null +no_defs
|
||||||
|
*
|
||||||
|
* WKT:
|
||||||
|
* 900913=PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84",
|
||||||
|
* DATUM["WGS_1984", SPHEROID["WGS_1984", 6378137.0, 298.257223563]],
|
||||||
|
* PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295],
|
||||||
|
* AXIS["Longitude", EAST], AXIS["Latitude", NORTH]],
|
||||||
|
* PROJECTION["Mercator_1SP_Google"],
|
||||||
|
* PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0],
|
||||||
|
* PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0],
|
||||||
|
* PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST],
|
||||||
|
* AXIS["y", NORTH], AUTHORITY["EPSG","900913"]]
|
||||||
|
*/
|
||||||
|
OpenLayers.Layer.SphericalMercator = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: getExtent
|
||||||
|
* Get the map's extent.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.Bounds>} The map extent.
|
||||||
|
*/
|
||||||
|
getExtent: function() {
|
||||||
|
var extent = null;
|
||||||
|
if (this.sphericalMercator) {
|
||||||
|
extent = this.map.calculateBounds();
|
||||||
|
} else {
|
||||||
|
extent = OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this);
|
||||||
|
}
|
||||||
|
return extent;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: initMercatorParameters
|
||||||
|
* Set up the mercator parameters on the layer: resolutions,
|
||||||
|
* projection, units.
|
||||||
|
*/
|
||||||
|
initMercatorParameters: function() {
|
||||||
|
// set up properties for Mercator - assume EPSG:900913
|
||||||
|
this.RESOLUTIONS = [];
|
||||||
|
var maxResolution = 156543.0339;
|
||||||
|
for(var zoom=0; zoom<=this.MAX_ZOOM_LEVEL; ++zoom) {
|
||||||
|
this.RESOLUTIONS[zoom] = maxResolution / Math.pow(2, zoom);
|
||||||
|
}
|
||||||
|
this.units = "m";
|
||||||
|
this.projection = "EPSG:900913";
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: forwardMercator
|
||||||
|
* Given a lon,lat in EPSG:4326, return a point in Spherical Mercator.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* lon - {float}
|
||||||
|
* lat - {float}
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.LonLat>} The coordinates transformed to Mercator.
|
||||||
|
*/
|
||||||
|
forwardMercator: function(lon, lat) {
|
||||||
|
var x = lon * 20037508.34 / 180;
|
||||||
|
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
|
||||||
|
|
||||||
|
y = y * 20037508.34 / 180;
|
||||||
|
|
||||||
|
return new OpenLayers.LonLat(x, y);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: inverseMercator
|
||||||
|
* Given a x,y in Spherical Mercator, return a point in EPSG:4326.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* x - {float} A map x in Spherical Mercator.
|
||||||
|
* y - {float} A map y in Spherical Mercator.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.LonLat>} The coordinates transformed to EPSG:4326.
|
||||||
|
*/
|
||||||
|
inverseMercator: function(x, y) {
|
||||||
|
|
||||||
|
var lon = (x / 20037508.34) * 180;
|
||||||
|
var lat = (y / 20037508.34) * 180;
|
||||||
|
|
||||||
|
lat = 180/Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);
|
||||||
|
|
||||||
|
return new OpenLayers.LonLat(lon, lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
* - <OpenLayers.Layer.FixedZoomLevels>
|
* - <OpenLayers.Layer.FixedZoomLevels>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||||
OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, {
|
OpenLayers.Layer.EventPane,
|
||||||
|
OpenLayers.Layer.FixedZoomLevels, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant: MIN_ZOOM_LEVEL
|
* Constant: MIN_ZOOM_LEVEL
|
||||||
@@ -58,6 +59,15 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
|||||||
*/
|
*/
|
||||||
type: null,
|
type: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: sphericalMercator
|
||||||
|
* {Boolean} Should the map act as a mercator-projected map? This will
|
||||||
|
* cause all interactions with the map to be in the actual map
|
||||||
|
* projection, which allows support for vector drawing, overlaying
|
||||||
|
* other maps, etc.
|
||||||
|
*/
|
||||||
|
sphericalMercator: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Layer.VirtualEarth
|
* Constructor: OpenLayers.Layer.VirtualEarth
|
||||||
*
|
*
|
||||||
@@ -69,6 +79,10 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
|||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
|
||||||
|
this.initMercatorParameters();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,7 +228,9 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
|||||||
* {Float} Longitude of the given MapObject LonLat
|
* {Float} Longitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.Longitude;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lon :
|
||||||
|
moLonLat.Longitude;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,7 +243,9 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
|||||||
* {Float} Latitude of the given MapObject LonLat
|
* {Float} Latitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.Latitude;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lat :
|
||||||
|
moLonLat.Latitude;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,7 +259,14 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
|||||||
* {Object} MapObject LonLat built from lon and lat params
|
* {Object} MapObject LonLat built from lon and lat params
|
||||||
*/
|
*/
|
||||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||||
return new VELatLong(lat, lon);
|
var veLatLong;
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
var lonlat = this.inverseMercator(lon, lat);
|
||||||
|
veLatLong = new VELatLong(lonlat.lat, lonlat.lon);
|
||||||
|
} else {
|
||||||
|
veLatLong = new VELatLong(lat, lon);
|
||||||
|
}
|
||||||
|
return veLatLong;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pixel
|
// Pixel
|
||||||
|
|||||||
@@ -58,6 +58,14 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
*/
|
*/
|
||||||
type: null,
|
type: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: sphericalMercator
|
||||||
|
* {Boolean} Should the map act as a mercator-projected map? This will
|
||||||
|
* cause all interactions with the map to be in the actual map projection,
|
||||||
|
* which allows support for vector drawing, overlaying other maps, etc.
|
||||||
|
*/
|
||||||
|
sphericalMercator: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Layer.Yahoo
|
* Constructor: OpenLayers.Layer.Yahoo
|
||||||
*
|
*
|
||||||
@@ -69,6 +77,10 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
|
||||||
|
this.initMercatorParameters();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,7 +306,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
* {Float} Longitude of the given MapObject LonLat
|
* {Float} Longitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.Lon;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.Lon, moLonLat.Lat).lon :
|
||||||
|
moLonLat.Lon;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,7 +321,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
* {Float} Latitude of the given MapObject LonLat
|
* {Float} Latitude of the given MapObject LonLat
|
||||||
*/
|
*/
|
||||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||||
return moLonLat.Lat;
|
return this.sphericalMercator ?
|
||||||
|
this.forwardMercator(moLonLat.Lon, moLonLat.Lat).lat :
|
||||||
|
moLonLat.Lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,7 +337,14 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
* {Object} MapObject LonLat built from lon and lat params
|
* {Object} MapObject LonLat built from lon and lat params
|
||||||
*/
|
*/
|
||||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||||
return new YGeoPoint(lat, lon);
|
var yLatLong;
|
||||||
|
if(this.sphericalMercator) {
|
||||||
|
var lonlat = this.inverseMercator(lon, lat);
|
||||||
|
yLatLong = new YGeoPoint(lonlat.lat, lonlat.lon);
|
||||||
|
} else {
|
||||||
|
yLatLong = new YGeoPoint(lat, lon);
|
||||||
|
}
|
||||||
|
return yLatLong;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pixel
|
// Pixel
|
||||||
|
|||||||
@@ -129,6 +129,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_Layer_Goole_forwardMercator(t){
|
||||||
|
t.plan(2);
|
||||||
|
//Just test that the fowardMercator function still exists.
|
||||||
|
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
||||||
|
layer.forwardMercator = function(evt) {
|
||||||
|
t.ok( true, "GoogleMercator.forwardMercator was called and executed." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
layer.forwardMercator();
|
||||||
|
//Now test the fowardMercator returns the expected LonLat object
|
||||||
|
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
||||||
|
var lonlat2 = new OpenLayers.LonLat(Math.random(),Math.random());
|
||||||
|
var result = layer.forwardMercator(lonlat2.lon, lonlat2.lat);
|
||||||
|
t.ok( result instanceof OpenLayers.LonLat, "OpenLayers.Google.fowardMercator returns LonLat object" );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function test_Layer_Google_overlay(t) {
|
function test_Layer_Google_overlay(t) {
|
||||||
// Test for #849.
|
// Test for #849.
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!-- this gmaps key generated for http://openlayers.org/dev/ -->
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function test_SphericalMercator_forwardProject(t) {
|
||||||
|
t.plan(12);
|
||||||
|
var arctic = OpenLayers.Layer.SphericalMercator.forwardMercator(0, 85);
|
||||||
|
var antarctic = OpenLayers.Layer.SphericalMercator.forwardMercator(0, -85);
|
||||||
|
var hawaii = OpenLayers.Layer.SphericalMercator.forwardMercator(-180, 0);
|
||||||
|
var phillipines = OpenLayers.Layer.SphericalMercator.forwardMercator(180, 0);
|
||||||
|
var ne = OpenLayers.Layer.SphericalMercator.forwardMercator(180, 90);
|
||||||
|
var sw = OpenLayers.Layer.SphericalMercator.forwardMercator(-180, -90);
|
||||||
|
|
||||||
|
t.eq(arctic.lon, 0, "Arctic longitude is correct");
|
||||||
|
t.eq(Math.round(arctic.lat), 19971869, "Arctic latitude is correct");
|
||||||
|
|
||||||
|
t.eq(antarctic.lon, 0, "Antarctic longitude is correct");
|
||||||
|
t.eq(Math.round(antarctic.lat), -19971869, "Antarctic latitude is correct");
|
||||||
|
|
||||||
|
t.eq(Math.round(hawaii.lat), 0, "Hawaiian lat is correct");
|
||||||
|
t.eq(hawaii.lon, -20037508.34, "Hawaiian lon is correct");
|
||||||
|
|
||||||
|
t.eq(Math.round(phillipines.lat), 0, "Phillipines lat is correct");
|
||||||
|
t.eq(phillipines.lon, 20037508.340, "Phillipines lon is correct");
|
||||||
|
|
||||||
|
// Rounding errors make this not infinity
|
||||||
|
t.ok(ne.lat > 50000000, "NE lat is correct");
|
||||||
|
t.eq(ne.lon, 20037508.34, "NE lon is correct");
|
||||||
|
|
||||||
|
t.eq(sw.lat, -Infinity, "SW lat is correct");
|
||||||
|
t.eq(sw.lon, -20037508.34, "SW lon is correct");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_sphericalMercator_inverseProject(t) {
|
||||||
|
t.plan(4);
|
||||||
|
var sw = OpenLayers.Layer.SphericalMercator.inverseMercator(-20037508.34, -20037508.34);
|
||||||
|
var ne = OpenLayers.Layer.SphericalMercator.inverseMercator(20037508.34, 20037508.34);
|
||||||
|
t.eq(sw.lon, -180, "Southwest lon correct");
|
||||||
|
t.eq(ne.lon, 180, "Northeast lon correct");
|
||||||
|
|
||||||
|
t.eq(sw.lat, -85.05112877980659, "Southwest lat correct");
|
||||||
|
t.eq(ne.lat, 85.05112877980660, "Northeast lat correct");
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
<li>Layer/test_EventPane.html</li>
|
<li>Layer/test_EventPane.html</li>
|
||||||
<li>Layer/test_FixedZoomLevels.html</li>
|
<li>Layer/test_FixedZoomLevels.html</li>
|
||||||
<li>Layer/test_GeoRSS.html</li>
|
<li>Layer/test_GeoRSS.html</li>
|
||||||
|
<li>Layer/test_SphericalMercator.html</li>
|
||||||
<li>Layer/test_Google.html</li>
|
<li>Layer/test_Google.html</li>
|
||||||
<li>Layer/test_Grid.html</li>
|
<li>Layer/test_Grid.html</li>
|
||||||
<li>Layer/test_HTTPRequest.html</li>
|
<li>Layer/test_HTTPRequest.html</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user