Skip to content

Commit d33c91a

Browse files
authored
Merge pull request #2 from petergarnaes/fix-temporal-interval
Temporal interval adjusted to adhere to spec
2 parents bce8cdd + b6f1af8 commit d33c91a

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/main/java/mil/nga/oapi/features/json/Temporal.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
public class Temporal {
1515

1616
/**
17-
* Begin and end times of the time interval. The timestamps are in the
18-
* coordinate reference system specified in `trs`. By default this is the
19-
* Gregorian calendar.
17+
* One or more time intervals that describe the temporal extent of the dataset.
18+
* The value `null` is supported and indicates an unbounded interval end.
19+
* In the Core only a single time interval is supported. Extensions may support
20+
* multiple intervals. If multiple intervals are provided, the union of the
21+
* intervals describes the temporal extent.
2022
*/
21-
private List<String> interval = new ArrayList<>();
23+
private List<List<String>> interval = new ArrayList<>(new ArrayList<>());
2224

2325
/**
2426
* Coordinate reference system of the coordinates in the temporal extent
@@ -41,7 +43,7 @@ public Temporal() {
4143
*
4244
* @return interval
4345
*/
44-
public List<String> getInterval() {
46+
public List<List<String>> getInterval() {
4547
return interval;
4648
}
4749

@@ -51,7 +53,7 @@ public List<String> getInterval() {
5153
* @param interval
5254
* interval
5355
*/
54-
public void setInterval(List<String> interval) {
56+
public void setInterval(List<List<String>> interval) {
5557
this.interval = interval;
5658
}
5759

src/test/java/mil/nga/oapi/features/json/FeaturesTest.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testCollections() {
5555
+ " \"name\" : \"flurstueck\",\n"
5656
+ " \"title\" : \"Flurstück\",\n" + " \"extent\" : {\n"
5757
+ " \"spatial\" : { \"bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n"
58-
+ " \"temporal\" : { \"interval\" : [ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ] }\n"
58+
+ " \"temporal\" : { \"interval\" : [[ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ]] }\n"
5959
+ " },\n" + " \"links\" : [ {\n"
6060
+ " \"rel\" : \"item\",\n"
6161
+ " \"type\" : \"application/geo+json\",\n"
@@ -91,7 +91,7 @@ public void testCollections() {
9191
+ " \"title\" : \"Gebäude, Bauwerk\",\n"
9292
+ " \"extent\" : {\n"
9393
+ " \"spatial\" : { \"bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n"
94-
+ " \"temporal\" : { \"interval\" : [ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ] }\n"
94+
+ " \"temporal\" : { \"interval\" : [[ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ]] }\n"
9595
+ " },\n" + " \"links\" : [ {\n"
9696
+ " \"rel\" : \"item\",\n"
9797
+ " \"type\" : \"application/geo+json\",\n"
@@ -123,7 +123,7 @@ public void testCollections() {
123123
+ " \"title\" : \"Verwaltungseinheit\",\n"
124124
+ " \"extent\" : {\n"
125125
+ " \"spatial\" : { \"bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n"
126-
+ " \"temporal\" : { \"interval\" : [ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ] }\n"
126+
+ " \"temporal\" : { \"interval\" : [[ \"2018-05-18T14:45:44Z\", \"2019-06-17T21:41:19Z\" ]] }\n"
127127
+ " },\n" + " \"links\" : [ {\n"
128128
+ " \"rel\" : \"item\",\n"
129129
+ " \"type\" : \"application/geo+json\",\n"
@@ -172,7 +172,7 @@ public void testCollection() {
172172
+ " \"description\": \"Buildings in the city of Bonn.\",\n"
173173
+ " \"extent\": {\n"
174174
+ " \"spatial\": { \"bbox\" : [ 7.01, 50.63, 7.22, 50.78 ] },\n"
175-
+ " \"temporal\": { \"interval\" : [ \"2010-02-15T12:34:56Z\", \"2018-03-18T12:11:00Z\" ] }\n"
175+
+ " \"temporal\": { \"interval\" : [[ \"2010-02-15T12:34:56Z\", \"2018-03-18T12:11:00Z\" ]] }\n"
176176
+ " },\n" + " \"links\": [\n"
177177
+ " { \"href\": \"http://data.example.org/collections/buildings/items\",\n"
178178
+ " \"rel\": \"item\", \"type\": \"application/geo+json\",\n"
@@ -194,11 +194,12 @@ public void testCollection() {
194194
TestCase.assertEquals(50.63, extent.getSpatial().getBbox().get(1));
195195
TestCase.assertEquals(7.22, extent.getSpatial().getBbox().get(2));
196196
TestCase.assertEquals(50.78, extent.getSpatial().getBbox().get(3));
197-
TestCase.assertEquals(2, extent.getTemporal().getInterval().size());
197+
TestCase.assertEquals(1, extent.getTemporal().getInterval().size());
198+
TestCase.assertEquals(2, extent.getTemporal().getInterval().get(0).size());
198199
TestCase.assertEquals("2010-02-15T12:34:56Z",
199-
extent.getTemporal().getInterval().get(0));
200+
extent.getTemporal().getInterval().get(0).get(0));
200201
TestCase.assertEquals("2018-03-18T12:11:00Z",
201-
extent.getTemporal().getInterval().get(1));
202+
extent.getTemporal().getInterval().get(0).get(1));
202203
List<Link> links = collection.getLinks();
203204
TestCase.assertNotNull(extent);
204205
TestCase.assertEquals(2, links.size());

0 commit comments

Comments
 (0)