Package org.geotools.data.wms

Examples of org.geotools.data.wms.WebMapServer$LayerInfo


            info.setType(name);
           
            // connect and defaults
            info.setCapabilitiesURL(params.str("url"));
            try {
                WebMapServer service = info.getWebMapServer(new NullProgressListener());
                info.setDescription( service.getInfo().getDescription() );
                info.setEnabled(true);
            } catch (Throwable e) {
                info.setError(e);
                info.setEnabled(false);
            }
View Full Code Here


        //Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
        if (wms == null) {
            // do setup once!
            if (serverURL != null) {
                try {
                    wms = new WebMapServer(serverURL, new MultithreadedHttpClient());
                    capabilities = wms.getCapabilities();
                } catch (Exception eek) {
                    serverURL = null;
                    throw eek;
                }
View Full Code Here

        checkGetFeatureInfo( wms, water_bodies, CRS.decode("EPSG:4326") );
        checkGetFeatureInfo( wms, water_bodies, CRS.decode("urn:x-ogc:def:crs:EPSG::4326") );
    }

    public void testImageSample111() throws Exception {
        WebMapServer wms111 = new WebMapServer(new URL(serverURL + "&VERSION=1.1.1"));
        WMSCapabilities caps = wms111.getCapabilities();
        assertEquals("1.1.1", caps.getVersion());
   
        Layer water_bodies = find("topp:tasmania_water_bodies", caps);
        assertNotNull("Img_Sample layer found", water_bodies);
        CRSEnvelope latLon = water_bodies.getLatLonBoundingBox();
View Full Code Here

        }
    }
   
    public void testCreateGetMapRequest() throws Exception {
        try{
            WebMapServer wms = new WebMapServer(server);
            WMSCapabilities caps = wms.getCapabilities();
            GetMapRequest request = wms.createGetMapRequest();
            request.setFormat("image/jpeg");
            //System.out.println(request.getFinalURL().toExternalForm());
           
            String externalForm = request.getFinalURL().toExternalForm();
            assertTrue(externalForm.indexOf("image%2Fjpeg") >= 0);
View Full Code Here

        }catch(Exception e) {
          e.printStackTrace();
        }
    }
    public void testCreateGetMapRequest() throws Exception {
        WebMapServer wms = new WebMapServer(server2);
        GetMapRequest request = wms.createGetMapRequest();
        request.setFormat("image/jpeg");
        System.out.println(request.getFinalURL().toExternalForm());
       
        assertTrue(request.getFinalURL().toExternalForm().indexOf("image%2Fjpeg") >= 0);
    }
View Full Code Here

    }
   
    public void testCreateGetFeatureInfoRequest() throws Exception {
        try{
            URL featureURL = new URL("http://demo.cubewerx.com/cipi12/cubeserv/cubeserv.cgi?service=wms&request=getcapabilities");
            WebMapServer wms = getCustomWMS(featureURL);
            WMSCapabilities caps = wms.getCapabilities();
            assertNotNull(caps);
            assertNotNull(caps.getRequest().getGetFeatureInfo());
           
            GetMapRequest getMapRequest = wms.createGetMapRequest();
           
            getMapRequest.setProperty(GetMapRequest.LAYERS, "ETOPO2:Foundation");
//        List simpleLayers = getMapRequest.getAvailableLayers();
//        Iterator iter = simpleLayers.iterator();
//        while (iter.hasNext()) {
//                SimpleLayer simpleLayer = (SimpleLayer) iter.next();
//                Object[] styles = simpleLayer.getValidStyles().toArray();
//                if (styles.length == 0) {
//                        simpleLayer.setStyle("");
//                        continue;
//                }
//                Random random = new Random();
//                int randomInt = random.nextInt(styles.length);
//                simpleLayer.setStyle((String) styles[randomInt]);
//        }
//        getMapRequest.setLayers(simpleLayers);
           
            getMapRequest.setSRS("EPSG:4326");
            getMapRequest.setDimensions("400", "400");
            getMapRequest.setFormat("image/png");
//        http://demo.cubewerx.com/cipi12/cubeserv/cubeserv.cgi?INFO_FORMAT=text/html&LAYERS=ETOPO2:Foundation&FORMAT=image/png&HEIGHT=400&J=200&REQUEST=GetFeatureInfo&I=200&BBOX=-34.12087,15.503481,1.8462441,35.6043956&WIDTH=400&STYLES=&SRS=EPSG:4326&QUERY_LAYERS=ETOPO2:Foundation&VERSION=1.3.0
            getMapRequest.setBBox("-34.12087,15.503481,1.8462441,35.6043956");
            URL url2 = getMapRequest.getFinalURL();
           
            GetFeatureInfoRequest request = wms.createGetFeatureInfoRequest(getMapRequest);
//        request.setQueryLayers(request.getQueryableLayers());
            request.setProperty(GetFeatureInfoRequest.QUERY_LAYERS, "ETOPO2:Foundation");
            request.setQueryPoint(200, 200);
            request.setInfoFormat("text/html");
           
            //System.out.println(request.getFinalURL());
           
//     TODO   Currently this server rtreturns code 400 !?
            GetFeatureInfoResponse response = (GetFeatureInfoResponse) wms.issueRequest(request);
            //System.out.println(response.getContentType());
            assertTrue( response.getContentType().indexOf("text/html") != -1 );
            BufferedReader in = new BufferedReader(new InputStreamReader(response.getInputStream()));
            String line;
           
View Full Code Here

        // display a data store file chooser dialog for shapefiles
        URL capabilitiesURL = WMSChooser.showChooseWMS();
        if( capabilitiesURL == null ){
            System.exit(0); // canceled
        }
        WebMapServer wms = new WebMapServer( capabilitiesURL );       
       
        List<Layer> wmsLayers = WMSLayerChooser.showSelectLayer( wms );
        if( wmsLayers == null ){
            JOptionPane.showMessageDialog(null, "Could not connect - check url");
            System.exit(0);
        }
        MapContent mapcontent = new MapContent();
        mapcontent.setTitle( wms.getCapabilities().getService().getTitle() );
       
        for( Layer wmsLayer : wmsLayers ){
            WMSLayer displayLayer = new WMSLayer(wms, wmsLayer );
            mapcontent.addLayer(displayLayer);
        }
View Full Code Here

            properties.setProperty(param[0].toUpperCase(), param[1]);
        }
       
        checkProperties(properties);
        try{
            WebMapServer wms = new WebMapServer(server);
            WMSCapabilities capabilities = wms.getCapabilities();
           
            assertNotNull(capabilities);
        } catch(java.net.ConnectException ce){
            if(ce.getMessage().indexOf("timed out")>0){
                System.err.println("Unable to test - timed out: "+ce);
View Full Code Here

    /*
     * Class under test for void WebMapServer(URL)
     */
    public void testWebMapServerURL() throws Exception {
        WebMapServer wms = new WebMapServer(serverURL);

        assertNotNull(wms.getCapabilities());
    }
View Full Code Here

        assertNotNull(wms.getCapabilities());
    }

    public void testGetCapabilities() throws Exception {
        WebMapServer wms = new WebMapServer(serverURL);

        assertNotNull(wms.getCapabilities());
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.wms.WebMapServer$LayerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.