diff --git a/examples/anchored-elements.js b/examples/anchored-elements.js
index 443b0ccf17..e3a0fe2bcb 100644
--- a/examples/anchored-elements.js
+++ b/examples/anchored-elements.js
@@ -25,7 +25,7 @@ var map = new ol.Map({
// Vienna label
var vienna = new ol.AnchoredElement({
map: map,
- position: ol.projection.transformWithCodes(
+ position: ol.projection.transform(
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
element: document.getElementById('vienna')
});
@@ -39,7 +39,7 @@ map.addEventListener('click', function(evt) {
var coordinate = evt.getCoordinate();
popup.getElement().innerHTML =
'Welcome to ol3. The location you clicked was
' +
- ol.Coordinate.toStringHDMS(ol.projection.transformWithCodes(
+ ol.Coordinate.toStringHDMS(ol.projection.transform(
coordinate, 'EPSG:3857', 'EPSG:4326'));
popup.setPosition(coordinate);
});
diff --git a/examples/animation.js b/examples/animation.js
index 63a9da3e27..3257139fe0 100644
--- a/examples/animation.js
+++ b/examples/animation.js
@@ -9,15 +9,15 @@ goog.require('ol.projection');
goog.require('ol.source.OpenStreetMap');
-var london = ol.projection.transformWithCodes(
+var london = ol.projection.transform(
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
-var moscow = ol.projection.transformWithCodes(
+var moscow = ol.projection.transform(
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
-var instanbul = ol.projection.transformWithCodes(
+var instanbul = ol.projection.transform(
new ol.Coordinate(28.9744, 41.0128), 'EPSG:4326', 'EPSG:3857');
-var rome = ol.projection.transformWithCodes(
+var rome = ol.projection.transform(
new ol.Coordinate(12.5, 41.9), 'EPSG:4326', 'EPSG:3857');
-var bern = ol.projection.transformWithCodes(
+var bern = ol.projection.transform(
new ol.Coordinate(7.4458, 46.95), 'EPSG:4326', 'EPSG:3857');
var map = new ol.Map({
diff --git a/examples/bing-maps.js b/examples/bing-maps.js
index d6372fe966..9592719ecc 100644
--- a/examples/bing-maps.js
+++ b/examples/bing-maps.js
@@ -19,7 +19,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
- center: ol.projection.transformWithCodes(
+ center: ol.projection.transform(
new ol.Coordinate(-123.1, 49.25), 'EPSG:4326', 'EPSG:3857'),
zoom: 8
})
diff --git a/examples/canvas-tiles.js b/examples/canvas-tiles.js
index b368c18b6a..3897f2d547 100644
--- a/examples/canvas-tiles.js
+++ b/examples/canvas-tiles.js
@@ -15,7 +15,7 @@ var layers = [
}),
new ol.layer.TileLayer({
source: new ol.source.DebugTileSource({
- projection: ol.projection.getFromCode('EPSG:3857'),
+ projection: 'EPSG:3857',
tileGrid: new ol.tilegrid.XYZ({
maxZoom: 22
})
@@ -25,7 +25,7 @@ var layers = [
var webglMap = new ol.Map({
view: new ol.View2D({
- center: ol.projection.transformWithCodes(
+ center: ol.projection.transform(
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
zoom: 10
}),
diff --git a/examples/epsg-4326.js b/examples/epsg-4326.js
index ddb389f4c2..05f4c570f3 100644
--- a/examples/epsg-4326.js
+++ b/examples/epsg-4326.js
@@ -35,7 +35,7 @@ var map = new ol.Map({
renderers: [ol.RendererHint.CANVAS, ol.RendererHint.DOM],
target: 'map',
view: new ol.View2D({
- projection: ol.projection.getFromCode('EPSG:4326'),
+ projection: 'EPSG:4326',
center: new ol.Coordinate(0, 0),
zoom: 2
})
diff --git a/examples/mapquest.js b/examples/mapquest.js
index 5bdc4aa37e..35752e0b03 100644
--- a/examples/mapquest.js
+++ b/examples/mapquest.js
@@ -16,7 +16,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
- center: ol.projection.transformWithCodes(
+ center: ol.projection.transform(
new ol.Coordinate(139.6917, 35.689506), 'EPSG:4326', 'EPSG:3857'),
zoom: 9
})
diff --git a/examples/mouse-position.js b/examples/mouse-position.js
index de89c3a573..9318d78f81 100644
--- a/examples/mouse-position.js
+++ b/examples/mouse-position.js
@@ -13,7 +13,7 @@ var map = new ol.Map({
controls: ol.control.defaults({}, [
new ol.control.MousePosition({
coordinateFormat: ol.Coordinate.toStringHDMS,
- projection: ol.projection.getFromCode('EPSG:4326'),
+ projection: 'EPSG:4326',
target: document.getElementById('mouse-position'),
undefinedHTML: ' '
})
diff --git a/examples/side-by-side.js b/examples/side-by-side.js
index 56e67c1f42..f8c8e65bf0 100644
--- a/examples/side-by-side.js
+++ b/examples/side-by-side.js
@@ -11,9 +11,9 @@ goog.require('ol.projection');
goog.require('ol.source.MapQuestOpenAerial');
-var LONDON = ol.projection.transformWithCodes(
+var LONDON = ol.projection.transform(
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
-var MOSCOW = ol.projection.transformWithCodes(
+var MOSCOW = ol.projection.transform(
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
var layer = new ol.layer.TileLayer({
diff --git a/examples/stamen.js b/examples/stamen.js
index 0cfbaa966a..993cb6381f 100644
--- a/examples/stamen.js
+++ b/examples/stamen.js
@@ -23,7 +23,7 @@ var map = new ol.Map({
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
- center: ol.projection.transformWithCodes(
+ center: ol.projection.transform(
new ol.Coordinate(-122.416667, 37.783333), 'EPSG:4326', 'EPSG:3857'),
zoom: 12
})
diff --git a/src/objectliterals.exports b/src/objectliterals.exports
index f94f2d9076..dd1ae0d5f8 100644
--- a/src/objectliterals.exports
+++ b/src/objectliterals.exports
@@ -11,7 +11,7 @@
@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined
@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined
@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined
-@exportObjectLiteralProperty ol.View2DOptions.projection ol.Projection|string|undefined
+@exportObjectLiteralProperty ol.View2DOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined
@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.|undefined
@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined
@@ -61,7 +61,7 @@
@exportObjectLiteral ol.control.MousePositionOptions
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
-@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.Projection|undefined
+@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined
@@ -103,7 +103,7 @@
@exportObjectLiteral ol.source.DebugTileSourceOptions
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined
-@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.Projection|undefined
+@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined
@exportObjectLiteral ol.source.SingleImageWMSOptions
@@ -111,7 +111,7 @@
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object.
-@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.Projection|undefined
+@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.|undefined
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
@@ -128,7 +128,7 @@
@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined
-@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.Projection|undefined
+@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
@exportObjectLiteral ol.source.TiledWMSOptions
@@ -138,7 +138,7 @@
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
-@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.Projection|undefined
+@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.|undefined
diff --git a/src/ol/control/mousepositioncontrol.js b/src/ol/control/mousepositioncontrol.js
index fc736fe5a2..206be35210 100644
--- a/src/ol/control/mousepositioncontrol.js
+++ b/src/ol/control/mousepositioncontrol.js
@@ -41,9 +41,9 @@ ol.control.MousePosition = function(opt_options) {
/**
* @private
- * @type {ol.Projection|undefined}
+ * @type {ol.Projection}
*/
- this.projection_ = options.projection;
+ this.projection_ = ol.projection.get(options.projection);
/**
* @private
@@ -168,8 +168,8 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
var html = this.undefinedHTML_;
if (!goog.isNull(pixel)) {
if (this.renderedProjection_ != this.mapProjection_) {
- if (goog.isDef(this.projection_)) {
- this.transform_ = ol.projection.getTransform(
+ if (!goog.isNull(this.projection_)) {
+ this.transform_ = ol.projection.getTransformFromProjections(
this.mapProjection_, this.projection_);
} else {
this.transform_ = ol.projection.identityTransform;
diff --git a/src/ol/control/scalelinecontrol.js b/src/ol/control/scalelinecontrol.js
index 02fb5bcf26..8ba1ae5032 100644
--- a/src/ol/control/scalelinecontrol.js
+++ b/src/ol/control/scalelinecontrol.js
@@ -176,8 +176,8 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
// Convert pointResolution from meters or feet to degrees
if (goog.isNull(this.toEPSG4326_)) {
- this.toEPSG4326_ = ol.projection.getTransform(
- projection, ol.projection.getFromCode('EPSG:4326'));
+ this.toEPSG4326_ = ol.projection.getTransformFromProjections(
+ projection, ol.projection.get('EPSG:4326'));
}
var vertex = [center.x, center.y];
vertex = this.toEPSG4326_(vertex, vertex, 2);
diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js
index 5920f92328..a9cbc0ca69 100644
--- a/src/ol/geolocation.js
+++ b/src/ol/geolocation.js
@@ -76,8 +76,8 @@ ol.Geolocation.prototype.disposeInternal = function() {
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
var projection = this.getProjection();
if (goog.isDefAndNotNull(projection)) {
- this.transformFn_ = ol.projection.getTransform(
- ol.projection.getFromCode('EPSG:4326'), projection);
+ this.transformFn_ = ol.projection.getTransformFromProjections(
+ ol.projection.get('EPSG:4326'), projection);
if (!goog.isNull(this.position_)) {
var vertex = [this.position_.x, this.position_.y];
vertex = this.transformFn_(vertex, vertex, 2);
diff --git a/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js b/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js
index 19ad6d481e..4c88cdd59f 100644
--- a/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js
+++ b/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js
@@ -79,7 +79,7 @@ ol.parser.ogc.WMTSCapabilities_v1_0_0 = function() {
var topLeftCorner = this.getChildValue(node);
var coords = topLeftCorner.split(' ');
var axisOrientation =
- ol.projection.getFromCode(obj['supportedCRS']).getAxisOrientation();
+ ol.projection.get(obj['supportedCRS']).getAxisOrientation();
obj['topLeftCorner'] = ol.Coordinate.fromProjectedArray(
[parseFloat(coords[0]), parseFloat(coords[1])], axisOrientation);
},
diff --git a/src/ol/projection.exports b/src/ol/projection.exports
index f94240cefc..7d2e1680bd 100644
--- a/src/ol/projection.exports
+++ b/src/ol/projection.exports
@@ -13,9 +13,9 @@
@exportProperty ol.ProjectionUnits.METERS
@exportSymbol ol.projection.addProjection
-@exportSymbol ol.projection.getFromCode
+@exportSymbol ol.projection.get
@exportSymbol ol.projection.getTransform
-@exportSymbol ol.projection.getTransformFromCodes
+@exportSymbol ol.projection.getTransformFromProjections
@exportSymbol ol.projection.transform
-@exportSymbol ol.projection.transformWithCodes
+@exportSymbol ol.projection.transformWithProjections
@exportSymbol ol.projection.configureProj4jsProjection
diff --git a/src/ol/projection.js b/src/ol/projection.js
index ec0eabf712..2a33d8cd4c 100644
--- a/src/ol/projection.js
+++ b/src/ol/projection.js
@@ -1,4 +1,5 @@
goog.provide('ol.Projection');
+goog.provide('ol.ProjectionLike');
goog.provide('ol.ProjectionUnits');
goog.provide('ol.projection');
@@ -23,6 +24,12 @@ ol.ENABLE_PROJ4JS = true;
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
+/**
+ * @typedef {ol.Projection|string|undefined}
+ */
+ol.ProjectionLike;
+
+
/**
* @enum {string}
*/
@@ -211,7 +218,7 @@ ol.Proj4jsProjection_.prototype.getPointResolution =
// measuring its width and height on the normal sphere, and taking the
// average of the width and height.
if (goog.isNull(this.toEPSG4326_)) {
- this.toEPSG4326_ = ol.projection.getTransform(
+ this.toEPSG4326_ = ol.projection.getTransformFromProjections(
this, ol.projection.getProj4jsProjectionFromCode_({
code: 'EPSG:4326',
extent: null
@@ -365,9 +372,9 @@ ol.projection.clearAllProjections = function() {
*/
ol.projection.createProjection = function(projection, defaultCode) {
if (!goog.isDefAndNotNull(projection)) {
- return ol.projection.getFromCode(defaultCode);
+ return ol.projection.get(defaultCode);
} else if (goog.isString(projection)) {
- return ol.projection.getFromCode(projection);
+ return ol.projection.get(projection);
} else {
goog.asserts.assert(projection instanceof ol.Projection);
return projection;
@@ -422,20 +429,29 @@ ol.projection.removeTransform = function(source, destination) {
/**
- * @param {string} code Code which is a combination of authority and identifier
- * such as “EPSG:4326”.
+ * @param {ol.ProjectionLike} projectionLike Either a code string which is a
+ * combination of authority and identifier such as "EPSG:4326", or an
+ * existing projection object, or undefined.
* @return {ol.Projection} Projection.
*/
-ol.projection.getFromCode = function(code) {
- var projection = ol.projection.projections_[code];
- if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
- projection = ol.projection.getProj4jsProjectionFromCode_({
- code: code,
- extent: null
- });
- }
- if (!goog.isDef(projection)) {
- goog.asserts.assert(goog.isDef(projection));
+ol.projection.get = function(projectionLike) {
+ var projection;
+ if (projectionLike instanceof ol.Projection) {
+ projection = projectionLike;
+ } else if (goog.isString(projectionLike)) {
+ var code = projectionLike;
+ projection = ol.projection.projections_[code];
+ if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
+ projection = ol.projection.getProj4jsProjectionFromCode_({
+ code: code,
+ extent: null
+ });
+ }
+ if (!goog.isDef(projection)) {
+ goog.asserts.assert(goog.isDef(projection));
+ projection = null;
+ }
+ } else {
projection = null;
}
return projection;
@@ -483,24 +499,43 @@ ol.projection.equivalent = function(projection1, projection2) {
} else if (projection1.getUnits() != projection2.getUnits()) {
return false;
} else {
- var transformFn = ol.projection.getTransform(projection1, projection2);
+ var transformFn = ol.projection.getTransformFromProjections(
+ projection1, projection2);
return transformFn === ol.projection.cloneTransform;
}
};
+/**
+ * Given the projection-like objects this method searches for a transformation
+ * function to convert a coordinates array from the source projection to the
+ * destination projection.
+ *
+ * @param {ol.ProjectionLike} source Source.
+ * @param {ol.ProjectionLike} destination Destination.
+ * @return {ol.TransformFunction} Transform.
+ */
+ol.projection.getTransform = function(source, destination) {
+ var sourceProjection = ol.projection.get(source);
+ var destinationProjection = ol.projection.get(destination);
+ return ol.projection.getTransformFromProjections(
+ sourceProjection, destinationProjection);
+};
+
+
/**
* Searches a function that can be used to convert coordinates from the source
* projection to the destination projection.
*
- * @param {ol.Projection} source Source.
- * @param {ol.Projection} destination Destination.
+ * @param {ol.Projection} sourceProjection Source projection.
+ * @param {ol.Projection} destinationProjection Destination projection.
* @return {ol.TransformFunction} Transform.
*/
-ol.projection.getTransform = function(source, destination) {
+ol.projection.getTransformFromProjections =
+ function(sourceProjection, destinationProjection) {
var transforms = ol.projection.transforms_;
- var sourceCode = source.getCode();
- var destinationCode = destination.getCode();
+ var sourceCode = sourceProjection.getCode();
+ var destinationCode = destinationProjection.getCode();
var transform;
if (goog.object.containsKey(transforms, sourceCode) &&
goog.object.containsKey(transforms[sourceCode], destinationCode)) {
@@ -508,23 +543,23 @@ ol.projection.getTransform = function(source, destination) {
}
if (ol.HAVE_PROJ4JS && !goog.isDef(transform)) {
var proj4jsSource;
- if (source instanceof ol.Proj4jsProjection_) {
- proj4jsSource = source;
+ if (sourceProjection instanceof ol.Proj4jsProjection_) {
+ proj4jsSource = sourceProjection;
} else {
proj4jsSource =
ol.projection.getProj4jsProjectionFromCode_({
- code: source.getCode(),
+ code: sourceCode,
extent: null
});
}
var sourceProj4jsProj = proj4jsSource.getProj4jsProj();
var proj4jsDestination;
- if (destination instanceof ol.Proj4jsProjection_) {
- proj4jsDestination = destination;
+ if (destinationProjection instanceof ol.Proj4jsProjection_) {
+ proj4jsDestination = destinationProjection;
} else {
proj4jsDestination =
ol.projection.getProj4jsProjectionFromCode_({
- code: destination.getCode(),
+ code: destinationCode,
extent: null
});
}
@@ -559,7 +594,8 @@ ol.projection.getTransform = function(source, destination) {
}
return output;
};
- ol.projection.addTransform(source, destination, transform);
+ ol.projection.addTransform(
+ sourceProjection, destinationProjection, transform);
}
if (!goog.isDef(transform)) {
goog.asserts.assert(goog.isDef(transform));
@@ -569,22 +605,6 @@ ol.projection.getTransform = function(source, destination) {
};
-/**
- * Given the projection codes this method searches for a transformation function
- * to convert a coordinates array from the source projection to the destination
- * projection.
- *
- * @param {string} sourceCode Source code.
- * @param {string} destinationCode Destination code.
- * @return {ol.TransformFunction} Transform.
- */
-ol.projection.getTransformFromCodes = function(sourceCode, destinationCode) {
- var source = ol.projection.getFromCode(sourceCode);
- var destination = ol.projection.getFromCode(destinationCode);
- return ol.projection.getTransform(source, destination);
-};
-
-
/**
* @param {Array.} input Input coordinate array.
* @param {Array.=} opt_output Output array of coordinate values.
@@ -626,11 +646,9 @@ ol.projection.cloneTransform = function(input, opt_output, opt_dimension) {
/**
- * Transforms the given point to the destination projection.
- *
* @param {ol.Coordinate} point Point.
- * @param {ol.Projection} source Source.
- * @param {ol.Projection} destination Destination.
+ * @param {ol.ProjectionLike} source Source.
+ * @param {ol.ProjectionLike} destination Destination.
* @return {ol.Coordinate} Point.
*/
ol.projection.transform = function(point, source, destination) {
@@ -642,15 +660,17 @@ ol.projection.transform = function(point, source, destination) {
/**
+ * Transforms the given point to the destination projection.
+ *
* @param {ol.Coordinate} point Point.
- * @param {string} sourceCode Source code.
- * @param {string} destinationCode Destination code.
+ * @param {ol.Projection} sourceProjection Source projection.
+ * @param {ol.Projection} destinationProjection Destination projection.
* @return {ol.Coordinate} Point.
*/
-ol.projection.transformWithCodes =
- function(point, sourceCode, destinationCode) {
- var transformFn = ol.projection.getTransformFromCodes(
- sourceCode, destinationCode);
+ol.projection.transformWithProjections =
+ function(point, sourceProjection, destinationProjection) {
+ var transformFn = ol.projection.getTransformFromProjections(
+ sourceProjection, destinationProjection);
var vertex = [point.x, point.y];
vertex = transformFn(vertex, vertex, 2);
return new ol.Coordinate(vertex[0], vertex[1]);
diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js
index 430e548a1b..82d668979a 100644
--- a/src/ol/source/bingmapssource.js
+++ b/src/ol/source/bingmapssource.js
@@ -24,7 +24,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
goog.base(this, {
opaque: true,
- projection: ol.projection.getFromCode('EPSG:3857')
+ projection: ol.projection.get('EPSG:3857')
});
/**
@@ -111,8 +111,8 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
};
})));
- var transform = ol.projection.getTransform(
- ol.projection.getFromCode('EPSG:4326'), this.getProjection());
+ var transform = ol.projection.getTransformFromProjections(
+ ol.projection.get('EPSG:4326'), this.getProjection());
var attributions = goog.array.map(
resource.imageryProviders,
function(imageryProvider) {
diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js
index 70c980afb2..b96973af8b 100644
--- a/src/ol/source/imagesource.js
+++ b/src/ol/source/imagesource.js
@@ -16,7 +16,7 @@ goog.require('ol.source.Source');
* @typedef {{attributions: (Array.|undefined),
* crossOrigin: (null|string|undefined),
* extent: (null|ol.Extent|undefined),
- * projection: (ol.Projection|undefined),
+ * projection: ol.ProjectionLike,
* resolutions: (Array.|undefined),
* imageUrlFunction: (ol.ImageUrlFunctionType|
* undefined)}}
diff --git a/src/ol/source/imagetilesource.js b/src/ol/source/imagetilesource.js
index b9fd30f9ea..646c5ec18a 100644
--- a/src/ol/source/imagetilesource.js
+++ b/src/ol/source/imagetilesource.js
@@ -18,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
* crossOrigin: (null|string|undefined),
* extent: (ol.Extent|undefined),
* opaque: (boolean|undefined),
- * projection: (ol.Projection|undefined),
+ * projection: ol.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined),
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
*/
diff --git a/src/ol/source/source.js b/src/ol/source/source.js
index 2bc657b57c..89954b54db 100644
--- a/src/ol/source/source.js
+++ b/src/ol/source/source.js
@@ -5,13 +5,13 @@ goog.require('goog.events.EventType');
goog.require('goog.functions');
goog.require('ol.Attribution');
goog.require('ol.Extent');
-goog.require('ol.Projection');
+goog.require('ol.projection');
/**
* @typedef {{attributions: (Array.|undefined),
* extent: (ol.Extent|undefined),
- * projection: (ol.Projection|undefined)}}
+ * projection: ol.ProjectionLike}}
*/
ol.source.SourceOptions;
@@ -30,8 +30,7 @@ ol.source.Source = function(sourceOptions) {
* @private
* @type {ol.Projection}
*/
- this.projection_ = goog.isDef(sourceOptions.projection) ?
- sourceOptions.projection : null;
+ this.projection_ = ol.projection.get(sourceOptions.projection);
/**
* @private
@@ -39,7 +38,7 @@ ol.source.Source = function(sourceOptions) {
*/
this.extent_ = goog.isDef(sourceOptions.extent) ?
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
- sourceOptions.projection.getExtent() : null;
+ this.projection_.getExtent() : null;
/**
* @private
diff --git a/src/ol/source/staticimagesource.js b/src/ol/source/staticimagesource.js
index b1d15bcbe0..d788e20fa5 100644
--- a/src/ol/source/staticimagesource.js
+++ b/src/ol/source/staticimagesource.js
@@ -2,6 +2,7 @@ goog.provide('ol.source.StaticImage');
goog.require('ol.Image');
goog.require('ol.ImageUrlFunctionType');
+goog.require('ol.projection');
goog.require('ol.source.ImageSource');
@@ -19,7 +20,7 @@ ol.source.StaticImage = function(options) {
var imageExtent = options.imageExtent;
var imageSize = options.imageSize;
var imageResolution = imageExtent.getHeight() / imageSize.height;
- var projection = goog.isDef(options.projection) ? options.projection : null;
+ var projection = ol.projection.get(options.projection);
goog.base(this, {
attributions: options.attributions,
diff --git a/src/ol/source/tiledwms.exports b/src/ol/source/tiledwms.exports
index 7d26e4f685..abb08096c1 100644
--- a/src/ol/source/tiledwms.exports
+++ b/src/ol/source/tiledwms.exports
@@ -1 +1 @@
-@exportSymbol ol.source.TiledWMS
\ No newline at end of file
+@exportSymbol ol.source.TiledWMS
diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js
index 9e4445d0d7..edf31d16e8 100644
--- a/src/ol/source/tilejsonsource.js
+++ b/src/ol/source/tilejsonsource.js
@@ -52,7 +52,7 @@ goog.exportSymbol('grid', grid);
ol.source.TileJSON = function(tileJsonOptions) {
goog.base(this, {
- projection: ol.projection.getFromCode('EPSG:3857')
+ projection: ol.projection.get('EPSG:3857')
});
/**
@@ -80,15 +80,15 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
var tileJSON = ol.tilejson.grids_.pop();
- var epsg4326Projection = ol.projection.getFromCode('EPSG:4326');
+ var epsg4326Projection = ol.projection.get('EPSG:4326');
var epsg4326Extent, extent;
if (goog.isDef(tileJSON.bounds)) {
var bounds = tileJSON.bounds;
epsg4326Extent = new ol.Extent(
bounds[0], bounds[1], bounds[2], bounds[3]);
- extent = epsg4326Extent.transform(
- ol.projection.getTransform(epsg4326Projection, this.getProjection()));
+ extent = epsg4326Extent.transform(ol.projection.getTransformFromProjections(
+ epsg4326Projection, this.getProjection()));
this.setExtent(extent);
} else {
epsg4326Extent = null;
diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js
index 92bd61caf3..9244a53e7b 100644
--- a/src/ol/source/tilesource.js
+++ b/src/ol/source/tilesource.js
@@ -4,7 +4,6 @@ goog.provide('ol.source.TileSourceOptions');
goog.require('goog.functions');
goog.require('ol.Attribution');
goog.require('ol.Extent');
-goog.require('ol.Projection');
goog.require('ol.Tile');
goog.require('ol.TileCoord');
goog.require('ol.TileRange');
@@ -16,7 +15,7 @@ goog.require('ol.tilegrid.TileGrid');
* @typedef {{attributions: (Array.|undefined),
* extent: (ol.Extent|undefined),
* opaque: (boolean|undefined),
- * projection: (ol.Projection|undefined),
+ * projection: ol.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
*/
ol.source.TileSourceOptions;
diff --git a/src/ol/source/xyzsource.js b/src/ol/source/xyzsource.js
index b8c39f054c..66e17eed56 100644
--- a/src/ol/source/xyzsource.js
+++ b/src/ol/source/xyzsource.js
@@ -37,7 +37,7 @@ ol.source.XYZOptions;
ol.source.XYZ = function(xyzOptions) {
var projection = xyzOptions.projection ||
- ol.projection.getFromCode('EPSG:3857');
+ ol.projection.get('EPSG:3857');
/**
* @type {ol.TileUrlFunctionType}
diff --git a/test/spec/ol/extent.test.js b/test/spec/ol/extent.test.js
index 9737ab9334..a2c735e6d7 100644
--- a/test/spec/ol/extent.test.js
+++ b/test/spec/ol/extent.test.js
@@ -70,8 +70,7 @@ describe('ol.Extent', function() {
describe('transform', function() {
it('does transform', function() {
- var transformFn =
- ol.projection.getTransformFromCodes('EPSG:4326', 'EPSG:3857');
+ var transformFn = ol.projection.getTransform('EPSG:4326', 'EPSG:3857');
var sourceExtent = new ol.Extent(-15, -30, 45, 60);
var destinationExtent = sourceExtent.transform(transformFn);
expect(destinationExtent).not.toBeUndefined();
diff --git a/test/spec/ol/layer/layer.test.js b/test/spec/ol/layer/layer.test.js
index 2b5c567162..8f89456684 100644
--- a/test/spec/ol/layer/layer.test.js
+++ b/test/spec/ol/layer/layer.test.js
@@ -9,7 +9,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -53,7 +53,7 @@ describe('ol.layer.Layer', function() {
it('accepts options', function() {
var layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
}),
brightness: 0.5,
contrast: 10,
@@ -82,7 +82,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -120,7 +120,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -154,7 +154,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -193,7 +193,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -227,7 +227,7 @@ describe('ol.layer.Layer', function() {
beforeEach(function() {
layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
});
@@ -259,7 +259,7 @@ describe('ol.layer.Layer', function() {
it('sets visible property', function() {
var layer = new ol.layer.Layer({
source: new ol.source.Source({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
})
});
diff --git a/test/spec/ol/projection.epsg3857.test.js b/test/spec/ol/projection.epsg3857.test.js
index 7963cdcf71..5e2d07acac 100644
--- a/test/spec/ol/projection.epsg3857.test.js
+++ b/test/spec/ol/projection.epsg3857.test.js
@@ -7,7 +7,7 @@ describe('ol.projection.EPSG3857', function() {
it('returns the correct point scale at the equator', function() {
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
- var epsg3857 = ol.projection.getFromCode('EPSG:3857');
+ var epsg3857 = ol.projection.get('EPSG:3857');
var resolution = 19.11;
var point = new ol.Coordinate(0, 0);
expect(epsg3857.getPointResolution(resolution, point)).
@@ -17,8 +17,8 @@ describe('ol.projection.EPSG3857', function() {
it('returns the correct point scale at the latitude of Toronto',
function() {
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
- var epsg3857 = ol.projection.getFromCode('EPSG:3857');
- var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ var epsg3857 = ol.projection.get('EPSG:3857');
+ var epsg4326 = ol.projection.get('EPSG:4326');
var resolution = 19.11;
var point = ol.projection.transform(
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
@@ -28,8 +28,8 @@ describe('ol.projection.EPSG3857', function() {
it('returns the correct point scale at various latitudes', function() {
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
- var epsg3857 = ol.projection.getFromCode('EPSG:3857');
- var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ var epsg3857 = ol.projection.get('EPSG:3857');
+ var epsg4326 = ol.projection.get('EPSG:4326');
var resolution = 19.11;
var latitude;
for (latitude = 0; latitude < 90; ++latitude) {
diff --git a/test/spec/ol/projection.test.js b/test/spec/ol/projection.test.js
index 2e089c4529..f2af0d26dc 100644
--- a/test/spec/ol/projection.test.js
+++ b/test/spec/ol/projection.test.js
@@ -26,7 +26,7 @@ describe('ol.projection', function() {
describe('projection equivalence', function() {
function _testAllEquivalent(codes) {
- var projections = goog.array.map(codes, ol.projection.getFromCode);
+ var projections = goog.array.map(codes, ol.projection.get);
goog.array.forEach(projections, function(source) {
goog.array.forEach(projections, function(destination) {
expect(ol.projection.equivalent(source, destination)).toBeTruthy();
@@ -56,7 +56,7 @@ describe('ol.projection', function() {
describe('identify transform', function() {
it('returns a new object, with same coord values', function() {
- var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ var epsg4326 = ol.projection.get('EPSG:4326');
var uniqueObject = {};
var sourcePoint = new ol.Coordinate(uniqueObject, uniqueObject);
var destinationPoint = ol.projection.transform(
@@ -70,7 +70,7 @@ describe('ol.projection', function() {
describe('transform 0,0 from 4326 to 3857', function() {
it('returns expected value', function() {
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(0, 0), 'EPSG:4326', 'EPSG:3857');
expect(point).not.toBeUndefined();
expect(point).not.toBeNull();
@@ -81,7 +81,7 @@ describe('ol.projection', function() {
describe('transform 0,0 from 3857 to 4326', function() {
it('returns expected value', function() {
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(0, 0), 'EPSG:3857', 'EPSG:4326');
expect(point).not.toBeUndefined();
expect(point).not.toBeNull();
@@ -94,7 +94,7 @@ describe('ol.projection', function() {
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
it('returns expected value', function() {
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(-5.625, 52.4827802220782),
'EPSG:4326',
'EPSG:900913');
@@ -109,7 +109,7 @@ describe('ol.projection', function() {
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
it('returns expected value', function() {
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
'EPSG:900913',
'EPSG:4326');
@@ -123,7 +123,7 @@ describe('ol.projection', function() {
describe('Proj4js integration', function() {
it('allows Proj4js projections to be used transparently', function() {
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
'GOOGLE',
'WGS84');
@@ -136,7 +136,7 @@ describe('ol.projection', function() {
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
- var point = ol.projection.transformWithCodes(
+ var point = ol.projection.transform(
new ol.Coordinate(7.439583333333333, 46.95240555555556),
'EPSG:4326',
'EPSG:21781');
@@ -151,24 +151,24 @@ describe('ol.projection', function() {
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
var code = 'urn:ogc:def:crs:EPSG:21781';
var srsCode = 'EPSG:21781';
- var proj = ol.projection.getFromCode(code);
+ var proj = ol.projection.get(code);
expect(ol.projection.proj4jsProjections_.hasOwnProperty(code))
.toBeTruthy();
expect(ol.projection.proj4jsProjections_.hasOwnProperty(srsCode))
.toBeTruthy();
- var proj2 = ol.projection.getFromCode(srsCode);
+ var proj2 = ol.projection.get(srsCode);
expect(proj2).toBe(proj);
});
it('numerically estimates point scale at the equator', function() {
- var googleProjection = ol.projection.getFromCode('GOOGLE');
+ var googleProjection = ol.projection.get('GOOGLE');
expect(googleProjection.getPointResolution(1, new ol.Coordinate(0, 0))).
toRoughlyEqual(1, 1e-1);
});
it('numerically estimates point scale at various latitudes', function() {
- var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
- var googleProjection = ol.projection.getFromCode('GOOGLE');
+ var epsg3857Projection = ol.projection.get('EPSG:3857');
+ var googleProjection = ol.projection.get('GOOGLE');
var point, y;
for (y = -20; y <= 20; ++y) {
point = new ol.Coordinate(0, 1000000 * y);
@@ -178,8 +178,8 @@ describe('ol.projection', function() {
});
it('numerically estimates point scale at various points', function() {
- var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
- var googleProjection = ol.projection.getFromCode('GOOGLE');
+ var epsg3857Projection = ol.projection.get('EPSG:3857');
+ var googleProjection = ol.projection.get('GOOGLE');
var point, x, y;
for (x = -20; x <= 20; ++x) {
for (y = -20; y <= 20; ++y) {
@@ -192,13 +192,13 @@ describe('ol.projection', function() {
});
- describe('ol.projection.getTransform()', function() {
+ describe('ol.projection.getTransformFromProjections()', function() {
- var sm = ol.projection.getFromCode('GOOGLE');
- var gg = ol.projection.getFromCode('EPSG:4326');
+ var sm = ol.projection.get('GOOGLE');
+ var gg = ol.projection.get('EPSG:4326');
it('returns a transform function', function() {
- var transform = ol.projection.getTransform(sm, gg);
+ var transform = ol.projection.getTransformFromProjections(sm, gg);
expect(typeof transform).toBe('function');
var output = transform([-12000000, 5000000]);
@@ -208,7 +208,7 @@ describe('ol.projection', function() {
});
it('works for longer arrays', function() {
- var transform = ol.projection.getTransform(sm, gg);
+ var transform = ol.projection.getTransformFromProjections(sm, gg);
expect(typeof transform).toBe('function');
var output = transform([-12000000, 5000000, -12000000, 5000000]);
@@ -221,17 +221,15 @@ describe('ol.projection', function() {
});
- describe('ol.projection.getTransformFromCodes()', function() {
+ describe('ol.projection.getTransform()', function() {
it('returns a function', function() {
- var transform = ol.projection.getTransformFromCodes(
- 'GOOGLE', 'EPSG:4326');
+ var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
expect(typeof transform).toBe('function');
});
it('returns a transform function', function() {
- var transform = ol.projection.getTransformFromCodes(
- 'GOOGLE', 'EPSG:4326');
+ var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
expect(typeof transform).toBe('function');
var output = transform([-626172.13571216376, 6887893.4928337997]);
@@ -242,8 +240,7 @@ describe('ol.projection', function() {
});
it('works for longer arrays of coordinate values', function() {
- var transform = ol.projection.getTransformFromCodes(
- 'GOOGLE', 'EPSG:4326');
+ var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
expect(typeof transform).toBe('function');
var output = transform([
@@ -261,8 +258,7 @@ describe('ol.projection', function() {
});
it('accepts an optional destination array', function() {
- var transform = ol.projection.getTransformFromCodes(
- 'EPSG:3857', 'EPSG:4326');
+ var transform = ol.projection.getTransform('EPSG:3857', 'EPSG:4326');
var input = [-12000000, 5000000];
var output = [];
@@ -276,8 +272,7 @@ describe('ol.projection', function() {
});
it('accepts a dimension', function() {
- var transform = ol.projection.getTransformFromCodes(
- 'GOOGLE', 'EPSG:4326');
+ var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
expect(typeof transform).toBe('function');
var dimension = 3;
@@ -331,7 +326,7 @@ describe('ol.projection', function() {
describe('ol.Projection.prototype.getMetersPerUnit()', function() {
it('returns value in meters', function() {
- var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ var epsg4326 = ol.projection.get('EPSG:4326');
expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
});
diff --git a/test/spec/ol/source/tilesource.test.js b/test/spec/ol/source/tilesource.test.js
index a03229a8fd..94379b5bfc 100644
--- a/test/spec/ol/source/tilesource.test.js
+++ b/test/spec/ol/source/tilesource.test.js
@@ -5,7 +5,7 @@ describe('ol.source.TileSource', function() {
describe('constructor', function() {
it('returns a tile source', function() {
var source = new ol.source.TileSource({
- projection: ol.projection.getFromCode('EPSG:4326')
+ projection: ol.projection.get('EPSG:4326')
});
expect(source).toBeA(ol.source.Source);
expect(source).toBeA(ol.source.TileSource);
@@ -202,7 +202,7 @@ ol.test.source.MockTileSource = function(loaded) {
goog.base(this, {
extent: extent,
- projection: ol.projection.getFromCode('EPSG:4326'),
+ projection: ol.projection.get('EPSG:4326'),
tileGrid: tileGrid
});
diff --git a/test/spec/ol/tilegrid.test.js b/test/spec/ol/tilegrid.test.js
index 5c254dd47f..93bebdc909 100644
--- a/test/spec/ol/tilegrid.test.js
+++ b/test/spec/ol/tilegrid.test.js
@@ -164,7 +164,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('createForProjection', function() {
it('allows easier creation of a tile grid', function() {
- var projection = ol.projection.getFromCode('EPSG:3857');
+ var projection = ol.projection.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(projection);
expect(grid).toBeA(ol.tilegrid.TileGrid);
@@ -173,7 +173,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('accepts a number of zoom levels', function() {
- var projection = ol.projection.getFromCode('EPSG:3857');
+ var projection = ol.projection.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(projection, 18);
expect(grid).toBeA(ol.tilegrid.TileGrid);
@@ -182,7 +182,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('accepts a big number of zoom levels', function() {
- var projection = ol.projection.getFromCode('EPSG:3857');
+ var projection = ol.projection.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(projection, 23);
expect(grid).toBeA(ol.tilegrid.TileGrid);
@@ -195,7 +195,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getForProjection', function() {
it('gets the default tile grid for a projection', function() {
- var projection = ol.projection.getFromCode('EPSG:3857');
+ var projection = ol.projection.get('EPSG:3857');
var grid = ol.tilegrid.getForProjection(projection);
expect(grid).toBeA(ol.tilegrid.TileGrid);
@@ -205,7 +205,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('stores the default tile grid on a projection', function() {
- var projection = ol.projection.getFromCode('EPSG:3857');
+ var projection = ol.projection.get('EPSG:3857');
var grid = ol.tilegrid.getForProjection(projection);
var gridAgain = ol.tilegrid.getForProjection(projection);
diff --git a/test/spec/ol/tileurlfunction.test.js b/test/spec/ol/tileurlfunction.test.js
index a19f0659fc..966a552184 100644
--- a/test/spec/ol/tileurlfunction.test.js
+++ b/test/spec/ol/tileurlfunction.test.js
@@ -69,7 +69,7 @@ describe('ol.TileUrlFunction', function() {
});
});
it('creates expected URL', function() {
- var epsg3857 = ol.projection.getFromCode('EPSG:3857');
+ var epsg3857 = ol.projection.get('EPSG:3857');
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
'http://wms?foo=bar', {});
var tileCoord = new ol.TileCoord(1, 0, 0);
@@ -81,7 +81,7 @@ describe('ol.TileUrlFunction', function() {
expect(tileUrl).toEqual(expected);
});
it('creates expected URL respecting axis orientation', function() {
- var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ var epsg4326 = ol.projection.get('EPSG:4326');
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
'http://wms?foo=bar', {});
var tileCoord = new ol.TileCoord(1, 0, 0);