Class DataExtractionTransformer

  • All Implemented Interfaces:
    Serializable

    public class DataExtractionTransformer
    extends Object
    implements Serializable
    Used by data extraction requests to create GeoJSON features from OSM entities.
    See Also:
    Serialized Form
    • Constructor Detail

      • DataExtractionTransformer

        public DataExtractionTransformer​(String startTimestamp,
                                         String endTimestamp,
                                         org.heigit.ohsome.oshdb.filter.FilterExpression filter,
                                         boolean isContributionsEndpoint,
                                         boolean isContributionsLatestEndpoint,
                                         boolean clipGeometries,
                                         boolean includeTags,
                                         boolean includeOSMMetadata,
                                         boolean includeContributionTypes,
                                         InputProcessingUtils inputUtils,
                                         ExecutionUtils exeUtils,
                                         Set<Integer> keysInt,
                                         ElementsGeometry outputGeometry,
                                         Set<SimpleFeatureType> simpleFeatureTypes,
                                         boolean isContainingSimpleFeatureTypes)
        Creates a new data extraction transformer, adhering to the given parameters.
        Parameters:
        startTimestamp - start timestamp of the query
        endTimestamp - end timestamp of the query
        filter - the filter of the query
        isContributionsEndpoint - set true if the requested resource is a `/contributions` endpoint
        isContributionsLatestEndpoint - set true if the requested resource is a `/contributions/latest` endpoint
        clipGeometries - whether or not the output geometries should be clipped to the query area-of-interest or not
        includeTags - set true if the result should include all OSM entity's tags as GeoJSON feature properties
        includeOSMMetadata - set true if the result should include the OSM entity metadata (e.g. changeset id, timestamp, version number)
        includeContributionTypes - set true if the result should include the contribution type for `/elements/contributions` resources
        inputUtils - input processing utility object
        exeUtils - the execution utils object
        keysInt - (for the deprecated `keys` filter parameter) set the list of always to be returned OSM tags in the GeoJSON's features' properties
        outputGeometry - specifies what should be returned as the GeoJSON feature's geometry: either the full geometry, its bbox or its centroid.
        simpleFeatureTypes - if the query uses the (deprecated) types parameter, and it contains simple feature "geometry" types, specify the set of to be returned geometry types here
        isContainingSimpleFeatureTypes - set true if the query uses the (deprecated) types
    • Method Detail

      • buildChangedFeatures

        public List<org.wololo.geojson.Feature> buildChangedFeatures​(List<org.heigit.ohsome.oshdb.util.mappable.OSMContribution> contributions)
        Returns a list of GeoJSON features representing the given OSM contributions.

        The output is slightly different between the `/contributions` endpoint and the full history data extraction, but always one GeoJSON feature for each modification of an OSM entity is returned. Contribution endpoints optionally return the contribution type annotated in the resulting GeoJSON properties, while full history endpoints include validFrom-validTo dates.

        Parameters:
        contributions - list of modifications of a single OSMEntity.
        Returns:
        list of GeoJSON features corresponding to the given OSM entity's modifications.
      • buildUnchangedFeatures

        public List<org.wololo.geojson.Feature> buildUnchangedFeatures​(org.heigit.ohsome.oshdb.util.mappable.OSMEntitySnapshot snapshot)
        Returns either a singleton of the given OSM entity (snapshot), or an empty list, if it doesn't match the given (simple feature type) filter.

        This is only used by full history data extraction requests, to also include entities in the result which don't change at all during the given start and end times.

        Parameters:
        snapshot - OSM entity to return.
        Returns:
        Either a singleton of a GeoJSON feature representing this OSM entity, or an empty collection if it doesn't fit the given (simple feature types) filter.