@Override protected void setupSpecifications() { specs = new WMTSSpecification[1]; specs[0] = new WMTSSpecification(); }
@Override public GetCapabilitiesRequest createGetCapabilitiesRequest(URL server) { // TODO Auto-generated method stub return new GetCapsRequest(server); }
@Override protected void initService() { setProperty(SERVICE, "WMTS"); }
/** @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; }
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()); }
GetTileRequest tileRequest = wmts.createGetTileRequest(); setTileRequest(tileRequest); tileRequest.setCRS(gridEnvelope.getCoordinateReferenceSystem()); tileRequest.setLayer(layer); tileRequest.setRequestedHeight(height); tileRequest.setRequestedWidth(width); tileRequest.setRequestedBBox(gridEnvelope); // should be tileRequest.setRequestedTime(time);
/** * @param capabilities * @throws IOException * @throws ServiceException */ public WebMapTileServer(WMTSCapabilities capabilities) throws ServiceException, IOException { super(capabilities, capabilities.getRequest().getGetCapabilities().getGet()); setType(capabilities.getType()); }
/** 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); } }
WebMapTileServer server = new WebMapTileServer(new URL(url)); server.getCapabilities(); } catch (IOException | ServiceException e) { IValidationError err =
/** * @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()); }
@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); } } }
@Override public Response createResponse(HTTPResponse response) throws ServiceException, IOException { // TODO Auto-generated method stub return new GetTileResponse(response, getType()); }
@Override protected void initVersion() { setProperty(VERSION, WMTS_VERSION); }
@Override protected String processKey(String key) { return WMTSSpecification.processKey(key); }
public GetTileRequest createGetTileRequest( URL server, Properties props, WMTSCapabilities caps) { return new GetTileRequest(server, props, caps); }
builder.setStore(store); List<WMTSLayer> layers = wmtsInfo.getWebMapTileServer(null).getCapabilities().getLayerList(); for (Layer l : layers) { if (l.getName() == null) {
@Override protected void initVersion() { setProperty(VERSION, WMTS_VERSION); // $NON-NLS-1$ //$NON-NLS-2$ }
builder.setStore(store); WebMapTileServer webMapTileServer = expandedStore.getWebMapTileServer(null); WMTSCapabilities capabilities = webMapTileServer.getCapabilities(); List<WMTSLayer> layers = capabilities.getLayerList(); for (Layer l : layers) { if (l.getName() == null) {
/** * @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()); }