public class WebMapServer extends AbstractOpenWebService<WMSCapabilities,Layer>
If restriction of versions to be used is desired, this class should be subclassed and it's setupSpecifications() method over-ridden. It should add which version/specifications are to be used to the specs array. See the current implementation for an example.
Example usage:
WebMapServer wms = new WebMapServer("http://some.example.com/wms");
WMSCapabilities capabilities = wms.getCapabilities();
GetMapRequest request = wms.getMapRequest();
... //configure request
GetMapResponse response = (GetMapResponse) wms.issueRequest(request);
... //extract image from the response
Modifier and Type | Class and Description |
---|---|
class |
WebMapServer.LayerInfo
Quickly describe a layer.
|
protected class |
WebMapServer.WMSInfo
Class quickly describing Web Map Service.
|
capabilities, hints, info, LOGGER, resourceInfo, serverURL, specification, specs
Constructor and Description |
---|
WebMapServer(URL serverURL)
Creates a new WebMapServer instance and attempts to retrieve the Capabilities document
specified by serverURL.
|
WebMapServer(URL serverURL,
HTTPClient httpClient)
Creates a new WebMapServer instance and attempts to retrieve the Capabilities document
specified by serverURL.
|
WebMapServer(URL serverURL,
HTTPClient httpClient,
Map<String,Object> hints)
Creates a new WebMapServer instance and attempts to retrieve the Capabilities document
specified by serverURL.
|
WebMapServer(URL serverURL,
int timeout)
Creates a new WebMapServer instance and attempts to retrieve the Capabilities document
specified by serverURL.
|
WebMapServer(WMSCapabilities capabilities)
Creates a new WebMapServer from a WMSCapablitiles document.
|
getHints, getHTTPClient, getInfo, getInfo, internalIssueRequest, negotiateVersion, setHints, setHttpClient, setLoggingLevel
public WebMapServer(WMSCapabilities capabilities) throws IOException, ServiceException
The implementation assumes that the server is located at: capabilities.getRequest().getGetCapabilities().getGet()
capabilities
- IOException
ServiceException
public WebMapServer(URL serverURL) throws IOException, ServiceException
serverURL
- a URL that points to the capabilities document of a serverIOException
- if there is an error communicating with the serverServiceException
- if the server responds with an errorpublic WebMapServer(URL serverURL, HTTPClient httpClient) throws IOException, ServiceException
serverURL
- a URL that points to the capabilities document of a serverIOException
- if there is an error communicating with the serverServiceException
- if the server responds with an errorpublic WebMapServer(URL serverURL, HTTPClient httpClient, Map<String,Object> hints) throws IOException, ServiceException
serverURL
- a URL that points to the capabilities document of a serverhttpClient
- The client to be used when performing HTTP requestshints
- A map of hints. Can be used to control some aspects of the XML parsing, see
XMLHandlerHints
for a referenceIOException
- if there is an error communicating with the serverServiceException
- if the server responds with an errorpublic WebMapServer(URL serverURL, int timeout) throws IOException, ServiceException
serverURL
- a URL that points to the capabilities document of a servertimeout
- a time to be wait a server responseIOException
- if there is an error communicating with the serverServiceException
- if the server responds with an errorprotected void setupSpecifications()
setupSpecifications
in class AbstractOpenWebService<WMSCapabilities,Layer>
protected ServiceInfo createInfo()
AbstractOpenWebService
createInfo
in class AbstractOpenWebService<WMSCapabilities,Layer>
protected ResourceInfo createInfo(Layer layer)
createInfo
in class AbstractOpenWebService<WMSCapabilities,Layer>
public GetCapabilitiesResponse issueRequest(GetCapabilitiesRequest request) throws IOException, ServiceException
issueRequest
in class AbstractOpenWebService<WMSCapabilities,Layer>
IOException
ServiceException
public GetMapResponse issueRequest(GetMapRequest request) throws IOException, ServiceException
IOException
ServiceException
public GetFeatureInfoResponse issueRequest(GetFeatureInfoRequest request) throws IOException, ServiceException
IOException
ServiceException
public DescribeLayerResponse issueRequest(DescribeLayerRequest request) throws IOException, ServiceException
IOException
ServiceException
public GetLegendGraphicResponse issueRequest(GetLegendGraphicRequest request) throws IOException, ServiceException
IOException
ServiceException
public GetStylesResponse issueRequest(GetStylesRequest request) throws IOException, ServiceException
IOException
ServiceException
public PutStylesResponse issueRequest(PutStylesRequest request) throws IOException, ServiceException
IOException
ServiceException
public WMSCapabilities getCapabilities()
getCapabilities
in class AbstractOpenWebService<WMSCapabilities,Layer>
public GetMapRequest createGetMapRequest()
public GetFeatureInfoRequest createGetFeatureInfoRequest(GetMapRequest getMapRequest)
getMapRequest
- a previous configured GetMapRequestUnsupportedOperationException
- if the server does not support GetFeatureInfopublic DescribeLayerRequest createDescribeLayerRequest() throws UnsupportedOperationException
UnsupportedOperationException
public GetLegendGraphicRequest createGetLegendGraphicRequest() throws UnsupportedOperationException
UnsupportedOperationException
public GetStylesRequest createGetStylesRequest() throws UnsupportedOperationException
UnsupportedOperationException
public PutStylesRequest createPutStylesRequest() throws UnsupportedOperationException
UnsupportedOperationException
public GeneralEnvelope getEnvelope(Layer layer, CoordinateReferenceSystem crs)
If null is returned, no valid bounding box could be found and one couldn't be transformed from another.
layer
- crs
- Copyright © 1996–2019 Geotools. All rights reserved.