/** * @param tileRequest * @return */ public Set<Tile> issueRequest(GetTileRequest tileRequest) throws ServiceException { return tileRequest.getTiles(); }
protected void initService() { setProperty(SERVICE, "WMTS"); } }
protected void initRequest() { setProperty(REQUEST, "GetTile"); }
tileRequest.setCRS(gridEnvelope.getCoordinateReferenceSystem()); tileRequest.setLayer(layer); tileRequest.setRequestedHeight(height); tileRequest.setRequestedWidth(width); tileRequest.setRequestedBBox(gridEnvelope); // should be tileRequest.setRequestedTime(time);
setProperty(LAYER, layerString); setProperty(STYLE, styleString); + requestedHeight); TileMatrixSet matrixSet = selectMatrixSet(); String format = (String) getProperties().get("Format"); if (format == null || format.isEmpty()) { format = "image/png";
CoordinateReferenceSystem requestCRS = getCrs(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("request CRS " + (requestCRS == null ? "NULL" : requestCRS.getName())); LOGGER.fine("selected matrix set:" + matrixSet.getIdentifier()); setProperty(TILEMATRIXSET, matrixSet.getIdentifier()); retMatrixSet = matrixSet; LOGGER.fine("defaulting matrix set:" + matrix.getIdentifier()); setProperty(TILEMATRIXSET, matrix.getIdentifier()); retMatrixSet = matrix;
/** Execute the GetMap request */ GridCoverage2D getMap(ReferencedEnvelope requestedEnvelope, int width, int height, String time) throws IOException { // build the request ReferencedEnvelope gridEnvelope = initTileRequest(requestedEnvelope, width, height, time); // issue the request and wrap response in a grid coverage try { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Issuing request: " + getTileRequest().getFinalURL(), new RuntimeException("TRACE!")); } BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); getTileRequest().setCRS(gridEnvelope.getCoordinateReferenceSystem()); Set<Tile> responses = wmts.issueRequest(getTileRequest()); double xscale = width / requestedEnvelope.getWidth(); double yscale = height / requestedEnvelope.getHeight(); double scale = Math.min(xscale, yscale); double xoff = requestedEnvelope.getMedian(0) * scale - width / 2; double yoff = requestedEnvelope.getMedian(1) * scale + height / 2; // C ould we use RenderUtilities here? AffineTransform worldToScreen = new AffineTransform(scale, 0, 0, -scale, -xoff, yoff); renderTiles(responses, image.createGraphics(), requestedEnvelope, worldToScreen); return gcf.create(layer.getTitle(), image, gridEnvelope); } catch (ServiceException e) { throw new IOException("GetMap failed", e); } }
/** @return */ public GetTileRequest createGetTileRequest() { URL url; if (WMTSServiceType.KVP.equals(type)) { url = findURL(getCapabilities().getRequest().getGetTile()); } else { url = serverURL; } GetTileRequest request = (GetTileRequest) ((WMTSSpecification) specification) .createGetTileRequest(url, (Properties) null, capabilities); request.getHeaders().putAll(headers); return request; }