Search in sources :

Example 1 with AbstractFeatureVisitor

use of org.geotools.feature.collection.AbstractFeatureVisitor in project chordatlas by twak.

the class Footprints method test.

public static void test() throws IOException, SAXException, ParserConfigurationException {
    // create the parser with the gml 2.0 configuration
    org.geotools.xml.Configuration configuration = new org.geotools.gml2.GMLConfiguration();
    org.geotools.xml.Parser parser = new org.geotools.xml.Parser(configuration);
    InputStream xml = new FileInputStream("/home/twak/data/around_ucl_buildings.gml");
    // parse
    FeatureCollection fc = (FeatureCollection) parser.parse(xml);
    fc.accepts(new AbstractFeatureVisitor() {

        public void visit(Feature feature) {
            System.out.println(feature);
        // SimpleFeature f = (Feature) i.next();
        // 
        // Point point = (Point) f.getDefaultGeometry();
        // String name = (String) f.getAttribute( "name" );
        }
    }, new NullProgressListener());
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Feature(org.opengis.feature.Feature) FileInputStream(java.io.FileInputStream) NullProgressListener(org.geotools.util.NullProgressListener) FeatureCollection(org.geotools.feature.FeatureCollection) AbstractFeatureVisitor(org.geotools.feature.collection.AbstractFeatureVisitor)

Aggregations

FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 FeatureCollection (org.geotools.feature.FeatureCollection)1 AbstractFeatureVisitor (org.geotools.feature.collection.AbstractFeatureVisitor)1 NullProgressListener (org.geotools.util.NullProgressListener)1 Feature (org.opengis.feature.Feature)1