Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LevelID as ArcGIS cache gridset's name #961

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
}
Expand Down Expand Up @@ -126,13 +129,25 @@ public GridSet buildGridset(

private double[][] getResolutions(List<LODInfo> 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<LODInfo> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}