From 7b32b8e561131c3462907d68b422708c44586569 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Sat, 12 Jul 2014 08:47:30 +0000 Subject: [PATCH] Enable ProjectionLike on getGetFeatureInfoUrl --- examples/getfeatureinfo.js | 4 +--- src/ol/source/tilewmssource.js | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/getfeatureinfo.js b/examples/getfeatureinfo.js index 2ba8965781..dea34bf950 100644 --- a/examples/getfeatureinfo.js +++ b/examples/getfeatureinfo.js @@ -18,8 +18,6 @@ var view = new ol.View({ zoom: 1 }); -var viewProjection = view.getProjection(); - var map = new ol.Map({ layers: [wmsLayer], target: 'map', @@ -30,7 +28,7 @@ map.on('singleclick', function(evt) { document.getElementById('info').innerHTML = ''; var viewResolution = /** @type {number} */ (view.getResolution()); var url = wmsSource.getGetFeatureInfoUrl( - evt.coordinate, viewResolution, viewProjection, + evt.coordinate, viewResolution, 'EPSG:3857', {'INFO_FORMAT': 'text/html'}); if (url) { document.getElementById('info').innerHTML = diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index d0d4c5c5f6..d7765bd45e 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -14,6 +14,7 @@ goog.require('ol'); goog.require('ol.TileCoord'); goog.require('ol.TileUrlFunction'); goog.require('ol.extent'); +goog.require('ol.proj'); goog.require('ol.source.TileImage'); goog.require('ol.source.wms'); goog.require('ol.source.wms.ServerType'); @@ -121,7 +122,7 @@ goog.inherits(ol.source.TileWMS, ol.source.TileImage); * constructed. * @param {ol.Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. - * @param {ol.proj.Projection} projection Projection. + * @param {ol.proj.ProjectionLike} projection Projection. * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should * be provided. If `QUERY_LAYERS` is not provided then the layers specified * in the `LAYERS` parameter will be used. `VERSION` should not be @@ -139,9 +140,11 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = return undefined; } + var projectionObj = ol.proj.get(projection); + var tileGrid = this.getTileGrid(); if (goog.isNull(tileGrid)) { - tileGrid = this.getTileGridForProjection(projection); + tileGrid = this.getTileGridForProjection(projectionObj); } var tileCoord = tileGrid.getTileCoordForCoordAndResolution( @@ -185,7 +188,7 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = goog.object.set(baseParams, this.v13_ ? 'J' : 'Y', y); return this.getRequestUrl_(tileCoord, tileSize, tileExtent, - pixelRatio, projection, baseParams); + pixelRatio, projectionObj, baseParams); };