Class Feature

java.lang.Object
com.massifmaps.geometry.Feature
Direct Known Subclasses:
VectorTileFeature

public class Feature extends Object
A feature consisting of geometry and properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Feature(Geometry geometry, Variant properties)
    Constructs a Feature object from geometry and properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to the specified object.
    Returns the geometry of the feature.
    Returns the feature's geometry as a GeoJSON string, in its own coordinates.

    Serialising a geometry otherwise means constructing a GeoJSONGeometryWriter in the
    binding, which every binding then does differently and, in a scripting one, slowly.
    Returns the properties of the feature.
    int
    Returns the hash value of this object.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Feature

      public Feature(Geometry geometry, Variant properties)
      Constructs a Feature object from geometry and properties.
      Parameters:
      geometry - The geometry of the feature.
      properties - The properties of the feature.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getGeometry

      public Geometry getGeometry()
      Returns the geometry of the feature.
      Returns:
      The geometry of the feature.
    • getProperties

      public Variant getProperties()
      Returns the properties of the feature.
      Returns:
      The properties of the feature.
    • getGeometryGeoJSON

      public String getGeometryGeoJSON()
      Returns the feature's geometry as a GeoJSON string, in its own coordinates.

      Serialising a geometry otherwise means constructing a GeoJSONGeometryWriter in the
      binding, which every binding then does differently and, in a scripting one, slowly.
      Returns:
      The geometry as GeoJSON, or an empty string when there is no geometry.