Package net.opengis.wfs

Examples of net.opengis.wfs.FeatureCollectionType


        if (version == Version.WFS1_0) {
            Encoder e = new Encoder(new org.geotools.wfs.v1_0.WFSConfiguration());
            e.getNamespaces().declarePrefix(prefix, namespace);
            e.setIndenting(true);

            FeatureCollectionType featureCollectionType = WfsFactory.eINSTANCE
                    .createFeatureCollectionType();
            featureCollectionType.getFeature().add(collection);

            e.encode(featureCollectionType, org.geotools.wfs.WFS.FeatureCollection, out);
        }
        if (version == Version.WFS1_1) {
            Encoder e = new Encoder(new org.geotools.wfs.v1_1.WFSConfiguration());
            e.getNamespaces().declarePrefix(prefix, namespace);
            e.setIndenting(true);

            FeatureCollectionType featureCollectionType = WfsFactory.eINSTANCE
                    .createFeatureCollectionType();
            featureCollectionType.getFeature().add(collection);

            e.encode(featureCollectionType, org.geotools.wfs.WFS.FeatureCollection, out);
        }
    }
View Full Code Here


        if (obj instanceof SimpleFeature) {
            SimpleFeature feature = (SimpleFeature) obj;
            return DataUtilities.collection(feature);
        }
        if (obj instanceof FeatureCollectionType) {
            FeatureCollectionType collectionType = (FeatureCollectionType) obj;
            for (Object entry : collectionType.getFeature()) {
                SimpleFeatureCollection collection = toFeatureCollection(entry);
                if (entry != null) {
                    return collection;
                }
            }
View Full Code Here

        tx.transform(new DOMSource(doc), new StreamResult(tmp));

        in = new FileInputStream(tmp);

        Parser parser = new Parser(configuration);
        FeatureCollectionType fc = (FeatureCollectionType) parser.parse(in);
        assertNotNull(fc);

        List featureCollections = fc.getFeature();
        assertEquals(1, featureCollections.size());

        SimpleFeatureCollection featureCollection;
        featureCollection = (SimpleFeatureCollection) featureCollections.get(0);
        assertEquals(5, featureCollection.size());
View Full Code Here

        b.add( 3 );
        store.addFeature(b.buildFeature( "three" ));
    }

    public void testEncodeFeatureCollection() throws Exception {
        FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
        FeatureCollection features = store.getFeatureSource("feature").getFeatures();
        fc.getFeature().add( features );

        Encoder e = encoder();
        e.getNamespaces().declarePrefix( "geotools", "http://geotools.org");
        e.setIndenting(true);
       
View Full Code Here

        assertEquals("10", attributes.getNamedItem("numberMatched" ).getTextContent());
        assertEquals("0", attributes.getNamedItem("numberReturned" ).getTextContent());
    }
   
    public void testEncodeFeatureCollectionWithoutBBOX() throws Exception {
        FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
        FeatureCollection features = store.getFeatureSource("feature").getFeatures();
        fc.getFeature().add( features );
        Configuration wfsConfiguration = new org.geotools.wfs.v2_0.WFSConfiguration();
        wfsConfiguration.getProperties().add(GMLConfiguration.NO_FEATURE_BOUNDS);
        Encoder e = encoder(wfsConfiguration);
        e.getNamespaces().declarePrefix( "geotools", "http://geotools.org");
        e.setIndenting(true);
View Full Code Here

        assertEquals( 2, d.getElementsByTagName( "geotools:feature" ).getLength() );
        assertNotNull( ((Element)d.getElementsByTagName( "geotools:feature").item( 0 )).getAttribute("gml:id") );
    }

    public void testEncodeMultiFeatureCollection() throws Exception {
        FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
       
        fc.getFeature().add( store.getFeatureSource("feature").getFeatures() );
        fc.getFeature().add( store.getFeatureSource("other").getFeatures() );
       
        Encoder e = encoder();
        e.getNamespaces().declarePrefix( "geotools", "http://geotools.org");
        e.setIndenting(true);
       
View Full Code Here

       
        ComplexDataType data = (ComplexDataType) o;
        assertEquals( 1, data.getData().size() );
       
        assertTrue( data.getData().get( 0 ) instanceof FeatureCollectionType );
        FeatureCollectionType fc = (FeatureCollectionType) data.getData().get( 0 );

        assertEquals( 1, fc.getFeature().size() );
        FeatureCollection features = (FeatureCollection) fc.getFeature().get( 0 );
        assertEquals( 1, features.size() );
   
    }
View Full Code Here

    public void testSingle() throws Exception {
        FeatureSource<? extends FeatureType, ? extends Feature> source = getFeatureSource(MockData.SEVEN);
        FeatureCollection<? extends FeatureType, ? extends Feature> features = source.getFeatures();

        FeatureCollectionType fcType = WfsFactory.eINSTANCE
                .createFeatureCollectionType();

        fcType.getFeature().add(features);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        producer().write(fcType, output, request(MockData.SEVEN) );

        DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance()
View Full Code Here

        assertEquals(7, document.getElementsByTagName("cdf:Seven").getLength());

    }

    public void testMultipleSameNamespace() throws Exception {
        FeatureCollectionType fcType = WfsFactory.eINSTANCE
                .createFeatureCollectionType();
        fcType.getFeature().add(
               getFeatureSource(MockData.SEVEN).getFeatures());
        fcType.getFeature().add(getFeatureSource(MockData.FIFTEEN).getFeatures());

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        producer().write(fcType, output, request(MockData.SEVEN, MockData.FIFTEEN));

        DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance()
View Full Code Here

                .getLength()
                + document.getElementsByTagName("cdf:Fifteen").getLength());
    }

    public void testMultipleDifferentNamespace() throws Exception {
        FeatureCollectionType fcType = WfsFactory.eINSTANCE
                .createFeatureCollectionType();
        fcType.getFeature().add(getFeatureSource(MockData.SEVEN).getFeatures());
        fcType.getFeature().add(getFeatureSource(MockData.POLYGONS).getFeatures());
       
        int npolys = getFeatureSource(MockData.POLYGONS).getFeatures().size();

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        producer().write(fcType, output, request(MockData.SEVEN, MockData.POLYGONS));
View Full Code Here

TOP

Related Classes of net.opengis.wfs.FeatureCollectionType

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.