Class Feature

  • All Implemented Interfaces:
    GeoElement
    Direct Known Subclasses:
    ArcGISFeature

    public class Feature
    extends java.lang.Object
    implements GeoElement
    A representation of a real-world object on a map. A feature is persisted in a FeatureTable in a data store (such as a database or service) or in a map. Features in the same data store or feature layer have a common attribute schema.
    Since:
    100.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
      Gets a java.util.Map of all the available attributes as name value pairs.
      FeatureTable getFeatureTable()
      Gets a reference to the FeatureTable that this feature came from.
      Geometry getGeometry()
      Gets the geometry of this geoelement.
      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.
      void setGeometry​(Geometry geometry)
      Sets the GeoElement's geometry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.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:
        FeatureTable.updateFeatureAsync(Feature)
      • getGeometry

        public Geometry getGeometry()
        Description copied from interface: GeoElement
        Gets the geometry of this geoelement.
        Specified by:
        getGeometry in interface GeoElement
        Returns:
        the geometry of this geoelement
      • setGeometry

        public void setGeometry​(Geometry geometry)
        Description copied from interface: GeoElement
        Sets the GeoElement's geometry.
        Specified by:
        setGeometry in interface GeoElement
        Parameters:
        geometry - the geometry to set
      • getFeatureTable

        public FeatureTable getFeatureTable()
        Gets a reference to the FeatureTable that this feature came from.
        Returns:
        a reference to the FeatureTable that this feature came from
        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