Examples of WMSLayerInfo


Examples of org.geoserver.catalog.WMSLayerInfo

        WMSStoreInfo wms = cb.buildWMSStore("demo");
        wms.setCapabilitiesURL(RemoteOWSTestSupport.WMS_SERVER_URL
                + "service=WMS&request=GetCapabilities");
        catalog.save(wms);
        cb.setStore(wms);
        WMSLayerInfo states = cb.buildWMSLayer("topp:states");
        states.setName("rstates");
        catalog.add(states);
        LayerInfo layer = cb.buildLayer(states);
        catalog.add(layer);

        // hide the layer to cite_nostates
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

            WMSStoreInfo wms = cb.buildWMSStore("demo");
            wms.setCapabilitiesURL(RemoteOWSTestSupport.WMS_SERVER_URL
                    + "service=WMS&request=GetCapabilities");
            getCatalog().save(wms);
            cb.setStore(wms);
            WMSLayerInfo states = cb.buildWMSLayer("topp:states");
            states.setName("rstates");
            getCatalog().add(states);
            LayerInfo layer = cb.buildLayer(states);
            getCatalog().add(layer);
        }
        Catalog catalog = getCatalog();
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        NamespaceInfo ns = catalog.getFactory().createNamespace();
        ns.setPrefix( "bar" );
        ns.setURI( "http://bar" );
        catalog.add( ns );
       
        WMSLayerInfo wms = catalog.getFactory().createWMSLayer();
        wms.setName( "foo" );
        wms.setNamespace( ns );
        wms.setStore(catalog.getStoreByName("acme", "demowms", WMSStoreInfo.class));
        catalog.add( wms );
       
        assertTrue( d.exists() );
        assertTrue( new File( d, "wmslayer.xml").exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

   
    @Test
    public void testModifyWMSLayer() throws Exception {
        testAddWMSLayer();
       
        WMSLayerInfo wli = catalog.getResourceByName( "bar", "foo", WMSLayerInfo.class );
        wli.setTitle( "fooTitle" );
        catalog.save( wli );
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms/foo/wmslayer.xml");
        Document dom = dom( f );
       
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        testAddWMSLayer();
       
        File d = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms/foo");
        assertTrue( d.exists() );
       
        WMSLayerInfo wli = catalog.getResourceByName( "bar", "foo", WMSLayerInfo.class );
        catalog.remove( wli );
       
        assertFalse( d.exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

    static final Logger LOGGER = Logging.getLogger(WMSLayerIdentifier.class);

    public List<FeatureCollection> identify(FeatureInfoRequestParameters params, int maxFeatures) throws IOException {
        final int x = params.getX();
        final int y = params.getY();
        WMSLayerInfo info = (WMSLayerInfo) params.getLayer().getResource();
        WebMapServer wms = info.getStore().getWebMapServer(null);
        Layer layer = info.getWMSLayer(null);

        CoordinateReferenceSystem crs = params.getRequestedCRS();
        if (crs == null) {
            // use the native one
            crs = info.getCRS();
        }
        ReferencedEnvelope bbox = params.getRequestedBounds();
        int width = params.getWidth();
        int height = params.getHeight();

        // we can cascade GetFeatureInfo on queryable layers and if the GML mime type is supported
        if (!layer.isQueryable()) {
            return null;
        }

        List<String> infoFormats;
        infoFormats = wms.getCapabilities().getRequest().getGetFeatureInfo().getFormats();
        if (!infoFormats.contains("application/vnd.ogc.gml")) {
            return null;
        }

        // the wms layer does request in a CRS that's compatible with the WMS server srs
        // list,
        // we may need to transform
        WMSLayer ml = new WMSLayer(wms, layer);
        // delegate to the web map layer as there's quite a bit of reprojection magic
        // code
        // that we want to be consistently reproduced for GetFeatureInfo as well
        final InputStream is = ml.getFeatureInfo(bbox, width, height, x, y,
                "application/vnd.ogc.gml", maxFeatures);
        List<FeatureCollection> results = new ArrayList<FeatureCollection>();
        try {
            Parser parser = new Parser(new WFSConfiguration());
            parser.setStrict(false);
            Object result = parser.parse(is);
            if (result instanceof FeatureCollectionType) {
                FeatureCollectionType fcList = (FeatureCollectionType) result;
                List<SimpleFeatureCollection> rawResults = fcList.getFeature();

                // retyping feature collections to replace name and namespace
                // from cascading server with our local WMSLayerInfo
                for (SimpleFeatureCollection fc : rawResults) {                   
                    SimpleFeatureType ft = fc.getSchema();
                                   
                    SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();                   
                    builder.init(ft);                                                                      
                   
                    builder.setName(info.getName());
                    builder.setNamespaceURI(info.getNamespace().getURI());
                  
                    SimpleFeatureType targetFeatureType = builder.buildFeatureType();
                    FeatureCollection rfc = new ReTypingFeatureCollection(fc, targetFeatureType);
                   
                    results.add(rfc);
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        WMSStoreInfo wms = cb.buildWMSStore("demo");
        wms.setCapabilitiesURL(RemoteOWSTestSupport.WMS_SERVER_URL
                + "service=WMS&request=GetCapabilities&version=1.1.0");

        cb.setStore(wms);
        WMSLayerInfo wmsLayer = cb.buildWMSLayer("topp:states");
        assertWMSLayer(wmsLayer);
       
        LayerInfo layer = cb.buildLayer(wmsLayer);
        assertEquals(LayerInfo.Type.WMS, layer.getType());

        wmsLayer = cat.getFactory().createWMSLayer();
        wmsLayer.setName("states");
        wmsLayer.setNativeName("topp:states");
        cb.initWMSLayer(wmsLayer);
        assertWMSLayer(wmsLayer);
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

           
            CatalogBuilder cb = new CatalogBuilder(getCatalog());
            WMSStoreInfo store = cb.buildWMSStore("test-store");
            store.setCapabilitiesURL(capsURL.toExternalForm());
            cb.setStore(store);
            WMSLayerInfo layer = cb.buildWMSLayer("world4326");
           
            // check the bbox has the proper axis order
            assertEquals("EPSG:4326", layer.getSRS());
            ReferencedEnvelope bbox = layer.getLatLonBoundingBox();
            assertEquals(-180, bbox.getMinX(), 0d);
            assertEquals(-90, bbox.getMinY(), 0d);
            assertEquals(180, bbox.getMaxX(), 0d);
            assertEquals(90, bbox.getMaxY(), 0d);
        } finally {
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

           
            CatalogBuilder cb = new CatalogBuilder(getCatalog());
            WMSStoreInfo store = cb.buildWMSStore("test-store");
            store.setCapabilitiesURL(capsURL.toExternalForm());
            cb.setStore(store);
            WMSLayerInfo layer = cb.buildWMSLayer("world4326");
           
            // check the bbox has the proper axis order
            assertEquals("EPSG:4326", layer.getSRS());
            ReferencedEnvelope bbox = layer.getLatLonBoundingBox();
            assertEquals(-180, bbox.getMinX(), 0d);
            assertEquals(-90, bbox.getMinY(), 0d);
            assertEquals(180, bbox.getMaxX(), 0d);
            assertEquals(90, bbox.getMaxY(), 0d);
        } finally {
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

           
            CatalogBuilder cb = new CatalogBuilder(getCatalog());
            WMSStoreInfo store = cb.buildWMSStore("test-store");
            store.setCapabilitiesURL(capsURL.toExternalForm());
            cb.setStore(store);
            WMSLayerInfo layer = cb.buildWMSLayer("world4326");
           
            // check the bbox has the proper axis order
            assertEquals("EPSG:4326", layer.getSRS());
            ReferencedEnvelope bbox = layer.getLatLonBoundingBox();
            assertEquals(-180, bbox.getMinX(), 0d);
            assertEquals(-90, bbox.getMinY(), 0d);
            assertEquals(180, bbox.getMaxX(), 0d);
            assertEquals(90, bbox.getMaxY(), 0d);
        } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.