Class WebMapServer


  • public class WebMapServer
    extends AbstractOpenWebService<WMSCapabilities,​Layer>
    WebMapServer is a class representing a WMS. It is used to access the Capabilities document and perform requests. It supports multiple versions and will perform version negotiation automatically and use the highest known version that the server can communicate.

    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
     
    Author:
    Richard Gould, Refractions Research
    • Constructor Detail

      • WebMapServer

        public WebMapServer​(WMSCapabilities capabilities)
                     throws IOException,
                            ServiceException
        Creates a new WebMapServer from a WMSCapablitiles document.

        The implementation assumes that the server is located at: capabilities.getRequest().getGetCapabilities().getGet()

        Throws:
        IOException
        ServiceException
      • WebMapServer

        public WebMapServer​(URL serverURL)
                     throws IOException,
                            ServiceException
        Creates a new WebMapServer instance and attempts to retrieve the Capabilities document specified by serverURL.
        Parameters:
        serverURL - a URL that points to the capabilities document of a server
        Throws:
        IOException - if there is an error communicating with the server
        ServiceException - if the server responds with an error
      • WebMapServer

        public WebMapServer​(URL serverURL,
                            HTTPClient httpClient)
                     throws IOException,
                            ServiceException
        Creates a new WebMapServer instance and attempts to retrieve the Capabilities document specified by serverURL.
        Parameters:
        serverURL - a URL that points to the capabilities document of a server
        Throws:
        IOException - if there is an error communicating with the server
        ServiceException - if the server responds with an error
      • WebMapServer

        public WebMapServer​(URL serverURL,
                            HTTPClient httpClient,
                            Map<String,​Object> hints)
                     throws IOException,
                            ServiceException
        Creates a new WebMapServer instance and attempts to retrieve the Capabilities document specified by serverURL.
        Parameters:
        serverURL - a URL that points to the capabilities document of a server
        httpClient - The client to be used when performing HTTP requests
        hints - A map of hints. Can be used to control some aspects of the XML parsing, see XMLHandlerHints for a reference
        Throws:
        IOException - if there is an error communicating with the server
        ServiceException - if the server responds with an error
      • WebMapServer

        public WebMapServer​(URL serverURL,
                            int timeout)
                     throws IOException,
                            ServiceException
        Creates a new WebMapServer instance and attempts to retrieve the Capabilities document specified by serverURL.
        Parameters:
        serverURL - a URL that points to the capabilities document of a server
        timeout - a time to be wait a server response
        Throws:
        IOException - if there is an error communicating with the server
        ServiceException - if the server responds with an error