Skip to content
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 @@ -77,6 +77,7 @@
- `collectionInfo.ftl` shows the collection id alongside its title and
description, and links to the collection's schema. `collections.ftl` lists
entries as `collection_id (Title)`.
- The HTML collection page links to the collection schema and shows the spatial and temporal extent when available (#185).


## 2.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@
<p><a href="${model.storageCrs}" target="_blank">${model.storageCrs}</a></p>
</#if>

<#if model.extent??>
<#if model.extent.spatialExtent??>
<h3>Spatial extent</h3>
<ul>
<#list model.extent.spatialExtent.bbox as bbox>
<li><#list bbox as v>${v?c}<#sep>, </#list> (${model.extent.spatialExtent.crs!""})</li>
</#list>
</ul>
</#if>
<#if model.extent.temporalExtent??>
<h3>Temporal extent</h3>
<ul>
<#list model.extent.temporalExtent.interval as interval>
<li>${(interval[0])!"..."} / ${(interval[1])!"..."}</li>
</#list>
</ul>
</#if>
</#if>

<h3>Queryable properties</h3>
<p><a href="collections/${model.id}/queryables${langQuery}">Find out properties usable in filters</a></p>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package fi.nls.hakunapi.simple.webapp.jakarta.features;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;

import java.io.File;

import jakarta.servlet.ServletContextEvent;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.MediaType;

import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;

import fi.nls.hakunapi.simple.webapp.jakarta.HakunaContextListener;
import fi.nls.hakunapi.simple.webapp.jakarta.HakunaTestServletContext;
import fi.nls.hakunapi.simple.webapp.jakarta.SimpleFeaturesApplication;

public class CollectionPageHtmlTest extends JerseyTest {

@Override
protected Application configure() {
File file = new File(getClass().getClassLoader().getResource("hakuna_html_map/hakuna.properties").getFile());
System.setProperty("hakuna.config.path", file.getParentFile().getAbsolutePath() + "/");

HakunaTestServletContext sc = new HakunaTestServletContext();
new HakunaContextListener().contextInitialized(new ServletContextEvent(sc));
return new SimpleFeaturesApplication(sc);
}

private String html(String collectionId) {
return target("/collections/" + collectionId).request(MediaType.TEXT_HTML).get(String.class);
}

@Test
public void testSchemaLinkAndSpatialExtent() {
String page = html("fence");

assertThat(page, containsString("href=\"collections/fence/schema\""));
assertThat(page, containsString("Spatial extent"));
assertThat(page, containsString("-110, -60, 140, 30"));
assertThat(page, not(containsString("Temporal extent")));
}

@Test
public void testTemporalExtent() {
String page = html("survey");

assertThat(page, containsString("Temporal extent"));
assertThat(page, containsString("2020-01-01T00:00:00Z / 2021-01-01T00:00:00Z"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ srid=3067,3857
srid.3067.proj4=+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
default.collections.srid=3067,3857

collections=fence
collections=fence,survey

collections.fence.geometry.type=POINT
collections.fence.properties=name
collections.fence.extent.spatial.crs84=-110,-60,140,30
collections.fence.testdata.1=1;POINT(1 1);Fence A

collections.survey.geometry.type=POINT
collections.survey.properties=name,surveyed
collections.survey.properties.surveyed.type=DATE
collections.survey.time=surveyed
collections.survey.extent.temporal=2020-01-01T00:00:00Z,2021-01-01T00:00:00Z
collections.survey.testdata.1=1;POINT(2 2);Survey A;2020-06-01
Loading