Skip to content

Commit

Permalink
[Fixes #9500] OWS Url wrong for INDEXED Remote Services (#9501)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Jun 10, 2022
1 parent 08453bb commit af1e111
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions geonode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,11 +2021,15 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
logger.debug(" -- Resource Links[Thumbnail link]...done!")

logger.debug(" -- Resource Links[OWS Links]...")
# ogc_wms_path = '%s/ows' % instance.workspace
ogc_wms_path = 'ows'
ogc_wms_url = urljoin(ogc_server_settings.public_url, ogc_wms_path)
try:
ogc_wms_url = instance.ows_url
except Exception:
ogc_wms_url = None
if not ogc_wms_url:
ogc_wms_path = 'ows'
ogc_wms_url = urljoin(ogc_server_settings.public_url, ogc_wms_path)
ogc_wms_name = f'OGC WMS: {instance.workspace} Service'
if Link.objects.filter(resource=instance.resourcebase_ptr, name=ogc_wms_name, url=ogc_wms_url).count() < 2:
if not Link.objects.filter(resource=instance.resourcebase_ptr, link_type='OGC:WMS').exists():
Link.objects.get_or_create(
resource=instance.resourcebase_ptr,
url=ogc_wms_url,
Expand All @@ -2039,11 +2043,15 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
)

if instance.storeType == "dataStore":
# ogc_wfs_path = '%s/wfs' % instance.workspace
ogc_wfs_path = 'ows'
ogc_wfs_url = urljoin(ogc_server_settings.public_url, ogc_wfs_path)
try:
ogc_wfs_url = instance.ows_url
except Exception:
ogc_wfs_url = None
if not ogc_wfs_url:
ogc_wfs_path = 'ows'
ogc_wfs_url = urljoin(ogc_server_settings.public_url, ogc_wfs_path)
ogc_wfs_name = f'OGC WFS: {instance.workspace} Service'
if Link.objects.filter(resource=instance.resourcebase_ptr, name=ogc_wfs_name, url=ogc_wfs_url).count() < 2:
if not Link.objects.filter(resource=instance.resourcebase_ptr, link_type='OGC:WFS').exists():
Link.objects.get_or_create(
resource=instance.resourcebase_ptr,
url=ogc_wfs_url,
Expand All @@ -2057,11 +2065,15 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
)

if instance.storeType == "coverageStore":
# ogc_wcs_path = '%s/wcs' % instance.workspace
ogc_wcs_path = 'ows'
ogc_wcs_url = urljoin(ogc_server_settings.public_url, ogc_wcs_path)
try:
ogc_wcs_url = instance.ows_url
except Exception:
ogc_wcs_url = None
if not ogc_wcs_url:
ogc_wcs_path = 'ows'
ogc_wcs_url = urljoin(ogc_server_settings.public_url, ogc_wcs_path)
ogc_wcs_name = f'OGC WCS: {instance.workspace} Service'
if Link.objects.filter(resource=instance.resourcebase_ptr, name=ogc_wcs_name, url=ogc_wcs_url).count() < 2:
if not Link.objects.filter(resource=instance.resourcebase_ptr, link_type='OGC:WCS').exists():
Link.objects.get_or_create(
resource=instance.resourcebase_ptr,
url=ogc_wcs_url,
Expand Down

0 comments on commit af1e111

Please sign in to comment.