All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geotools.data.simple.SimpleFeatureCollection Maven / Gradle / Ivy

Go to download

The main module contains the GeoTools public interfaces that are used by other GeoTools modules (and GeoTools applications). Where possible we make use industry standard terms as provided by OGC and ISO standards. The formal GeoTools public api consists of gt-metadata, jts and the gt-main module. The main module contains the default implementations that are available provided to other GeoTools modules using our factory system. Factories are obtained from an appropriate FactoryFinder, giving applications a chance configure the factory used using the Factory Hints facilities. FilterFactory ff = CommonFactoryFinder.getFilterFactory(); Expression expr = ff.add( expression1, expression2 ); If you find yourself using implementation specific classes chances are you doing it wrong: Expression expr = new AddImpl( expression1, expressiom2 );

The newest version!
/*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
 *
 *    (C) 2019, Open Source Geospatial Foundation (OSGeo)
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.data.simple;

import org.geotools.feature.FeatureCollection;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.Filter;
import org.opengis.filter.sort.SortBy;

/**
 * Access to "simple" Feature content where each feature has the same SimpleFeatureType.
 *
 * 

Please keep in mind that a SimpleFeatureCollection is similar to a result set; and may not * necessarily load everything in to memory. Treat each iterator as a forward only cursor in the * JDBC sense; and take care to FeatureIterator.close() after use. * *

SimpleFeatureIterator close

* *

SimpleFeatureCollection provides streaming access with the following restrictions on use of * {@link SimpleFeatureIterator}: You must call {@link SimpleFeatureIterator#close()}. This allows * FeatureCollection to clean up any operating system resources used to access information. * *

Example (safe) use: * *


 * SimpleFeatureIterator iterator = simpleFeatureCollection.features();
 * try {
 *     while( iterator.hasNext() ){
 *          SimpleFeature feature = iterator.next();
 *          System.out.println( feature.getID() );
 *     }
 * }
 * finally {
 *     iterator.close();
 * }
 * 
* * And in Java 7: * *

 * try ( SimpleFeatureIterator iterator = simpleFeatureCollection.features() ){
 *     while( iterator.hasNext() ){
 *          SimpleFeature feature = iterator.next();
 *          System.out.println( feature.getID() );
 *     }
 * }
 * 
* *

*/ public interface SimpleFeatureCollection extends FeatureCollection { /** * Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection. * *

The implementation of FeatureIterator must adhere to the rules of fail-fast concurrent * modification. In addition (to allow for resource backed collections) the * SimpleFeatureIterator.close() method must be called. * *

Example use: * *


     * SimpleFeatureIterator iterator=collection.features();
     * try {
     *     while( iterator.hasNext()  ){
     *          SimpleFeature feature = iterator.next();
     *          System.out.println( feature.getID() );
     *     }
     * }
     * finally {
     *     iterator.close();
     * }
     * 
*/ public SimpleFeatureIterator features(); public SimpleFeatureCollection subCollection(Filter filter); public SimpleFeatureCollection sort(SortBy order); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy