diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java index 7f3a319db..75b489b6d 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java @@ -55,7 +55,7 @@ public GridSet buildGridset( */ final double[] scaleDenominators = null; final Double metersPerUnit; - final String[] scaleNames = null; + final String[] scaleNames; final int tileWidth = tileCacheInfo.getTileCols(); final int tileHeight = tileCacheInfo.getTileRows(); final boolean yCoordinateFirst = false; @@ -71,6 +71,9 @@ public GridSet buildGridset( resolutions = resAndScales[0]; double[] scales = resAndScales[1]; + + scaleNames = getScaleNames(lodInfos); + // TODO: check whether pixelSize computed above should be used instead metersPerUnit = (GridSetFactory.DEFAULT_PIXEL_SIZE_METER * scales[0]) / resolutions[0]; } @@ -126,13 +129,25 @@ public GridSet buildGridset( private double[][] getResolutions(List lodInfos) { final int numLevelsOfDetail = lodInfos.size(); - double[][] resolutionsAndScales = new double[2][numLevelsOfDetail]; + double[][] resolutionsAndScales = new double[3][numLevelsOfDetail]; LODInfo lodInfo; for (int i = 0; i < numLevelsOfDetail; i++) { lodInfo = lodInfos.get(i); resolutionsAndScales[0][i] = lodInfo.getResolution(); resolutionsAndScales[1][i] = lodInfo.getScale(); + resolutionsAndScales[2][i] = lodInfo.getLevelID(); } return resolutionsAndScales; } + + private String[] getScaleNames(List lodInfos) { + final int numLevelsOfDetail = lodInfos.size(); + String[] scaleNames = new String[numLevelsOfDetail]; + LODInfo lodInfo; + for (int i = 0; i < numLevelsOfDetail; i++) { + lodInfo = lodInfos.get(i); + scaleNames[i] = String.valueOf(lodInfo.getLevelID()); + } + return scaleNames; + } } diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/GridSetBuilderTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/GridSetBuilderTest.java index 280cf0208..0b2afdc4b 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/GridSetBuilderTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/GridSetBuilderTest.java @@ -66,6 +66,7 @@ public void testResolutionsAndScaleDenoms() { LODInfo lodInfo = lodInfos.get(i); Assert.assertEquals(lodInfo.getResolution(), resolutions[i], 0d); Assert.assertEquals(lodInfo.getScale(), gridset.getGrid(i).getScaleDenominator(), 1e-6); + Assert.assertEquals(String.valueOf(lodInfo.getLevelID()), gridset.getGrid(i).getName()); } } }