Class FeatureSourceRelation

java.lang.Object
nz.org.riskscape.engine.relation.BaseRelation
nz.org.riskscape.engine.relation.FeatureSourceRelation
All Implemented Interfaces:
AutoCloseable, nz.org.riskscape.engine.data.SelfDescribingScalarData, nz.org.riskscape.engine.pipeline.Realized, nz.org.riskscape.engine.relation.Relation

public class FeatureSourceRelation extends nz.org.riskscape.engine.relation.BaseRelation

Provides a stream of Tuples based on a SimpleFeatureSource

  • Nested Class Summary

    Nested classes/interfaces inherited from class nz.org.riskscape.engine.relation.BaseRelation

    nz.org.riskscape.engine.relation.BaseRelation.Fields, nz.org.riskscape.engine.relation.BaseRelation.Transformer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.geotools.api.referencing.crs.CoordinateReferenceSystem
     
    static final String
    Name of tuple member that identifies the value of SimpleFeature.getID()
    static final nz.org.riskscape.engine.types.Type
    Special instance of Text type used to identify feature id - makes it easier to treat it specially

    Fields inherited from class nz.org.riskscape.engine.relation.BaseRelation

    skipOnInvalid, transformers
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    FeatureSourceRelation(nz.org.riskscape.engine.relation.BaseRelation.Fields clonedFields, @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull nz.org.riskscape.engine.SRIDSet sridSet, @NonNull org.geotools.api.filter.Filter filter, @NonNull org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
     
     
    FeatureSourceRelation(@NonNull nz.org.riskscape.engine.types.Struct type, @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull nz.org.riskscape.engine.SRIDSet sridSet, @NonNull org.geotools.api.filter.Filter filter, @NonNull org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
     
     
    FeatureSourceRelation(@NonNull nz.org.riskscape.engine.types.Struct type, @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull nz.org.riskscape.engine.SRIDSet sridSet, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
     
     
    FeatureSourceRelation(org.geotools.api.data.SimpleFeatureSource fs, nz.org.riskscape.engine.SRIDSet sridSet, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected nz.org.riskscape.engine.relation.BaseRelation
    clone(nz.org.riskscape.engine.relation.BaseRelation.Fields fields)
     
    protected nz.org.riskscape.engine.relation.BaseRelation
    cloneWithRestrictionIfSupported(nz.org.riskscape.engine.restriction.Restriction restriction)
     
    static nz.org.riskscape.engine.types.Struct
    fromFeatureSource(org.geotools.api.data.SimpleFeatureSource fs, boolean includeFid)
    Infer a struct from the given FeatureSource TODO should we be passing in the CRS here? We have the potential to scrape a different CRS for our referenced value compared to the one that gets passed in to the spatial metadata
    static nz.org.riskscape.engine.types.Struct
    fromFeatureType(org.geotools.api.feature.simple.SimpleFeatureType type, org.geotools.geometry.jts.ReferencedEnvelope bounds, boolean includeFid)
    Infer a struct from the given SimpleFeatureType
    static nz.org.riskscape.engine.types.Struct.StructMember
    geometryStructMember(nz.org.riskscape.engine.types.Struct struct, org.geotools.api.feature.simple.SimpleFeatureType schema)
     
    @NonNull org.geotools.api.data.SimpleFeatureSource
     
    @NonNull org.geotools.api.filter.Filter
     
     
    @NonNull nz.org.riskscape.engine.SRIDSet
     
     
     
    static nz.org.riskscape.engine.relation.SpatialMetadata
    spatialMetadataFromSchema(nz.org.riskscape.engine.types.Struct struct, org.geotools.api.feature.simple.SimpleFeatureType schema, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
     

    Methods inherited from class nz.org.riskscape.engine.relation.BaseRelation

    cloneWithProjectionIfSupported, cloneWithTransformer, getLimit, getOffset, getRawType, getSpatialMetadata, getType, hasSkipOnInvalid, iterator, limitAndOffset, project, restrict, skipInvalid, skipOrThrow, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nz.org.riskscape.engine.pipeline.Realized

    close

    Methods inherited from interface nz.org.riskscape.engine.relation.Relation

    calculateBounds, getScalarDataType, limit, offset, stream
  • Field Details

    • FID_MEMBER_NAME

      public static final String FID_MEMBER_NAME

      Name of tuple member that identifies the value of SimpleFeature.getID()

      See Also:
    • FID_TYPE

      public static final nz.org.riskscape.engine.types.Type FID_TYPE

      Special instance of Text type used to identify feature id - makes it easier to treat it specially

    • crs

      protected final org.geotools.api.referencing.crs.CoordinateReferenceSystem crs
  • Constructor Details

    • FeatureSourceRelation

      public FeatureSourceRelation(org.geotools.api.data.SimpleFeatureSource fs, nz.org.riskscape.engine.SRIDSet sridSet, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    • FeatureSourceRelation

      public FeatureSourceRelation(@NonNull @NonNull nz.org.riskscape.engine.types.Struct type, @NonNull @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull @NonNull nz.org.riskscape.engine.SRIDSet sridSet, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    • FeatureSourceRelation

      public FeatureSourceRelation(@NonNull @NonNull nz.org.riskscape.engine.types.Struct type, @NonNull @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull @NonNull nz.org.riskscape.engine.SRIDSet sridSet, @NonNull @NonNull org.geotools.api.filter.Filter filter, @NonNull @NonNull org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    • FeatureSourceRelation

      protected FeatureSourceRelation(@NonNull nz.org.riskscape.engine.relation.BaseRelation.Fields clonedFields, @NonNull @NonNull org.geotools.api.data.SimpleFeatureSource fs, @NonNull @NonNull nz.org.riskscape.engine.SRIDSet sridSet, @NonNull @NonNull org.geotools.api.filter.Filter filter, @NonNull @NonNull org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
  • Method Details

    • fromFeatureSource

      public static nz.org.riskscape.engine.types.Struct fromFeatureSource(org.geotools.api.data.SimpleFeatureSource fs, boolean includeFid)

      Infer a struct from the given FeatureSource TODO should we be passing in the CRS here? We have the potential to scrape a different CRS for our referenced value compared to the one that gets passed in to the spatial metadata

      Parameters:
      fs - a feature source to build a Struct from
      includeFid - if true, a special _fid member is added to the type which holds the value of SimpleFeature.getID().
    • fromFeatureType

      public static nz.org.riskscape.engine.types.Struct fromFeatureType(org.geotools.api.feature.simple.SimpleFeatureType type, org.geotools.geometry.jts.ReferencedEnvelope bounds, boolean includeFid)

      Infer a struct from the given SimpleFeatureType

      Parameters:
      type - a feature type to build a Struct from
      bounds - the geometric bounds if known (else null)
      includeFid - if true, a special _fid member is added to the type which holds the value of SimpleFeature.getID().
    • geometryStructMember

      public static nz.org.riskscape.engine.types.Struct.StructMember geometryStructMember(nz.org.riskscape.engine.types.Struct struct, org.geotools.api.feature.simple.SimpleFeatureType schema)
      Returns:
      the StructMember in the given struct the corresponds to the feature's geometry
    • spatialMetadataFromSchema

      public static nz.org.riskscape.engine.relation.SpatialMetadata spatialMetadataFromSchema(nz.org.riskscape.engine.types.Struct struct, org.geotools.api.feature.simple.SimpleFeatureType schema, org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    • rawIterator

      public FeatureSourceTupleIterator rawIterator()
      Specified by:
      rawIterator in class nz.org.riskscape.engine.relation.BaseRelation
    • getSourceInformation

      public String getSourceInformation()
    • cloneWithRestrictionIfSupported

      protected nz.org.riskscape.engine.relation.BaseRelation cloneWithRestrictionIfSupported(nz.org.riskscape.engine.restriction.Restriction restriction)
      Overrides:
      cloneWithRestrictionIfSupported in class nz.org.riskscape.engine.relation.BaseRelation
    • clone

      protected nz.org.riskscape.engine.relation.BaseRelation clone(nz.org.riskscape.engine.relation.BaseRelation.Fields fields)
      Specified by:
      clone in class nz.org.riskscape.engine.relation.BaseRelation
    • size

      public Optional<Long> size()
    • getSridSet

      @NonNull public @NonNull nz.org.riskscape.engine.SRIDSet getSridSet()
    • getFeatureSource

      @NonNull public @NonNull org.geotools.api.data.SimpleFeatureSource getFeatureSource()
    • getFilter

      @NonNull public @NonNull org.geotools.api.filter.Filter getFilter()