Skip to content

Commit

Permalink
Merge pull request #319 from opengeospatial/20250128
Browse files Browse the repository at this point in the history
Add COG spec element mappings
  • Loading branch information
ghobona authored Jan 28, 2025
2 parents bfdf026 + 545dd9c commit 00585a8
Show file tree
Hide file tree
Showing 3 changed files with 2,460 additions and 0 deletions.
63 changes: 63 additions & 0 deletions specification-elements/code/21-026.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# CQL2

def cleanString(intext):
intext = intext.replace("\"","")
if "</" in intext:
intext = intext[:intext.index("</")]
if intext.startswith("/req/") or intext.startswith("/conf/") or intext.startswith("/rec/") or intext.startswith("/per/") or intext.startswith("/conf/"):
intext = "http://www.opengis.net/spec/cql2/1.0"+intext
return intext

specURL = "https://docs.ogc.org/is/21-026/21-026.html"
fout = open("../mappings/21-026.csv","w") # output file
fin = open("../specifications/21-026.html","r") # input file
elementList = []

# processing the input file

idtoken = ""
readingAnnex = 0

for line in fin:
tokens = line.split()
for token in tokens:
if token.startswith("id=\""):
idtoken = token.replace("id=\"","")
idtoken = idtoken[:idtoken.index("\"")]
print (idtoken)
if "id=\"_abstract_test_suite_normative\"" in token:
readingAnnex = 1
if readingAnnex == 0:
if "/req/" in token:
if "http:" in token:
token = token[token.index("http:"):]
elementList.append(idtoken+","+cleanString(token))
else:
token = token[token.index("/req/"):]
elementList.append(idtoken+","+cleanString(token))
if "/conf/" in token:
if "http:" in token:
token = token[token.index("http:"):]
elementList.append(idtoken+","+cleanString(token))
else:
token = token[token.index("/conf/"):]
elementList.append(idtoken+","+cleanString(token))
if "/rec/" in token:
token = token[token.index("/rec/"):]
elementList.append(idtoken+","+cleanString(token))
if "/per/" in token:
token = token[token.index("/per/"):]
elementList.append(idtoken+","+cleanString(token))
if readingAnnex == 1:
if "/ats/" in token:
token = token[token.index("/conf/"):]
elementList.append(idtoken+","+cleanString(token))
# Handling duplicates

elementList = list(dict.fromkeys(elementList)) # remove duplicates

# Now we write out the output

for e in elementList:
if "example_" not in e:
fout.write(specURL+"#"+e+"\n")
32 changes: 32 additions & 0 deletions specification-elements/mappings/21-026.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
target,source
https://docs.ogc.org/is/21-026/21-026.html#_compression,http://www.opengis.net/spec/cql2/1.0/rec/geotiff-format/rec-compression
https://docs.ogc.org/is/21-026/21-026.html#_media_types_for_any_data_encodings,http://www.opengis.net/spec/cql2/1.0/rec/media-type/media-type
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-format,http://www.opengis.net/spec/COG/1.0/conf/geotiff-format
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-format-basic-metadata-format,http://www.opengis.net/spec/cql2/1.0/req/geotiff-format/use-geotiff
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-format-tiling,http://www.opengis.net/spec/cql2/1.0/conf/geotiff-format/tiling
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-format-tiling,http://www.opengis.net/spec/cql2/1.0/req/geotiff-format/tiling
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-format-use-geotiff,http://www.opengis.net/spec/cql2/1.0/conf/geotiff-format/use-geotiff
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-keys,http://www.opengis.net/spec/COG/1.0/conf/geotiff-keys
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-keys-georeference,http://www.opengis.net/spec/cql2/1.0/conf/geotiff-keys/georeference
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-keys-point-of-origin,http://www.opengis.net/spec/cql2/1.0/conf/geotiff-keys/point-of-origin
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-keys-point-of-origin,http://www.opengis.net/spec/cql2/1.0/req/geotiff-keys/point-of-origin
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-overviews,http://www.opengis.net/spec/COG/1.0/conf/geotiff-overviews
https://docs.ogc.org/is/21-026/21-026.html#ats_geotiff-overviews-overviews,http://www.opengis.net/spec/cql2/1.0/conf/geotiff-overviews/overviews
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-overviews-overviews,http://www.opengis.net/spec/cql2/1.0/req/geotiff-overviews/overviews
https://docs.ogc.org/is/21-026/21-026.html#ats_http-range,http://www.opengis.net/spec/COG/1.0/conf/http-range
https://docs.ogc.org/is/21-026/21-026.html#ats_http-range-https-headers,http://www.opengis.net/spec/cql2/1.0/conf/http-range/https-headers
https://docs.ogc.org/is/21-026/21-026.html#req_http-range-https-headers,http://www.opengis.net/spec/cql2/1.0/req/http-range/https-headers
https://docs.ogc.org/is/21-026/21-026.html#ats_http-range-use-range,http://www.opengis.net/spec/cql2/1.0/conf/http-range/use-range
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-format,http://www.opengis.net/spec/COG/1.0/req/geotiff-format
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-format-use-geotiff,http://www.opengis.net/spec/cql2/1.0/req/geotiff-format/use-geotiff
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-keys,http://www.opengis.net/spec/COG/1.0/req/geotiff-keys
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-keys-basic-metadata-format,http://www.opengis.net/spec/cql2/1.0/req/geotiff-keys/basic-metadata-format
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-keys-georeference,http://www.opengis.net/spec/cql2/1.0/req/geotiff-keys/georeference
https://docs.ogc.org/is/21-026/21-026.html#req_geotiff-overviews,http://www.opengis.net/spec/COG/1.0/req/geotiff-overviews
https://docs.ogc.org/is/21-026/21-026.html#geotiff-format-requirements-class,http://www.opengis.net/spec/COG/1.0/req/geotiff-format
https://docs.ogc.org/is/21-026/21-026.html#req_http-range,http://www.opengis.net/spec/COG/1.0/req/http-range
https://docs.ogc.org/is/21-026/21-026.html#req_http-range-use-range,http://www.opengis.net/spec/cql2/1.0/req/http-range/range
https://docs.ogc.org/is/21-026/21-026.html#req_optimized_geotiff,http://www.opengis.net/spec/COG/1.0/req/optimized_geotiff
https://docs.ogc.org/is/21-026/21-026.html#req_optimized-geotiff-geotiff,http://www.opengis.net/spec/cql2/1.0/req/optimized_geotiff/geotiff
https://docs.ogc.org/is/21-026/21-026.html#req_optimized-geotiff-number,http://www.opengis.net/spec/cql2/1.0/req/optimized_geotiff/number
https://docs.ogc.org/is/21-026/21-026.html#req_optimized-geotiff-small-size,http://www.opengis.net/spec/cql2/1.0/req/optimized_geotiff/small-sizes
Loading

0 comments on commit 00585a8

Please sign in to comment.