org.opengis.feature.simple.SimpleFeature Maven / Gradle / Ivy
Show all versions of gt-opengis Show documentation
/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2011, Open Source Geospatial Foundation (OSGeo)
* (C) 2004-2007 Open Geospatial Consortium Inc.
*
* All Rights Reserved. http://www.opengis.org/legal/
*/
package org.opengis.feature.simple;
import java.util.List;
import org.opengis.feature.ComplexAttribute;
import org.opengis.feature.Feature;
import org.opengis.feature.type.Name;
/**
* An instance of {@link SimpleFeatureType} composed of fixed list values in a known order.
*
* The definition of a "simple feature" can be summed up as the following:
*
*
* - made up of only non-complex attributes, no associations
*
- attributes are of multiplicity 1
*
- attributes are ordered
*
- attribute names are unqualified (namespaceURI == null)
*
*
*
*
*
Attribute Access
*
* The order and multiplicity restrictions on simple feature make attribute values accessible via an
* index. For example consider the following shapefile entry:
*
*
* | GEOMETRY | INT | STRING |
* | POINT(0 0) | 0 | "zero" |
*
*
* Accessing attributes via index would look like:
*
*
* SimpleFeature feature = ...;
*
* Geometry g = (Geometry) feature.getAttribute( 0 );
* Integer i = (Integer) feature.getAttribute( 1 );
* String s = (String) feature.getAttribute( 2 );
*
*
* One could also access by name:
*
*
* SimpleFeature feature = ...;
*
* Geometry g = (Geometry) feature.getAttribute( "GEOMETRY" );
* Integer i = (Integer) feature.getAttribute( "INT" );
* String s = (String) feature.getAttribute( "STRING" );
*
*
* Note: Attribute access via getAttribute() methods returns attribute values, and not the
* attributes themselves. For access to the actual attributes {@link
* ComplexAttribute#getProperty(String)} can be used.
*
* @see SimpleFeatureType
* @author Jody Garnett (LISAsoft)
* @author Justin Deoliveira (The Open Planning Project)
* @since 2.5
* @version 8.0
*/
public interface SimpleFeature extends Feature {
/**
* Unique Identifier for the SimpleFeature
*
*
This value is non-null and should be the same as getIdentifier().toString(). Please note
* that an ID may be provided
*
* @return A unique identifier for the attribute, or null
if the attribute is
* non-identifiable.
*/
String getID();
/** Override and type narrow to SimpleFeatureType. */
SimpleFeatureType getType();
/**
* The type of the feature.
*
*
This method is a synonym for {@link #getType()}.
*
* @see #getType()
*/
SimpleFeatureType getFeatureType();
/**
* Returns a list of the values of the attributes contained by the feature.
*
*
This method is a convenience for:
*
*
* List values = new ArrayList();
* for ( Property p : getProperties(); ) {
* values.add( p.getValue() );
* }
*
* return values;
*
*
* @return List of attribute values for the feature.
*/
List