Class Feature

java.lang.Object
com.esri.arcgisruntime.data.Feature
All Implemented Interfaces:
GeoElement
Direct Known Subclasses:
ArcGISFeature

public class Feature extends Object implements GeoElement
A representation of a real-world geographic entity.

Features are composed of both a geometry (point, polyline, or polygon) and attributes. The geometry represents the location and shape of the real-world entity; the attributes (key-value pairs) represent the fields and values that describe the entity. Examples of features include roads, fire hydrants, and property boundaries. Applications can access features from a feature layer or a feature collection to visualize the feature's geographic and attribute information, execute spatial queries, perform analyses, or make edits to the feature's data directly. Feature attribute values can be changed, but attribute definitions cannot be added, deleted, or modified.

Features are typically persisted in a data source (such as a feature service, geodatabase, shapefile, GeoJSON file, or GeoPackage) and have a common attribute schema. Features can also be stored directly in a feature collection in a map or scene. A feature collection groups logically related tables of features that may have different schema, geometry types, and symbology. See FeatureCollectionLayer for more information.

Feature is the base class for ArcGISFeature. ArcGIS features are stored in ArcGIS specific data sources such as GeodatabaseFeatureTable and ServiceFeatureTable.

Since:
100.0.0
See Also:
  • Method Details

    • getAttributes

      public Map<String,Object> getAttributes()
      Gets a java.util.Map of all the available attributes as name value pairs. Only a subset of all attributes may be available on a ServiceFeatureTable if its outfields have been set.

      Attribute values are returned as Object instances, but the underlying value type is based on the Field.Type.

      Below is example of how to change an editable attribute then apply the change to the FeatureTable.

       feature.getAttributes().put("fieldName", "attributeValue");
       ListenableFuture<Boolean> result = featureTable.updateFeatureAsync(feature);
       
      Specified by:
      getAttributes in interface GeoElement
      Returns:
      all the available attributes as name value pairs.
      Since:
      100.0.0
      See Also:
    • getGeometry

      public Geometry getGeometry()
      Description copied from interface: GeoElement
      Gets the geometry which defines the shape and location of the GeoElement.
      Specified by:
      getGeometry in interface GeoElement
      Returns:
      the geometry defines the shape and location of the GeoElement, or null if none
    • setGeometry

      public void setGeometry(Geometry geometry)
      Description copied from interface: GeoElement
      Sets the geometry defines the shape and location of the GeoElement.
      Specified by:
      setGeometry in interface GeoElement
      Parameters:
      geometry - the geometry defines the shape and location of the GeoElement
    • getFeatureTable

      public FeatureTable getFeatureTable()
      Gets the FeatureTable that this feature belongs to.
      Returns:
      the FeatureTable that this feature belongs to, or null if none
      Since:
      100.0.0
    • refresh

      public boolean refresh()
      Resets the attributes and geometry of this feature to the values of the local backing feature table by discarding any in-memory changes to this feature that have not been applied to the local backing feature table. This method does not make any network requests, data is only refreshed locally as follows:
      • For a new feature instance that is not added to the table yet, no changes to geometry or attributes.
      • For an updated feature that is in the table, geometry and attributes change to the state in the local table.
      • For a feature that has been deleted from the table, no changes to geometry or attributes.
      Returns:
      true if the geometry or attributes were reset, false otherwise
      Since:
      100.4.0