Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureSource


        LOGGER.debug("Copy snapshot : " + layer + ", " + year + ", " + month + ", " + day);
      
        try {
       
          // read the shape file and put it into a SimpeFeatureCollection
          SimpleFeatureSource srcFs = srcDs.getFeatureSource(layer);
       
            // try to look for the destination table
            if(Arrays.asList(dstDs.getTypeNames()).contains(layer)) {
                LOGGER.error("******* "+layer +" EXISTS *******");
            } else
                LOGGER.error("******* "+layer +" DOES NOT EXIST *******");
          try {
              SimpleFeatureSource dstFs = (SimpleFeatureSource) dstDs.getFeatureSource(layer);
          } catch (Exception e) {
              LOGGER.debug("Exception while getting dst featureSource from " + layer +": " +e.getMessage(), e );
             
              if (forceCreation) {
                  // force creation of the target table
View Full Code Here


            String day,
            boolean forceCreation)
                throws PostGisException {

      DataStore dstDs=null;
        SimpleFeatureSource fsLayer = null;
        Transaction tx = new DefaultTransaction();

        //== check schema: create new or check they are aligned
        try {
          // craete destination store
View Full Code Here

     * @return a List of attribute that describe this feature
     * @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

     * @param dstDS
     * @throws PostGisException
     */
    private static void copyFeatures(String layer, SimpleFeatureCollection sourceFC, DataStore dstDS) throws PostGisException {
       
        SimpleFeatureSource fsDestLayer = null;
        try {
            fsDestLayer = dstDS.getFeatureSource(layer);
        } catch (Exception e) {
            LOGGER.error("Destination layer " +layer + " does not exist:" + e.getMessage(), e);
            throw new PostGisException("Destination layer " +layer + " does not exist:" + e.getMessage(), e);
View Full Code Here

        builder.setName(pointsType.getName());
        builder.setCRS(pointsType.getCoordinateReferenceSystem());
        SimpleFeatureType outputFeatureType = builder.buildFeatureType();
        MemoryDataStore dataStore = new MemoryDataStore(outputFeatureType);
        final String typeName = dataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportDiffOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setNewRef(changeCommit.getId().toString())
                .setOldRef(insertCommit.getId().toString()).call();
        featureSource = dataStore.getFeatureSource(typeName);
View Full Code Here

        builder.setName(pointsType.getName());
        builder.setCRS(pointsType.getCoordinateReferenceSystem());
        SimpleFeatureType outputFeatureType = builder.buildFeatureType();
        MemoryDataStore dataStore = new MemoryDataStore(outputFeatureType);
        final String typeName = dataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportDiffOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setNewRef(changeCommit.getId().toString())
                .setOldRef(insertCommit.getId().toString()).setUseOld(true).call();
        featureSource = dataStore.getFeatureSource(typeName);
View Full Code Here

        for (Feature feature : points) {
            insert(feature);
        }
        MemoryDataStore dataStore = new MemoryDataStore(pointsType);
        final String typeName = dataStore.getTypeNames()[0];
        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();
View Full Code Here

        }
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setAll(true).call();
        MemoryDataStore dataStore = new MemoryDataStore(pointsType);
        final String typeName = dataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath("HEAD:" + pointsName)
                .call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
View Full Code Here

        for (Feature feature : points) {
            insert(feature);
        }
        MemoryDataStore dataStore = new MemoryDataStore(simplifiedPointsType);
        final String typeName = dataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setFeatureTypeConversionFunction(function).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
View Full Code Here

    @Test
    public void testExportFromWrongFeatureType() throws Exception {
        MemoryDataStore dataStore = new MemoryDataStore(pointsType);
        final String typeName = dataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        try {
            geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName).call();
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

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

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.