Cope with axis orientation in single image WMS sources
This commit is contained in:
@@ -14,16 +14,16 @@ ol.ImageUrlFunctionType;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} baseUrl Base URL (may have query data).
|
* @param {string} baseUrl Base URL (may have query data).
|
||||||
|
* @param {string} axisOrientation Axis orientation.
|
||||||
* @return {ol.ImageUrlFunctionType} Image URL function.
|
* @return {ol.ImageUrlFunctionType} Image URL function.
|
||||||
*/
|
*/
|
||||||
ol.ImageUrlFunction.createBboxParam = function(baseUrl) {
|
ol.ImageUrlFunction.createBboxParam = function(baseUrl, axisOrientation) {
|
||||||
return function(extent, size) {
|
return function(extent, size) {
|
||||||
// FIXME Projection dependant axis order.
|
var bboxValues = axisOrientation.substr(0, 2) == 'ne' ?
|
||||||
var bboxValue = [
|
[extent.minY, extent.minX, extent.maxY, extent.maxX] :
|
||||||
extent.minX, extent.minY, extent.maxX, extent.maxY
|
[extent.minX, extent.minY, extent.maxX, extent.maxY];
|
||||||
].join(',');
|
|
||||||
return goog.uri.utils.appendParams(baseUrl,
|
return goog.uri.utils.appendParams(baseUrl,
|
||||||
'BBOX', bboxValue,
|
'BBOX', bboxValues.join(','),
|
||||||
'HEIGHT', size.height,
|
'HEIGHT', size.height,
|
||||||
'WIDTH', size.width);
|
'WIDTH', size.width);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,11 +38,13 @@ ol.source.SingleImageWMS = function(options) {
|
|||||||
baseParams[version >= '1.3' ? 'CRS' : 'SRS'] = projection.getCode();
|
baseParams[version >= '1.3' ? 'CRS' : 'SRS'] = projection.getCode();
|
||||||
goog.object.extend(baseParams, options.params);
|
goog.object.extend(baseParams, options.params);
|
||||||
|
|
||||||
|
var axisOrientation = projection.getAxisOrientation();
|
||||||
var imageUrlFunction;
|
var imageUrlFunction;
|
||||||
if (options.url) {
|
if (options.url) {
|
||||||
var url = goog.uri.utils.appendParamsFromMap(
|
var url = goog.uri.utils.appendParamsFromMap(
|
||||||
options.url, baseParams);
|
options.url, baseParams);
|
||||||
imageUrlFunction = ol.ImageUrlFunction.createBboxParam(url);
|
imageUrlFunction =
|
||||||
|
ol.ImageUrlFunction.createBboxParam(url, axisOrientation);
|
||||||
} else {
|
} else {
|
||||||
imageUrlFunction =
|
imageUrlFunction =
|
||||||
ol.ImageUrlFunction.nullImageUrlFunction;
|
ol.ImageUrlFunction.nullImageUrlFunction;
|
||||||
|
|||||||
Reference in New Issue
Block a user