Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureCollection


        assertEquals(1, layers.size());

        FeatureSource<?, ?> fs = layers.get(0).getFeatureSource();
        assertNotNull(layers.get(0).getStyle());

        final SimpleFeatureCollection features = (SimpleFeatureCollection) fs.getFeatures();
        assertEquals(5, features.size());

        Map<String, SimpleFeature> idToFeature = idToFeatureMap(features);
        checkFeature(layerData, idToFeature.get("grid.x.1"), new Coordinate(120, 90), new Coordinate(120, 132), "120 m");
        checkFeature(layerData, idToFeature.get("grid.x.2"), new Coordinate(130, 90), new Coordinate(130, 132), "130 m");
        checkFeature(layerData, idToFeature.get("grid.x.3"), new Coordinate(140, 90), new Coordinate(140, 132), "140 m");
View Full Code Here


        try {
            // read the shape file and put it into a SimpeFeatureCollection
            srcStore = createDatastore(srcShapeFile);
           
            SimpleFeatureSource featureSource = srcStore.getFeatureSource();
            SimpleFeatureCollection sfc = (SimpleFeatureCollection) featureSource.getFeatures();
            return enrichAndAddFeatures(sfc, dstPg, layer, year, month, day, true);
        } catch (IOException ex) {
            throw new PostGisException("Error copying features: " + ex.getMessage(), ex);
        } finally {
            quietDisposeStore(srcStore);
View Full Code Here

                filter = (Filter) FF.and(filter, dayFilter);
            }

            LOGGER.info("Filter: " + filter);
           
            final SimpleFeatureCollection filteredSF = srcFs.getFeatures(filter);

          if (filteredSF == null || (filteredSF != null && filteredSF.isEmpty())) {
              LOGGER.warn(" The filtered collection is empty. Skip copying");
              return;
          }
          LOGGER.info("The filtered collection is not empty. Starting copy " + filteredSF.size() + " features");
          copyFeatures(layer, filteredSF, dstDs);
      } catch (Exception e) {
        LOGGER.error("The source layer " + layer + " cannot be accessed. Maybe it does not exist. Skip execution", e);
        throw new PostGisException("Source layer " + layer + " cannot be accessed.");
      }
View Full Code Here

                }
                if (!exitForIntermediateSaving) {
                    hasFinished = true;
                }
                SimpleFeatureCollection featureCollection = new ListFeatureCollection(srcSchema, sfcData);
                featureStoreData.addFeatures(featureCollection);
            }
           
            tx.commit();
            LOGGER.info("Copied " + i + " features for "+ layer+"/"+year+"/"+month+"/"+day+ " to " + dstPg);
View Full Code Here

     * @throws IOException
     */
    public static List<AttributeDescriptor> getFeatureAttributes(DataStore ds, String featureName) throws IOException{
   
      SimpleFeatureSource featureSource = ds.getFeatureSource(featureName);
        SimpleFeatureCollection sfc = (SimpleFeatureCollection) featureSource.getFeatures();
        return sfc.getSchema().getAttributeDescriptors();
    }
View Full Code Here

        return iterator;
    }

    @JSStaticFunction
    public static FeatureCollection from_(Scriptable collectionObj) {
        SimpleFeatureCollection collection = null;
        if (collectionObj instanceof Wrapper) {
            Object obj = ((Wrapper) collectionObj).unwrap();
            if (obj instanceof SimpleFeatureCollection) {
                collection = (SimpleFeatureCollection) obj;
            }
View Full Code Here

        geogig.command(ExportDiffOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setNewRef(changeCommit.getId().toString())
                .setOldRef(insertCommit.getId().toString()).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, points));
    }
View Full Code Here

        geogig.command(ExportDiffOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setNewRef(changeCommit.getId().toString())
                .setOldRef(insertCommit.getId().toString()).setUseOld(true).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, points));
    }
View Full Code Here

        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, points));
    }
View Full Code Here

        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath("HEAD:" + pointsName)
                .call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, points));
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureCollection

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.