Skip to content
Andreas W. Bartels edited this page Mar 18, 2018 · 10 revisions

see Ckan homepage, documentation and github

maven

<dependency>
  <groupId>net.anwiba.spatial</groupId>
  <artifactId>anwiba-spatial-data-ckan</artifactId>
  <version>1.0.126</version>
</dependency>

usage

    ICanceler canceler = ICanceler.DummyCanceler;
    IResultProducer<PackageSearchResultResponse> responseProducer = (
        cancelable,
        statusCode,
        statusMessage,
        contentType,
        contentEncoding,
        inputStream) -> new CkanJsonResponseUnmarshallerFactory().create(PackageSearchResultResponse.class).unmarshal(
            inputStream);
     final IObjectRequestExecutorBuilder<PackageSearchResultResponse> builder = new ObjectRequestExecutorBuilderFactory()
         .create();
     try (final IObjectRequestExecutor<PackageSearchResultResponse> requestExecutor = builder
         .setResultProducer(responseProducer)
         .build();) {
       final PackageSearchResultResponse response = requestExecutor.execute(
           canceler, //
           PackageRequestBuilder.search("http://www.europeandataportal.eu/data/en/api")
               .query("water")
               .resourceFormat("geojson")
               .resourceFormat("GEOJSON")
               .resourceFormat("GeoJSON")
               .start(20)
               .rows(10)
               .build());
       final List<ILayerResourceDescription> result = new LinkedList<>();
       if (!response.isSuccess()) {
         throw new IOException(response.getError().getMessage());
       }
       final PackageSearchResult packageSearchResult = response.getResult();
       final Dataset[] results = packageSearchResult.getResults();


Clone this wiki locally