Commit 74dbf6bf authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

KML and SOS were not properly taken into account...

parent 6a66844c
......@@ -81,10 +81,15 @@ def fix_links( links, credentials=None ):
if 'description' in link.keys():
fixed_links[k]['description'] = re.sub(r'\(OGC:WMS\)|\(OGC:WCS\)|\(OGC:WFS\)|\(OGC:SOS\)', '', link['description']).strip()
# # FIX links pointing to external websites
# #logging.debug(link)
# if (link['protocol'] == 'WWW-LINK' and link['content-type'] == 'WWW:LINK'):
# fixed_links[k]['protocol'] = 'HTML'
# KML
if 'protocol' in link.keys() and link['protocol'] == "application/vnd.google-earth.kml+xml":
fixed_links[k]['protocol'] = 'KML'
continue
# SOS
if 'protocol' in link.keys() and '/sos/' in link['url'].lower():
fixed_links[k]['protocol'] = 'SOS'
continue
# FIX links in which the declared protocol is as bizarre as "WWW:LINK-1.0-http--link"
# The KML protocol needs also to be fixed.
......@@ -127,14 +132,6 @@ def fix_links( links, credentials=None ):
except Exception as e:
logging.debug(e)
# KML
if link['protocol'] == "application/vnd.google-earth.kml+xml":
fixed_links[k]['protocol'] = 'KML'
# SOS
if '/sos/' in link['url'].lower():
fixed_links[k]['protocol'] = 'SOS'
# ...otherwise, we make a guess on the basis of the information carried by the URL
known_formats = ['ecw', 'pdf', 'zip', 'json', 'tif', 'tiff', 'csv']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment