Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #259 allowing trailing Z for all variants of time parts #265

Merged
merged 15 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog
* fix bug where in some cases, instead of an OSHDBTimeoutException an IniteException was thrown. #258
* improve accuracy of built-in geometry helper functions which calculate the geodesic lengths and areas of OSM geometries. #193
* better handling of OSM multipolygons with touching inner rings. This improves performance considerably in some cases (especially large complex multipolygons). #249
* (breaking) Timestamp parser class renamed to `IsoDateTimeParser` from `ISODateTimeParser` and adjust how input timestamps (e.g. in `MapReducer.timestamps()`) are handled: only the UTC time zone identifier `Z` is supported. #265

## 0.5.10

Expand Down
2 changes: 1 addition & 1 deletion documentation/manual/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The OSHDB is able to cope well even with complex polygons that have many vertice
timestamps
----------

This specifies the time range and time subdivisions for the OSHDB query. Accepts [one](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-) [or](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-java.lang.String-) [more](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-java.lang.String-java.lang.String...-) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted dates. Depending on the used OSHDB [view](views.md), these timestamps are interpreted slightly differently: When using the **snapshot** view, the given timestamps define the dates at which the snapshots of the OSM entities are taken. When using the **contribution** view, all modifications to the OSM entities are returned that lie within the time range defined by the given first and last timestamp, while any further timestamps can be used later to [aggregate](aggregation.md) results into finer time intervals.
This specifies the time range and time subdivisions for the OSHDB query. Accepts [one](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-) [or](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-java.lang.String-) [more](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-java.lang.String-java.lang.String...-) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted dates (given in the [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) timezone). Depending on the used OSHDB [view](views.md), these timestamps are interpreted slightly differently: When using the **snapshot** view, the given timestamps define the dates at which the snapshots of the OSM entities are taken. When using the **contribution** view, all modifications to the OSM entities are returned that lie within the time range defined by the given first and last timestamp, while any further timestamps can be used later to [aggregate](aggregation.md) results into finer time intervals.

There exists also a [method](https://docs.ohsome.org/java/oshdb/0.5.10/aggregated/org/heigit/bigspatialdata/oshdb/api/mapreducer/MapReducer.html#timestamps-java.lang.String-java.lang.String-org.heigit.bigspatialdata.oshdb.util.time.OSHDBTimestamps.Interval-) to define common regularly spaced time intervals within a time range, e.g. a monthly time interval between two dates.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.OSMTagInterface;
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.OSMTagKey;
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator;
import org.heigit.bigspatialdata.oshdb.util.time.ISODateTimeParser;
import org.heigit.bigspatialdata.oshdb.util.time.IsoDateTimeParser;
import org.heigit.bigspatialdata.oshdb.util.time.OSHDBTimestampList;
import org.heigit.bigspatialdata.oshdb.util.time.OSHDBTimestamps;
import org.heigit.bigspatialdata.oshdb.util.time.TimestampFormatter;
Expand Down Expand Up @@ -379,14 +379,14 @@ public MapReducer<X> timestamps(
SortedSet<OSHDBTimestamp> timestamps = new TreeSet<>();
try {
timestamps.add(
new OSHDBTimestamp(ISODateTimeParser.parseISODateTime(isoDateFirst).toEpochSecond())
new OSHDBTimestamp(IsoDateTimeParser.parseIsoDateTime(isoDateFirst).toEpochSecond())
);
timestamps.add(
new OSHDBTimestamp(ISODateTimeParser.parseISODateTime(isoDateSecond).toEpochSecond())
new OSHDBTimestamp(IsoDateTimeParser.parseIsoDateTime(isoDateSecond).toEpochSecond())
);
for (String isoDate : isoDateMore) {
timestamps.add(
new OSHDBTimestamp(ISODateTimeParser.parseISODateTime(isoDate).toEpochSecond())
new OSHDBTimestamp(IsoDateTimeParser.parseIsoDateTime(isoDate).toEpochSecond())
);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package org.heigit.bigspatialdata.oshdb.tool.importer.cli.validator;

import org.heigit.bigspatialdata.oshdb.util.time.ISODateTimeParser;

import com.beust.jcommander.IParameterValidator;
import com.beust.jcommander.ParameterException;
import org.heigit.bigspatialdata.oshdb.util.time.IsoDateTimeParser;

public class TimeValidity implements IParameterValidator{

public class TimeValidity implements IParameterValidator {
@Override
public void validate(String name, String value) throws ParameterException {
try {
ISODateTimeParser.parseISODateTime(value);
IsoDateTimeParser.parseIsoDateTime(value);
} catch (Exception e) {
throw new ParameterException(e.getMessage());
}
}

}

This file was deleted.

Loading