Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of schema:GeoShape #159

Closed
dblodgett-usgs opened this issue Feb 21, 2018 · 11 comments
Closed

Fix use of schema:GeoShape #159

dblodgett-usgs opened this issue Feb 21, 2018 · 11 comments

Comments

@dblodgett-usgs
Copy link
Contributor

Should be doing something like:

{
 "@context": [
  "https://opengeospatial.github.io/ELFIE/json-ld/elf-index.jsonld",
  "https://opengeospatial.github.io/ELFIE/json-ld/hyf.jsonld",
  "http://geojson.org/geojson-ld/geojson-context.jsonld"
 ],
 "@id": "https://opengeospatial.github.io/ELFIE/usgs/nhdplusflowline/huc12obs/070900020601",
 "@type": "http://www.opengeospatial.org/standards/waterml2/hy_features/HY_HydrographicNetwork",
 "name": "NHDPlus V2.0 Network for Waunakee Marsh-Sixmile Creek",
 "description": "Collection of Flowlines for HUC12 watershed.",
 "realizedCatchment": [
  {
   "@id": "https://opengeospatial.github.io/ELFIE/usgs/huc/huc12obs/070900020601",
   "@type": "http://www.opengeospatial.org/standards/waterml2/hy_features/HY_Catchment"
  }
 ],
 "geo": {
  "@type": "schema:GeoCoordinates",
  "schema:latitude": 43.2103,
  "schema:longitude": -89.5171
 },
 "geo": {
  "@type": "schema:GeoShape",
  "schema:polygon": "wkt 1234567890"
 }
}

Have:

{
 "@context": [
  "https://opengeospatial.github.io/ELFIE/json-ld/elf-index.jsonld",
  "https://opengeospatial.github.io/ELFIE/json-ld/hyf.jsonld",
  "http://geojson.org/geojson-ld/geojson-context.jsonld"
 ],
 "@id": "https://opengeospatial.github.io/ELFIE/usgs/nhdplusflowline/huc12obs/070900020601",
 "@type": "http://www.opengeospatial.org/standards/waterml2/hy_features/HY_HydrographicNetwork",
 "name": "NHDPlus V2.0 Network for Waunakee Marsh-Sixmile Creek",
 "description": "Collection of Flowlines for HUC12 watershed.",
 "realizedCatchment": [
  {
   "@id": "https://opengeospatial.github.io/ELFIE/usgs/huc/huc12obs/070900020601",
   "@type": "http://www.opengeospatial.org/standards/waterml2/hy_features/HY_Catchment"
  }
 ],
 "geo": {
  "@type": "schema:GeoCoordinates",
  "schema:latitude": 43.2103,
  "schema:longitude": -89.5171
 },
 "schema:GeoShape": {
  "@type": "FeatureCollection",
  "@id": "https://opengeospatial.github.io/ELFIE/usgs/nhdplusflowline/huc12obs/070900020601.geojson"
 }
}

Need to determine the best way to encode the link to the geojson document. @abhritchie @jkreft-usgs will drop ideas in here.

@dblodgett-usgs
Copy link
Contributor Author

Thinking something like:

 "geo": {
  "@type": "schema:GeoShape",
  "schema:polygon": "wkt 1234567890",
  "seeAlso": "https://opengeospatial.github.io/ELFIE/usgs/nhdplusflowline/huc12obs/070900020601.geojson"
 }

@afeliachi
Copy link
Contributor

I'd rather use gsp properties for declaring wkt literals for the sake of compatibility with GeoSparql.
also schema:polygon is not supposed to be a wkt. It should be a Text but not a Well-Known one ;) (cf. schema:polygon ).
I suggest to separate the two representations.

@sgrellet
Copy link
Member

@afeliachi : Schema only recognizes the following DataType : http://schema.org/DataType. WKT is not one of them. We considered somehow that WKT was 'a subtype of Text'.
We are chasing 2 things in one action : indexing and good geometry declaration
Would trying to combine both like this enable a better declaration ?
"geo":{
"@type": [ "schema:GeoShape", "gsp:Geometry" ].

@afeliachi
Copy link
Contributor

@sgrellet : double typing would be a good solution. like:

"geo": {
  "@type":  [ "schema:GeoShape", "gsp:Geometry" ],
  "gsp:asWKT": "POLYGON(12 34, 56 78, ....)",
  "seeAlso": "https://opengeospatial.github.io/ELFIE/usgs/nhdplusflowline/huc12obs/070900020601.geojson"
 }

@dblodgett-usgs: I have I question though. Am not very familiar with geojson, what does (or can) the geojson file contain? The whole description of the feature or only the geometry or possibly many geometries?

@dblodgett-usgs
Copy link
Contributor Author

@afeliachi: My knowledge of GeoJSON is not very precise, but from using http://geojsonlint.com/ -- it appears that you can do all of the above. All of the files that I generated in my latest work are FeatureCollections because the standard GDAL GeoJSON export creates FeatureCollections as far as I know. I would rather just do the geometry of one feature though... maybe in my next round of what I'll export with GDAL then open the result and remove the FeatureCollection wrapper.

In general, I'm actually leaning toward implementing schema:geoShape exactly as the schema.org description says:

A polygon is the area enclosed by a point-to-point path for which the starting and ending points are the same. A polygon is expressed as a series of four or more space delimited points where the first and final points are identical.

If you made me interpret this given common practice, I'd use the GPS lat/lon datum (WGS84), I'd use X/Y axis order, and I'd follow the right hand rule. Se we'd have like:

"geo": {
  "@type": "GeoShape",
  "polygon": "-91 40 -91 41 -90 41 -90 40 -91 40"
}

For this box: screen shot 2018-02-23 at 9 55 47 am

Looking at one of the comments here: schemaorg/schemaorg#113 it sounds like there is actually a test tool. Will look into that too.

Still not sure exactly where we should land with this, but I think a gsp:hasGeometry with the asWKT seperate from schema.org is going to be the way to go...

I would rather not double type a single shema:geo element.

Further thoughts anyone?

@darctur
Copy link

darctur commented Feb 23, 2018 via email

@dblodgett-usgs
Copy link
Contributor Author

We would include interior rings in a WKT represetnation and/or a geojson representation.

@dblodgett-usgs
Copy link
Contributor Author

Maybe I'm late to the part, but for the record, this thread is really topical. geojson/geojson-ld#28

I suggest we all go over there and read what was discussed (7 years ago!!!) @dr-shorthair even makes an appearance.

And it continues here: geojson/geojson-ld#31

... and, it's dead.

@lieberjosh
Copy link

lieberjosh commented Feb 27, 2018 via email

@dblodgett-usgs
Copy link
Contributor Author

I've implemented a suite of solutions to this now.

  1. schema:GeoShape is implemented attempting to follow the existing guidance from schema.org as described above.
  2. a schema:url is included with schema:GeoShape -- it is currently just a link to geojson content, but I think the url could be an endpoint that supported coneg access to various flavors of the geometry? Since GeoShape is a type of Thing, giving it a url property that goes to the "URL of the item" just kinda makes sense?
  3. a gsp:hasGeometry WKT literal for good measure. -- note on this that we are still missing gsp in the ELFIE contexts, but I think @abhritchie is going to back fill that into elf-index.json?

So the relevant section of a json-ld looks like: (lots of coordinates dropped)

 "geo": [
  {
   "@type": "schema:GeoCoordinates",
   "schema:latitude": 43.2114,
   "schema:longitude": -89.521
  },
  {
   "@type": "schema:GeoShape",
   "schema:url": "https://opengeospatial.github.io/ELFIE/usgs/hucboundary/huc12obs/070900020601.geojson",
   "schema:polygon": "-89.42488760601 43.216595418436 -89.4252467539262 43.2168434934356 -89.4257269883004 ... -89.42488760601 43.216595418436"
  }
 ],
 "gsp:hasGeometry": {
  "@type": "gsp:Geometry",
  "gsp:asWKT": "MULTIPOLYGON (((-89.42489 43.2166, -89.42525 43.21684, -89.42573 43.21715, ... -89.42532 43.21637, -89.42489 43.2166)))"
 }

side note -- for multilinestring, I used a convex hull instead of trying to choose one line for the GeoShape but the WKT represents it fine. I also dropped any holes from the GeoShape. I think this is in the spirit of the schema:GeoShape being a preview and the gsp:hasGeometry being a more rigorous representation. Maybe the schema:url, which has a richer description of the feature is the solution to "where's the geometry" of a schema:GeoShape?

@jkreft-usgs
Copy link
Contributor

I think this is a totally solid final approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants