Package org.geotools.feature

Examples of org.geotools.feature.FeatureCollection.features()


        FeatureTypeInfo fti = getCatalog().getFeatureTypeByName("MyPoints");
        assertEquals("EPSG:4326", fti.getSRS());
        assertEquals(ProjectionPolicy.REPROJECT_TO_DECLARED, fti.getProjectionPolicy());
        FeatureCollection fc = fti.getFeatureSource(null, null).getFeatures();
        assertEquals(CRS.decode("EPSG:4326"), fc.getSchema().getCoordinateReferenceSystem());
        FeatureIterator fi = fc.features();
        Feature f = fi.next();
       
        //test that geometry was reprojected
        Geometry g = (Geometry) f.getDefaultGeometryProperty().getValue();
        assertFalse(g.equalsExact(WKT.read("POINT(500050 500050)")));
View Full Code Here


        VersioningDataStore synch = (VersioningDataStore) getCatalog().getDataStoreByName("synch")
                .getDataStore(null);
        FeatureSource<SimpleFeatureType, SimpleFeature> fs = synch.getFeatureSource(SYNCH_HISTORY);
        FeatureCollection fc = fs.getFeatures(ff.equals(ff.property("table_name"), ff
                .literal("restricted")));
        FeatureIterator fi = fc.features();
        SimpleFeature f = (SimpleFeature) fi.next();
        fi.close();

        assertEquals(12l, f.getAttribute("central_revision"));
    }
View Full Code Here

  public void testParseWfs() throws IOException, SAXException, ParserConfigurationException {
    GeoserverClientSynchronizer clientSynchronizer = new GeoserverClientSynchronizer(makeConfiguration(), "", SimulatedRequestBuilder.POST_TEMPLATE);
    InputStream is = loadResource("buildings.xml");
    FeatureCollection features = (FeatureCollection) clientSynchronizer.parseWfs(is);
    assertEquals(2, features.size());
    FeatureIterator<?> it = features.features();
    try {
      int i = 0;
      while (it.hasNext()) {
        Feature feature = it.next();
        switch (i) {
View Full Code Here

            List<AttributeDescriptor> types;
           
            for (int i = 0; i < size; i++) // for each layer queried
            {
                fr = (FeatureCollection) collections.get(i);               
                reader = fr.features();
             
                boolean startFeat = true;
                while (reader.hasNext()) {
                    Feature feature = reader.next();
                   
View Full Code Here

        List list = new ArrayList();
       
        Iterator it = collections.iterator();
        while(it.hasNext()){
            FeatureCollection col = (FeatureCollection)it.next();
            FeatureIterator it2 = col.features();
            while (it2.hasNext()){
                list.add(it.next());
            }
            it2.close();
        }
View Full Code Here

        FeatureCollectionType fct = (FeatureCollectionType) p.parse(new ByteArrayInputStream(
                response.getOutputStreamContent().getBytes()));
        FeatureCollection fc = (FeatureCollection) fct.getFeature().get(0);

        assertEquals(1, fc.size());
        SimpleFeature sf = (SimpleFeature) fc.features().next();
        Geometry simplified = ((Geometry) sf.getDefaultGeometry());
        assertTrue(new Envelope(-92, -87, 37, 43).contains(simplified.getEnvelopeInternal()));
        // should have been simplified to a 4 side polygon
        assertEquals(5, simplified.getCoordinates().length);
    }
View Full Code Here

        FeatureCollection fc = (FeatureCollection) fct.getFeature().get(0);

        assertEquals(36, fc.size());
       
        // get first feature
        SimpleFeature sf = (SimpleFeature) fc.features().next();
        Geometry simplified = ((Geometry) sf.getDefaultGeometry());
        assertTrue(simplified instanceof Point);
        assertEquals(sf.getID(),"0")
        assertEquals(sf.getAttributeCount(), 5);
        assertEquals("75",sf.getProperty("GRAY_INDEX").getValue());
View Full Code Here

        FeatureCollectionType fct = (FeatureCollectionType) p.parse(new ByteArrayInputStream(
                response.getOutputStreamContent().getBytes()));
        FeatureCollection fc = (FeatureCollection) fct.getFeature().get(0);

        assertEquals(1, fc.size());
        SimpleFeature sf = (SimpleFeature) fc.features().next();
        Geometry simplified = ((Geometry) sf.getDefaultGeometry());
        // should have been clipped to this specific area
        assertTrue(new Envelope(-100, -90, 40, 45).contains(simplified.getEnvelopeInternal()));
    }
}
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.