Package org.geotools.feature

Examples of org.geotools.feature.FeatureCollection


        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        try {
            FeatureCollection result = process.execute(origional, "from_lrs_bad", "to_lrs", point,
                    null);
            Assert.fail("Expected error from bad from_lrs name");
        } catch (ProcessException e) {
            // Successful
        }
View Full Code Here


        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        try {
            FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs_bad", point,
                    null);
            Assert.fail("Expected error from bad to_lrs name");
        } catch (ProcessException e) {
            // Successful
        }
View Full Code Here

        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        try {
            FeatureCollection result = process.execute(origional, null, "to_lrs", point, null);
            Assert.fail("Expected error from bad from_lrs name");
        } catch (ProcessException e) {
            // Successful
        }
    }
View Full Code Here

        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        try {
            FeatureCollection result = process.execute(origional, "from_lrs", null, point, null);
            Assert.fail("Expected error from bad to_lrs name");
        } catch (ProcessException e) {
            // Successful
        }
    }
View Full Code Here

        SimpleFeatureSource source = featureSource.getFeatureSource("lrssimple");
        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();

        try {
            FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs_bad", null,
                    null);
            Assert.fail("Expected error from bad measure value");
        } catch (ProcessException e) {
            // Successful
        }
View Full Code Here

    }

    @Test
    public void testNoFeaturesGiven() throws Exception {
        LRSMeasureProcess process = new LRSMeasureProcess();
        FeatureCollection origional = FeatureCollections.newCollection();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", point, null);
        Assert.assertEquals(0, result.size());
    }
View Full Code Here

        SimpleFeatureSource source = featureSource.getFeatureSource("lrssimple");
        LRSMeasureProcess process = new LRSMeasureProcess();
        SimpleFeatureCollection origional = source.getFeatures();
        Point point = geometryFactory.createPoint(new Coordinate(1.0, 0.0));

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", point, null);
        Assert.assertEquals(1, result.size());
        Feature feature = result.features().next();
        Assert.assertNotNull(feature.getProperty("lrs_measure"));
        Assert.assertNotNull(feature.getProperty("lrs_measure").getValue());
        Double measure = (Double) feature.getProperty("lrs_measure").getValue();
        Assert.assertEquals(1.0, measure, 0.0);
    }
View Full Code Here

   
    public List getProperties(Object object) throws Exception {
        Object[] prop = new Object[2];
        prop[0] = KML.Placemark;
        if ( object instanceof FeatureCollection ) {
            FeatureCollection fc = (FeatureCollection) object;
            //TODO: this does not close the iterator!!
            Iterator iterator = DataUtilities.iterator( fc.features() );
           
            prop[1] = iterator;
        }
        else if ( object instanceof Collection ) {
            prop[1] = ((Collection)object).iterator();
View Full Code Here

    static void bencharkGeometryEncode(FeatureSource data) throws Exception {
        GeometryJSON gjson = new GeometryJSON();
        OutputStream out = System.out;/*new NullOutputStream();*/
        Writer writer = new OutputStreamWriter(out);
       
        FeatureCollection features = data.getFeatures();
        FeatureIterator it = features.features();

        long t1 = System.currentTimeMillis();
        while(it.hasNext()) {
            SimpleFeature f = (SimpleFeature) it.next();
            gjson.write((Geometry) f.getDefaultGeometry(), writer);
View Full Code Here

        assertEquals(strip(collectionText()), writer.toString());
    }
   
    public void testFeatureCollectionRead() throws Exception {
       
        FeatureCollection actual =
            fjson.readFeatureCollection(reader(strip(collectionText())));
        assertNotNull(actual);
       
        FeatureCollection expected = collection();
        assertEquals(expected.size(), actual.size());
       
        FeatureIterator a = actual.features();
        FeatureIterator e = expected.features();
       
        while(e.hasNext()) {
            assertTrue(a.hasNext());
            assertEqualsLax((SimpleFeature)e.next(), (SimpleFeature) a.next());
        }
View Full Code Here

TOP

Related Classes of org.geotools.feature.FeatureCollection

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.