Skip to content

Commit

Permalink
Support numeric grid names in vector tiles preview
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Aug 3, 2024
1 parent e3e9b7f commit b29ff64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions geowebcache/core/src/main/java/org/geowebcache/demo/Demo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.geotools.util.logging.Logging;
import org.geowebcache.GeoWebCacheException;
import org.geowebcache.filter.parameters.FloatParameterFilter;
Expand Down Expand Up @@ -342,6 +343,12 @@ private static String generateHTML(TileLayer layer, String gridSetStr, String fo
Arrays.stream(gridSubset.getGridNames())
.map(s -> String.format("\"%s\"", s))
.collect(Collectors.joining(", ", "[", "]")));
makeHiddenInput(
buf,
"gridNamesNumeric",
String.valueOf(
Arrays.stream(gridSubset.getGridNames())
.allMatch(n -> StringUtils.isNumeric(n))));
makeHiddenInput(buf, "format", formatStr);
makeHiddenInput(buf, "layerName", layerName);
makeHiddenInput(buf, "SRS", gridSubset.getSRS().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ window.onload = function() {
}

var gridsetName = getValue('gridsetName');
var gridNamesNumeric = getValue('gridNamesNumeric') === 'true' ? true : false ;
var gridNames = JSON.parse(getValue('gridNames'));
var baseUrl = '../service/wmts';
var style = '';
Expand All @@ -75,7 +76,7 @@ window.onload = function() {
'VERSION': '1.0.0',
'LAYER': layerName,
'STYLE': style,
'TILEMATRIX': gridsetName + ':{z}',
'TILEMATRIX': gridNamesNumeric ? '{z}' : gridsetName + ':{z}',
'TILEMATRIXSET': gridsetName,
'FORMAT': format,
'TILECOL': '{x}',
Expand Down

0 comments on commit b29ff64

Please sign in to comment.