-
Notifications
You must be signed in to change notification settings - Fork 1
Ckan
Andreas W. Bartels edited this page Feb 22, 2021
·
10 revisions
About Ckan see homepage, documentation and github
<dependency>
<groupId>net.anwiba.spatial</groupId>
<artifactId>anwiba-spatial-data-ckan</artifactId>
<version>1.1.121</version>
</dependency>
ICanceler canceler = ICanceler.DummyCanceler;
IResultProducer<PackageSearchResultResponse> responseProducer =
(cancelable, statusCode, statusMessage, contentType, contentEncoding, inputStream)
-> new CkanJsonResponseUnmarshallerFactory().create(PackageSearchResultResponse.class).unmarshal(inputStream);
IObjectRequestExecutorBuilder<PackageSearchResultResponse> builder = new ObjectRequestExecutorBuilderFactory().create();
try (IObjectRequestExecutor<PackageSearchResultResponse> requestExecutor = builder.setResultProducer(responseProducer).build()) {
IRequest request = PackageRequestBuilder
.search("http://www.europeandataportal.eu/data/en/api")
.query("water")
.resourceFormat("geojson")
.resourceFormat("GEOJSON")
.resourceFormat("GeoJSON")
.start(20)
.rows(10)
.build();
PackageSearchResultResponse response = requestExecutor.execute(canceler, request);
if (!response.isSuccess()) {
throw new IOException(response.getError().getMessage());
}
PackageSearchResult packageSearchResult = response.getResult();
Dataset[] results = packageSearchResult.getResults();
}