Class InputProcessingUtils

    • Constructor Detail

      • InputProcessingUtils

        public InputProcessingUtils()
    • Method Detail

      • findEpsg

        public String findEpsg​(double lon,
                               double lat)
        Finds and returns the EPSG code of the given point, which is needed for createCircularPolygons.

        Adapted code from class in the osmatrix project (© by Michael Auer)

        lon - Longitude coordinate of the point.
        lat - Latitude coordinate of the point.
        String representing the corresponding EPSG code.
      • splitBboxes

        public List<String> splitBboxes​(String bboxes)
        Splits the given bounding boxes and returns them in a List.
        bboxes - contains the given bounding boxes
        List containing the splitted bounding boxes
        BadRequestException - if the bboxes parameter has an invalid format
      • splitBcircles

        public List<String> splitBcircles​(String bcircles)
        Splits the given bounding circles and returns them in a List.
        bcircles - contains the given bounding circles
        List containing the splitted bounding circles
        BadRequestException - if the bcircles parameter has an invalid format
      • splitBpolys

        public List<String> splitBpolys​(String bpolys)
        Splits the given bounding polygons and returns them in a List.
        bpolys - contains the given bounding polygons
        List containing the splitted bounding polygons
        BadRequestException - if the bpolys parameter has an invalid format
      • defineToTimestamps

        public String[] defineToTimestamps​(String[] timeData)
        Defines the toTimestamps for the result json object for /users responses.
        timeData - contains the requested time
        array having only the toTimestamps
      • extractIsoTime

        public String[] extractIsoTime​(String time)
        Extracts the time information out of the time parameter and checks the content on its format, as well as ISO-8601 conformity. This method is used if one datetimestring is given. Following time formats are allowed:
        • YYYY-MM-DD or YYYY-MM-DDThh:mm:ss: When a timestamp includes 'T', hh:mm must also be given. This applies for all time formats, which use timestamps. If -MM-DD or only -DD is missing, '01' is used as default for month and day.
        • YYYY-MM-DD/YYYY-MM-DD: start/end timestamps
        • YYYY-MM-DD/YYYY-MM-DD/PnYnMnD: start/end/period where n refers to the size of the respective period
        • /YYYY-MM-DD: #/end where # equals the earliest timestamp
        • /YYYY-MM-DD/PnYnMnD: #/end/period
        • YYYY-MM-DD/: start/# where # equals the latest timestamp
        • YYYY-MM-DD//PnYnMnD: start/#/period
        • /: #/# where # equals the earliest and latest timestamp
        • //PnYnMnD: #/#/period
        • invalid: throws BadRequestException

        For clarification: the format YYYY-MM-DDThh:mm:ss can be applied to any format, where a timestamp is used and # is a replacement holder for "no value". Note that the positioning and using of the forward slash '/' is very important.

        time - String holding the unparsed time information.
        String array containing the startTime at [0], the endTime at [1] and the period at [2].
        BadRequestException - if the given time parameter is not ISO-8601 conform
      • sortTimestamps

        public String[] sortTimestamps​(String[] timestamps)
        Sorts the given timestamps from oldest to newest.
        BadRequestException - if the given time parameter is not ISO-8601 conform
      • checkCustomBoundaryId

        public void checkCustomBoundaryId​(String id)
        Checks the given custom boundary id. At the moment only used if output format = csv.
        BadRequestException - if the custom ids contain semicolons
      • isWithin

        public boolean isWithin​(org.locationtech.jts.geom.Geometry geom)
        Checks if the given geometry is within the underlying data-polygon. Returns also true if no data-polygon is given.
        geom - Geometry, which is tested against the data-polygon
        true - if inside
        false - if not inside
      • isSimpleFeatureType

        public boolean isSimpleFeatureType​(String type)
        Checks if the given String is one of the simple feature types (point, line, polygon).
      • filterOnPlanarRelations

        public <T extends org.heigit.ohsome.oshdb.util.mappable.OSHDBMapReducible> org.heigit.ohsome.oshdb.api.mapreducer.MapReducer<T> filterOnPlanarRelations​(org.heigit.ohsome.oshdb.api.mapreducer.MapReducer<T> mapRed)
        Applies an entity filter using only planar relations (relations with an area) on the given MapReducer object. It uses the tags "type=multipolygon" and "type=boundary".
      • checkGeometryOnSimpleFeatures

        public boolean checkGeometryOnSimpleFeatures​(org.locationtech.jts.geom.Geometry geom,
                                                     Set<SimpleFeatureType> simpleFeatureTypes)
        Checks whether a geometry is of given feature type (Puntal|Lineal|Polygonal).
        simpleFeatureTypes - a set of feature types
        true if the geometry matches the given simpleFeatureTypes, otherwise false
      • parseFilter

        public org.heigit.ohsome.oshdb.filter.FilterExpression parseFilter​(org.heigit.ohsome.oshdb.filter.FilterParser fp,
                                                                           String filter)
        Tries to parse the given filter using the given parser.
        BadRequestException - if the filter contains wrong syntax.
      • checkTemporalExtend

        protected void checkTemporalExtend​(String... timeInfo)
        Checks the provided time info on its temporal extent.
        timeInfo - time information to check
        NotFoundException - if the given time is not completely within the timerange of the underlying data
        BadRequestException - if the timestamps are not ISO-8601 conform
        RuntimeException - if the Date or DateTime Format are not supported
      • checkTimestampsOnIsoConformity

        protected void checkTimestampsOnIsoConformity​(String... timeInfo)
        Checks the provided time info on its ISO conformity.
        timeInfo - time information to check
        BadRequestException - if the timestamps are not ISO-8601 conform.
      • checkPeriodOnIsoConformity

        protected void checkPeriodOnIsoConformity​(String period)
        Checks the provided period on its ISO conformity.
        BadRequestException - if the interval is not ISO-8601 conform.
      • getBoundaryIds

        public Object[] getBoundaryIds()
      • getToTimestamps

        public String[] getToTimestamps()
      • setBoundaryIds

        public void setBoundaryIds​(Serializable[] boundaryIds)
      • setToTimestamps

        public void setToTimestamps​(String[] toTimestamps)