CSIRO-enviro-informatics / loci-geometry-data-service

Loc-I Geometry Data Service
0 stars 0 forks source link

Find-by-point API endpoint which returns a Loc-I feature #3

Closed jyucsiro closed 4 years ago

jyucsiro commented 4 years ago

We want to enable a Find-by-point API endpoint that takes a lat-long as input and returns relevant geometries and any associated metadata, e.g. the related Loc-I feature.

We think that the Find-by-point API endpoint should be a generic API endpoint as part of the vanilla geometry-data-service image (https://github.com/CSIRO-enviro-informatics/geometry-data-service), but in addition, that it is configured to also return the Loc-I feature as an extension of sorts.

Linking of the Loc-I geometry and the Loc-I feature in this instance can be created via DB SQL statements that create a view in the Postgis/Postgres DB. The geometry-data-service can be extended to optionally return metadata about the geometry, i.e. the associated Loc-I feature from a specified view/table if it exists.

e.g.

a call to the loci geometry-data-service say /api/find-by-point?lat=aaa&long=bbb

would return something like this if format is turtle:

@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sf: <http://www.opengis.net/ont/sf#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://gds.loci.cat/geometry/asgs16_sa1/10102100702> 
     a geo:Geometry,  sf:MultiPolygon ;
  .
<http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1/10102100702> 
    geo:hasGeometry <http://gds.loci.cat/geometry/asgs16_sa1/10102100702> 
  .

or something like this if format is JSON:

[
   {
      "geometry": "http://gds.loci.cat/geometry/asgs16_sa1/10102100702", 
      "feature": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1/10102100702"
   }
...
]
benjaminleighton commented 4 years ago

@dr-shorthair suggested a property like isGeometryOf to link geometries back to features

jyucsiro commented 4 years ago

So that would return something like:

@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sf: <http://www.opengis.net/ont/sf#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix geox: <http://linked.data.gov.au/def/geox#> .

<http://gds.loci.cat/geometry/asgs16_sa1/10102100702> 
     a geo:Geometry,  sf:MultiPolygon ;
     geox:isGeometryOf <http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1/10102100702> 
  .

in json-ld

{
  "@id": "http://gds.loci.cat/geometry/asgs16_sa1/10102100702",
  "@type": [
    "http://www.opengis.net/ont/geosparql#Geometry",
    "http://www.opengis.net/ont/sf#MultiPolygon"
  ],
  "http://linked.data.gov.au/def/geox#isGeometryOf": {
    "@id": "http://linked.data.gov.au/dataset/asgs2016/statisticalarealevel1/10102100702"
  }
}
dr-shorthair commented 4 years ago

Yep

jyucsiro commented 4 years ago

Satisfied by https://github.com/CSIRO-enviro-informatics/geometry-data-service/pull/10