Skip to content

Commit b376e21

Browse files
committed
fixed ogc api features page
1 parent 11b1052 commit b376e21

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

src/sparqlunicorn_ontdoc/export/api/ogcapifeaturesexporter.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
3838
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
3939
"description": {"type": "string", "xml": {"name": "Description",
4040
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
41-
"links": {"type": "array", "xml": {"name": "link",
42-
"namespace": "http://www.w3.org/2005/Atom"},
41+
"links": {"type": "array", "xml": {"name": "link","namespace": "http://www.w3.org/2005/Atom"},
4342
"items": {"$ref": "#/components/schemas/Link"}},
4443
"extent": {"$ref": "#/components/schemas/Extent"},
4544
"itemType": {"type": "string"},
4645
"crs": {"type": "array", "items": {"type": "string"}},
4746
"storageCrs": {"type": "string"}}, "xml": {"name": "Collection",
4847
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
4948
"Collections": {"type": "object", "properties": {
50-
"links": {"type": "array", "xml": {"name": "link",
51-
"namespace": "http://www.w3.org/2005/Atom"},
49+
"links": {"type": "array", "xml": {"name": "link","namespace": "http://www.w3.org/2005/Atom"},
5250
"items": {"$ref": "#/components/schemas/Link"}},
5351
"collections": {"type": "array", "xml": {"name": "Collection",
5452
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"},
@@ -66,25 +64,20 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
6664
"rel": {"type": "string", "xml": {"attribute": True}},
6765
"type": {"type": "string", "xml": {"attribute": True}},
6866
"title": {"type": "string", "xml": {"attribute": True}}},
69-
"xml": {"name": "link",
70-
"namespace": "http://www.w3.org/2005/Atom"}},
67+
"xml": {"name": "link","namespace": "http://www.w3.org/2005/Atom"}},
7168
"Spatial": {"type": "object", "properties": {"bbox": {"type": "array",
7269
"items": {
7370
"type": "array",
7471
"items": {
7572
"type": "number",
7673
"format": "double"}}},
7774
"crs": {"type": "string",
78-
"xml": {
79-
"attribute": True}}},
80-
"xml": {"name": "SpatialExtent",
81-
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
75+
"xml": {"attribute": True}}},
76+
"xml": {"name": "SpatialExtent","namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
8277
"Temporal": {"type": "object", "properties": {
83-
"interval": {"type": "array",
84-
"items": {"type": "string", "format": "date-time"}},
78+
"interval": {"type": "array","items": {"type": "string", "format": "date-time"}},
8579
"trs": {"type": "string", "xml": {"attribute": True}}},
86-
"xml": {"name": "TemporalExtent",
87-
"namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
80+
"xml": {"name": "TemporalExtent","namespace": "http://www.opengis.net/ogcapi-features-1/1.0"}},
8881
"LandingPage": {"type": "object"}}}
8982
landingpagejson = {"title": "Landing Page", "description": "Landing Page", "links": [{
9083
"href": str(deploypath) + "/index.json",
@@ -132,7 +125,7 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
132125
"title": "this document as JSON"},
133126
{"href": outpath + "collections/index.html", "rel": "self", "type": "text/html",
134127
"title": "this document as HTML"}]}
135-
collectionshtml = "<html><head></head><body><header><h1>Collections of " + str(
128+
collectionshtml = "<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /></head><body><header><h1>Collections of " + str(
136129
deploypath) + "</h1></head>{{collectiontable}}<footer><a href=\"index.json\">This page as JSON</a></footer></body></html>"
137130
collectiontable = "<table><thead><th>Collection</th><th>Links</th></thead><tbody>"
138131
apijson["paths"]["/collections"] = {"get": {"tags": ["Collections"], "summary": "describes collections",
@@ -180,8 +173,7 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
180173
{"href": str(opweb.replace(".geojson", "") + "/index.ttl").replace("//", "/"),
181174
"rel": "collection", "type": "text/ttl", "title": "Collection as TTL"}]})
182175
currentcollection = {"title": featurecollectionspaths[coll]["name"],
183-
"id": coll.replace(outpath, "").replace("index.geojson", "").replace(".geojson",
184-
"")[1:],
176+
"id": coll.replace(outpath, "").replace("index.geojson", "").replace(".geojson","")[1:],
185177
"links": [], "itemType": "feature"}
186178
currentcollection["links"] = [
187179
{"href": opwebcoll + "/items/index.json", "rel": "items", "type": "application/json",
@@ -208,8 +200,7 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
208200
"/"), "operationId": "collection-" + str(
209201
coll.replace(outpath, "").replace("index.geojson", "").replace(".geojson", "")[1:]),
210202
"parameters": [], "responses": {"default": {"description": "default response", "content": {
211-
"application/json": {"schema": {"$ref": "#/components/schemas/Collections"},
212-
"example": None}}}}}}
203+
"application/json": {"schema": {"$ref": "#/components/schemas/Collections"},"example": None}}}}}}
213204
curcollrow = "<tr><td><a href=\"" + opweb.replace(".geojson", "") + "/items/indexc.html\">" + str(
214205
featurecollectionspaths[coll]["name"]) + "</a></td><td><a href=\"" + opweb.replace(".geojson",
215206
"") + "/items/indexc.html\">[Collection as HTML]</a>&nbsp;<a href=\"" + opweb.replace(
@@ -219,7 +210,7 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
219210
f.write(json.dumps(currentcollection))
220211
f.close()
221212
f = open(op + "indexc.html", "w", encoding="utf-8")
222-
f.write("<html><head></head><body><h1>" + featurecollectionspaths[coll][
213+
f.write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /></head><body><h1>" + featurecollectionspaths[coll][
223214
"name"] + "</h1><table><thead><tr><th>Collection</th><th>Links</th></tr></thead><tbody>" + str(
224215
curcollrow) + "</tbody></table></html>")
225216
f.close()
@@ -350,7 +341,7 @@ def generateOGCAPIFeaturesPages(outpath,deploypath, featurecollectionspaths, pre
350341
print(e)
351342
if mergeJSON:
352343
result.append(curcoll)
353-
collectiontable += "</tbody></table>"
344+
collectiontable += "</tbody></table>"
354345
if mergeJSON:
355346
with open(outpath + "/features.js", 'w', encoding="utf-8") as output_file:
356347
output_file.write("var featurecolls=" + json.dumps(result))

0 commit comments

Comments
 (0)