List<String> getAvailableLayersInternal( String workspaceName, String storeName, boolean quietOnNotFound) { NamespaceInfo ns = getNamespaceInternal(workspaceName); Collection<WMTSStoreInfo> stores = getStoresInternal(ns, storeName, quietOnNotFound); return stores.stream() .flatMap( store -> { WebMapTileServer ds; try { ds = store.getWebMapTileServer(null); } catch (IOException e) { throw new RestException( "Could not load wmts store: " + storeName, HttpStatus.INTERNAL_SERVER_ERROR, e); } final List<WMTSLayer> layerList = ds.getCapabilities().getLayerList(); return layerList .stream() .map(Layer::getName) .filter(Objects::nonNull) .filter(name -> !name.isEmpty()) .filter(name -> !layerConfigured(store, name)); }) .collect(Collectors.toList()); }
/** @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; }
/** * @param serverURL * @param httpClient * @param capabilities * @throws ServiceException * @throws IOException */ public WebMapTileServer(URL serverURL, HTTPClient httpClient, WMTSCapabilities capabilities) throws ServiceException, IOException { super(serverURL, httpClient, capabilities); setType(super.capabilities.getType()); }
WebMapTileServer server = new WebMapTileServer(new URL(url)); server.getCapabilities(); } catch (IOException | ServiceException e) { IValidationError err =
/** 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); } }
GetTileRequest tileRequest = wmts.createGetTileRequest(); setTileRequest(tileRequest); tileRequest.setCRS(gridEnvelope.getCoordinateReferenceSystem());
builder.setStore(store); List<WMTSLayer> layers = wmtsInfo.getWebMapTileServer(null).getCapabilities().getLayerList(); for (Layer l : layers) { if (l.getName() == null) {
/** * @param serverURL * @throws IOException * @throws ServiceException */ public WebMapTileServer(URL serverURL) throws IOException, ServiceException { super(serverURL); setType(capabilities.getType()); }
@Override protected void onSave(WMTSStoreInfo info, AjaxRequestTarget target) throws IllegalArgumentException { if (!info.isEnabled()) { doSaveStore(info); } else { try { // try to see if we can connect getCatalog().getResourcePool().clear(info); // do not call info.getWebMapServer cause it ends up calling // resourcepool.getWebMapServer with the unproxied instance (old values) // info.getWebMapServer(null).getCapabilities(); WebMapTileServer wmts = getCatalog().getResourcePool().getWebMapTileServer(info); wmts.getCapabilities(); doSaveStore(info); } catch (Exception e) { confirmSaveOnConnectionFailure(info, target, e); } } }
/** * @param serverURL * @param httpClient * @param capabilities * @param hints * @throws ServiceException * @throws IOException */ public WebMapTileServer( URL serverURL, HTTPClient httpClient, WMTSCapabilities capabilities, Map<String, Object> hints) throws ServiceException, IOException { super(serverURL, httpClient, capabilities, hints); setType(capabilities.getType()); }
builder.setStore(store); WebMapTileServer webMapTileServer = expandedStore.getWebMapTileServer(null); WMTSCapabilities capabilities = webMapTileServer.getCapabilities(); List<WMTSLayer> layers = capabilities.getLayerList(); for (Layer l : layers) {
/** * @param capabilities * @throws IOException * @throws ServiceException */ public WebMapTileServer(WMTSCapabilities capabilities) throws ServiceException, IOException { super(capabilities, capabilities.getRequest().getGetCapabilities().getGet()); setType(capabilities.getType()); }