Skip to content

Commit 2d87dc0

Browse files
committed
Add parsing support for GridOffset
1 parent 64f1988 commit 2d87dc0

File tree

2 files changed

+9
-3
lines changed
  • lib/OpenLayers/Format/WCSDescribeCoverage
  • tests/Format/WCSDescribeCoverage

2 files changed

+9
-3
lines changed

lib/OpenLayers/Format/WCSDescribeCoverage/v1_1_0.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ OpenLayers.Format.WCSDescribeCoverage.v1_1_0 = OpenLayers.Class(
121121
}
122122
},
123123
"GridOffsets": function(node, gridCRS) {
124-
gridCRS.gridOffsets = this.getChildValue(node);
124+
var xy = this.getChildValue(node).split(' ');
125+
if(xy.length == 2) {
126+
gridCRS.gridOffsets = {};
127+
gridCRS.gridOffsets.x = Number(xy[0]);
128+
gridCRS.gridOffsets.y = Number(xy[1]);
129+
}
125130
},
126131
"GridCS": function(node, gridCRS) {
127132
gridCRS.gridCS = this.getChildValue(node);

tests/Format/WCSDescribeCoverage/v1.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818

1919
function test_read(t) {
20-
t.plan(58); // Number of tests performed: If you add a test below, be sure to increment this accordingly
20+
t.plan(59); // Number of tests performed: If you add a test below, be sure to increment this accordingly
2121

2222
var parser = new OpenLayers.Format.WCSDescribeCoverage();
2323

@@ -107,7 +107,8 @@
107107
var gridCRS = metadata.domain.spatialDomain.gridCRS;
108108
t.eq(gridCRS.gridBaseCRS, "urn:ogc:def:crs:EPSG::28992", "correct gridBaseCRS");
109109
t.eq(gridCRS.gridCS, "urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS", "correct gridCS");
110-
t.eq(gridCRS.gridOffsets, "0.5 -0.5", "correct gridOffsets");
110+
t.eq(gridCRS.gridOffsets.x, 0.5, "correct gridOffsets.x");
111+
t.eq(gridCRS.gridOffsets.y, -0.5, "correct gridOffsets.y");
111112
t.eq(gridCRS.gridOrigin.x, 91979.25, "correct gridOrigin.x");
112113
t.eq(gridCRS.gridOrigin.y, 437659.25, "correct gridOrigin.y");
113114
t.eq(gridCRS.gridType, "urn:ogc:def:method:WCS:1.1:2dSimpleGrid", "correct gridType");

0 commit comments

Comments
 (0)