From a620c11c0f2249542e697d27687580a8941fe96c Mon Sep 17 00:00:00 2001 From: afabiani Date: Thu, 24 Nov 2016 18:24:17 +0100 Subject: [PATCH] (Issue 2720) - Incomplete OGC:WMS Download Link for Catalog (Issue 2720) - Incomplete OGC:WMS Download Link for Catalog --- geonode/base/models.py | 10 +++++++++- geonode/tests/csw.py | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/geonode/base/models.py b/geonode/base/models.py index 20102c93280..a1505477984 100755 --- a/geonode/base/models.py +++ b/geonode/base/models.py @@ -599,8 +599,16 @@ def download_links(self): continue if url.link_type == 'html': links.append((self.title, 'Web address (URL)', 'WWW:LINK-1.0-http--link', url.url)) - elif url.link_type in ('OGC:WMS', 'OGC:WFS', 'OGC:WCS'): + elif url.link_type in ('OGC:WFS', 'OGC:WCS'): links.append((self.title, url.name, url.link_type, url.url)) + elif url.link_type in ('OGC:WMS'): + if url.resource.layer: + href = "%s?service=%s&request=GetMap&layers=%s" % (url.url, + url.link_type[-3:], + url.resource.layer.typename) + else: + href = url.url + links.append((self.title, url.name, url.link_type, href)) else: description = '%s (%s Format)' % (self.title, url.name) links.append((self.title, description, 'WWW:DOWNLOAD-1.0-http--download', url.url)) diff --git a/geonode/tests/csw.py b/geonode/tests/csw.py index 8231c2e9773..48161a14f14 100644 --- a/geonode/tests/csw.py +++ b/geonode/tests/csw.py @@ -122,7 +122,9 @@ def test_csw_outputschema_dc(self): for link in record.references: if link['scheme'] == 'OGC:WMS': self.assertEqual(link['url'], - 'http://localhost:8080/geoserver/geonode/wms', + 'http://localhost:8080/geoserver/geonode/wms' + + '?service=WMS&request=GetMap&layers=' + + 'geonode:san_andres_y_providencia_location', 'Expected a specific OGC:WMS URL') elif link['scheme'] == 'OGC:WFS': self.assertEqual(link['url'],