use of ol.tilegrid.WmtsTileGrid in project gwt-ol3 by TDesjardins.
the class WmtsExample method createWmtsTileGrid.
/**
* Creates a WMTS tilegrid.
*
* @param projection projection of the grid
* @return WMTS tilegrid
*/
private TileGrid createWmtsTileGrid(Projection projection) {
WmtsTileGridOptions wmtsTileGridOptions = OLFactory.createOptions();
double[] resolutions = new double[14];
String[] matrixIds = new String[14];
double width = projection.getExtent().getWidth();
double matrixWidth = width / 256;
for (int i = 0; i < 14; i++) {
resolutions[i] = matrixWidth / Math.pow(2, i);
matrixIds[i] = String.valueOf(i);
}
Coordinate tileGridOrigin = projection.getExtent().getTopLeft();
wmtsTileGridOptions.setOrigin(tileGridOrigin);
wmtsTileGridOptions.setResolutions(resolutions);
wmtsTileGridOptions.setMatrixIds(matrixIds);
return new WmtsTileGrid(wmtsTileGridOptions);
}
Aggregations