private WebMapServer getWMS() { try { return new WebMapServer(new URL(url)); } catch (IOException ioe) { log.error(url + " -> " + ioe.getMessage()); } catch (ServiceException se) { log.error(se.getMessage()); } return null; }
private static WebMapServer getWmsServer(PropertySet configuration) throws IOException, ServiceException { return new WebMapServer((URL) configuration.getValue(WmsLayerType.PROPERTY_NAME_URL)); }
private static WebMapServer getWmsServer(PropertySet configuration) throws IOException, ServiceException { return new WebMapServer((URL) configuration.getValue(WmsLayerType.PROPERTY_NAME_URL)); }
private WebMapServer getServer(Layer layer, Map<String, WebMapServer> cache) throws IOException, ServiceException { String capabilitiesUrl = layer.getCapabilities(); WebMapServer server = cache.get(capabilitiesUrl); if (server == null) { HTTPClient client = httpClientSupplier.get(); server = new WebMapServer(new URL(layer.getCapabilities()), client); cache.put(capabilitiesUrl, server); } return server; }
public void setServer(String server) { this.server = server; System.out.println("setting server to "+server); try { url = new URL(server+request); System.out.println("url "+url.toString()); wms = new WebMapServer(url); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } setupLayersList(); } }
public void setServer(String server) { this.server = server; System.out.println("setting server to "+server); try { url = new URL(server+request); System.out.println("url "+url.toString()); wms = new WebMapServer(url); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } setupLayersList(); } }
private WebMapServer getWms(Window window, String wmsUrl) throws Exception { WebMapServer wms; try { window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); URL url = new URL(wmsUrl); wms = new WebMapServer(url); getContext().setPropertyValue(WmsLayerSource.PROPERTY_NAME_WMS_URL, url); } finally { window.setCursor(Cursor.getDefaultCursor()); } return wms; }
private WebMapServer getWms(Window window, String wmsUrl) throws Exception { WebMapServer wms; try { window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); URL url = new URL(wmsUrl); wms = new WebMapServer(url); getContext().setPropertyValue(WmsLayerSource.PROPERTY_NAME_WMS_URL, url); } finally { window.setCursor(Cursor.getDefaultCursor()); } return wms; }
this.setSize(400,200); url = new URL(server+request); wms = new WebMapServer(url);
this.setSize(400,200); url = new URL(server+request); wms = new WebMapServer(url);
public WMSGridCoverageExchange(Object source) throws SAXException, URISyntaxException, IOException { if (source instanceof String || source instanceof URL) { URL url = null; if (source instanceof String) { url = new URL((String) source); } else { url = (URL) source; } wms = new WebMapServer(url); capabilities = wms.getCapabilities(); } else if (source instanceof WMSCapabilities) { capabilities = (WMSCapabilities) source; } WMSFormatFactory factory = new WMSFormatFactory(capabilities); if (!factory.isAvailable()) { throw new RuntimeException("WMS support is not available"); } formats = new Format[1]; formats[0] = factory.createFormat(); }
@Override public List<RasterCapabilitiesInfo> getRasterCapabilities(Map<String, String> connectionProperties) throws Exception { URL url = new URL(connectionProperties.get(GetWmsCapabilitiesRequest.GET_CAPABILITIES_URL)); SimpleHttpClient httpClient = new SimpleHttpClient(); if (connectionProperties.containsKey(WmsLayerBeanFactory.WMS_USERNAME)) { httpClient.setUser(connectionProperties.get(WmsLayerBeanFactory.WMS_USERNAME)); httpClient.setPassword(connectionProperties.get(WmsLayerBeanFactory.WMS_PASSWORD)); } WebMapServer wms = new WebMapServer(url, httpClient); WMSCapabilities capabilities = wms.getCapabilities(); List<RasterCapabilitiesInfo> layers = new ArrayList<RasterCapabilitiesInfo>(); List<RasterCapabilitiesInfo> nonNativeLayers = new ArrayList<RasterCapabilitiesInfo>(); for (org.geotools.data.ows.Layer owsLayer : WMSUtils.getNamedLayers(capabilities)) { if (owsLayer.getSrs().contains(defaultGeodesk.getMaps().get(0).getCrs())) { // Only add default crs layers.add(dtoFactoryService.buildRasterCapabilitesInfoFromWms(wms, owsLayer, defaultGeodesk.getMaps().get(0).getCrs())); } else { // Add all available crs-es for (String srs : owsLayer.getSrs()) { try { nonNativeLayers.add(dtoFactoryService.buildRasterCapabilitesInfoFromWms(wms, owsLayer, srs)); } catch (LayerException e) { log.warn("Got unknown crs from wms server, ignoring: {}", srs); } } } } layers.addAll(nonNativeLayers); return layers; }
@Override public List<RasterCapabilitiesInfo> getRasterCapabilities(Map<String, String> connectionProperties) throws Exception { URL url = new URL(connectionProperties.get(GetWmsCapabilitiesRequest.GET_CAPABILITIES_URL)); SimpleHttpClient httpClient = new SimpleHttpClient(); if (connectionProperties.containsKey(WmsLayerBeanFactory.WMS_USERNAME)) { httpClient.setUser(connectionProperties.get(WmsLayerBeanFactory.WMS_USERNAME)); httpClient.setPassword(connectionProperties.get(WmsLayerBeanFactory.WMS_PASSWORD)); } WebMapServer wms = new WebMapServer(url, httpClient); WMSCapabilities capabilities = wms.getCapabilities(); List<RasterCapabilitiesInfo> layers = new ArrayList<RasterCapabilitiesInfo>(); List<RasterCapabilitiesInfo> nonNativeLayers = new ArrayList<RasterCapabilitiesInfo>(); for (org.geotools.data.ows.Layer owsLayer : WMSUtils.getNamedLayers(capabilities)) { if (owsLayer.getSrs().contains(defaultGeodesk.getMaps().get(0).getCrs())) { // Only add default crs layers.add(dtoFactoryService.buildRasterCapabilitesInfoFromWms(wms, owsLayer, defaultGeodesk.getMaps().get(0).getCrs())); } else { // Add all available crs-es for (String srs : owsLayer.getSrs()) { try { nonNativeLayers.add(dtoFactoryService.buildRasterCapabilitesInfoFromWms(wms, owsLayer, srs)); } catch (LayerException e) { LOG.warn("Got unknown crs from wms server, ignoring: {}", srs); } } } } layers.addAll(nonNativeLayers); return layers; }
@Override protected void onValidate(IValidatable validatable) { String url = (String) validatable.getValue(); try { HTTPClient client = new SimpleHttpClient(); usernamePanel.getFormComponent().processInput(); String user = usernamePanel.getFormComponent().getInput(); password.getFormComponent().processInput(); String pwd = password.getFormComponent().getInput(); if (user != null && user.length() > 0 && pwd != null && pwd.length() > 0) { client.setUser(user); client.setPassword(pwd); } WebMapServer server = new WebMapServer(new URL(url), client); server.getCapabilities(); } catch(Exception e) { error(validatable, "WMSCapabilitiesValidator.connectionFailure", Collections.singletonMap("error", e.getMessage())); } }
WebMapServer server = new WebMapServer(new URL(url), client, hints); server.getCapabilities(); } catch (IOException | ServiceException e) {
wms = new WebMapServer(new URL(s), TIMEOUT); } catch (Exception e1) { continue;