Examples of FeatureCollection


Examples of org.geotools.feature.FeatureCollection

            query.getHints().add(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, coordSeq));
            query.setStartIndex(offset);
            if (limit != null && limit.intValue() > 0) {
                query.setMaxFeatures(limit);
            }
            FeatureCollection collection = source.getFeatures(query);
            FeatureIterator features = collection.features();
            Iterator<Feature> fiterator = new FeatureIteratorIterator<Feature>(features);

            Iterator<RevObject> objects = Iterators.transform(fiterator,
                    new Function<Feature, RevObject>() {
                        @Override
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        try {
            File geoJsonfile = new File(geoJSON);
            checkParameter(geoJsonfile.exists(), "File does not exist '%s'", geoJsonfile);
            InputStream in = new FileInputStream(geoJsonfile);
            FeatureJSON fjson = new FeatureJSON();
            @SuppressWarnings("rawtypes")
            FeatureCollection fc = fjson.readFeatureCollection(in);
            @SuppressWarnings("unchecked")
            DataStore dataStore = new MemoryDataStore(fc);
            return dataStore;
        } catch (IOException ioe) {
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        }
        FileWriter writer = null;
        try {
            op.setProgressListener(cli.getProgressListener()).call();
            FeatureJSON fjson = new FeatureJSON();
            @SuppressWarnings("rawtypes")
            FeatureCollection fc = featureSource.getFeatures();
            writer = new FileWriter(file);
            fjson.writeFeatureCollection(fc, writer);
        } catch (IllegalArgumentException iae) {
            throw new org.locationtech.geogig.cli.InvalidParameterException(iae.getMessage(), iae);
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

            @QueryParam("spacing") int spacing) {
        final TimeSurface surf = server.surfaceCache.get(surfaceId);
        if (surf == null) return badRequest("Invalid TimeSurface ID.");
        if (spacing < 1) spacing = 5;
        List<IsochroneData> isochrones = getIsochronesAccumulative(surf, spacing);
        final FeatureCollection fc = LIsochrone.makeContourFeatures(isochrones);
        return Response.ok().entity(new StreamingOutput() {
            @Override
            public void write(OutputStream output) throws IOException {
                FeatureJSON fj = new FeatureJSON();
                fj.writeFeatureCollection(fc, output);
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        assertEquals("Value of land area is wrong", ((Double) firstFeature(features).getAttribute(
                "LAND_KM")).doubleValue(), 143986.61, 0.001);
    }

    public void testLoadAndCheckParentTypeIsPolygon() throws Exception {
        FeatureCollection features = loadFeatures(STATE_POP, Query.ALL);
        SimpleFeatureType schema = firstFeature(features).getFeatureType();
        assertEquals(schema.getSuper(), BasicFeatureTypes.POLYGON);
    }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        assertFalse(reader.hasNext());
        reader.close();
    }

    public void testAttributesWritingShapefile() throws Exception {
        FeatureCollection features = createFeatureCollection();
        File tmpFile = getTempFile("test-shp", ".shp");
        tmpFile.delete();
        OGRDataStore s = new OGRDataStore(tmpFile.getAbsolutePath(), "ESRI shapefile", null, ogr);
        writeFeatures(s, features);
    }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        it.close();
        fw.close();
    }

    private OGRDataStore createDataStore(File f) throws Exception {
        FeatureCollection fc = createFeatureCollection();
        f.delete();
        OGRDataStore sds = new OGRDataStore(f.getAbsolutePath(), "ESRI shapefile", null, ogr);
        writeFeatures(sds, fc);
        return sds;
    }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

     * @throws Exception
     */
    public void testRendererBehaviour() throws Exception {
        Query query = new Query(featureSource.getSchema().getTypeName());
        query.setHints(new Hints(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, new LiteCoordinateSequenceFactory())));
        FeatureCollection fc = featureSource.getFeatures(query);
        FeatureIterator fi = fc.features();
        while(fi.hasNext()) {
            fi.next();
        }
        fi.close();
    }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

    // by features.close, I would like to know
    @SuppressWarnings("unchecked")
    private ReferencedEnvelope getBounds(FeatureSource source) {
        try {
            ReferencedEnvelope boundingBox = new ReferencedEnvelope(DefaultGeographicCRS.WGS84);
            FeatureCollection features = source.getFeatures();
            FeatureIterator iterator = features.features();
            try {
                while (iterator.hasNext()) {
                    Feature f = iterator.next();
                    boundingBox.include(f.getBounds());
                }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

            FeatureSource fSource = (FeatureSource) mappingDataStore.getFeatureSource(typeName);

            final int EXPECTED_RESULT_COUNT = 2;

            FeatureCollection features = (FeatureCollection) fSource.getFeatures();

            int resultCount = getCount(features);
            assertEquals(EXPECTED_RESULT_COUNT, resultCount);

            Feature feature;
            int count = 0;
            FeatureIterator it = features.features();
            for (; it.hasNext();) {
                feature = (Feature) it.next();
                count++;
            }
            it.close();
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.