Skip to content

Instantly share code, notes, and snippets.

@fils
Created June 1, 2020 20:42
Show Gist options
  • Save fils/5899894e5d5783f8da0f92043a97badd to your computer and use it in GitHub Desktop.
Save fils/5899894e5d5783f8da0f92043a97badd to your computer and use it in GitHub Desktop.
Represent 4 ways to represent spatial in JSON-LD
Display the source blob
Display the rendered blob
Raw
{
"@context": {
"@version": 1.1,
"geoblob": {
"@id": "http://example.com/vocab/json",
"@type": "@json"
},
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"description": "http://igsn.org/core/v1/description",
"geosparql": "http://www.opengis.net/ont/geosparql#",
"schema": "https://schema.org/"
},
"@id": "https://samples.earth/id/do/bqs2dn2u6s73o70jdup0",
"@type": "http://igsn.org/core/v1/Sample",
"description": "A fake ID for testing",
"schema:subjectOf": [
{
"schema:url": "https://samples.earth/id/do/bqs2dn2u6s73o70jdup0.geojson",
"@type": "schema:DigitalDocument",
"schema:format": [
"application/vnd.geo+json"
],
"schema:conformsTo": "https://igsn.org/schema/spatial.schema.json"
}
],
"geosparql:hasGeometry": {
"@id": "_:N98e75cacc29f40deb555eb583cb162dc",
"@type": "http://www.opengis.net/ont/sf#Point",
"geosparql:asWKT": {
"@type": "http://www.opengis.net/ont/geosparql#wktLiteral",
"@value": "POINT(-76 -18)"
},
"geosparql:crs": {
"@id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
}
},
"geoblob": {
"type": "GeometryCollection",
"geometries": [{
"type": "Point",
"coordinates": [-76, -18]
}]
},
"schema:spatialCoverage": {
"@type": "schema:Place",
"schema:geo": {
"@type": "schema:GeoCoordinates",
"schema:latitude": -18,
"schema:longitude": -76
}
}
}
@smrgeoinfo
Copy link

Here's s slight revision of the code. Adds a dcat:conformsTo link to a profile specification for conventions on how the "http://igsn.org/core/v1/Sample" type is actually implemented in this doc. Use rdfs label and description since they are more general than the schema.org entities. Uses schema:about to link to a JSON doc with sample location. Invent a local namespace 'igsn' for the sample description profile, and an igsn:sampleLocation property of core/sample, whose value is an array of different representations of the sample location. Note the example doesn't handle the vertical extent of the core sample. the Geoblob keys need a namespace don't they?

{
    "@context": {
        "@version": 1.1,
        "geoblob": {
            "@id": "http://example.com/vocab/json",
            "@type": "@json"
        },
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "geosparql": "http://www.opengis.net/ont/geosparql#",
        "schema": "https://schema.org/",
		"igsn" : "http://igsn.org/core/v1/"
    },
    "@id": "https://samples.earth/id/do/bqs2dn2u6s73o70jdup0",
    "@type": "http://igsn.org/core/v1/Sample",
    "dcat:conformsTo": <URI for core sample description conventions>,  
    "rdfs:label": "BoreholeCoreID",
    "rdfs:description": "This is a representation of physical core sample from somewhere on Earth",
    "schema:about": 
		{
            "schema:url": "https://samples.earth/id/do/bqs2dn2u6s73o70jdup0.geojson",
            "@type": "schema:DigitalDocument",
            "schema:format": [
                "application/vnd.geo+json"
            ],
            "schema:conformsTo": "https://igsn.org/schema/spatial.schema.json"
        },	
	"igsn:SampleLocation": [
		"geosparql:hasGeometry": {
			"@id": "_:N98e75cacc29f40deb555eb583cb162dc",
			"@type": "http://www.opengis.net/ont/sf#Point",
			"geosparql:asWKT": {
				"@type": "http://www.opengis.net/ont/geosparql#wktLiteral",
				"@value": "POINT(-76 -18)"
			},
			"geosparql:crs": {
				"@id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
			}
		},
		"geoblob": {
			"type": "GeometryCollection",
			"geometries": [{
				"type": "Point",
				"coordinates": [-76, -18]
			}]
		},
		"schema:location": {
			"@type": "schema:Place",
			"schema:geo": {
			  "@type": "schema:GeoCoordinates",
			  "schema:latitude": -18,
			  "schema:longitude": -76
			}
		}
	]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment