Skip to content

Commit

Permalink
Do not create image links for tabular data
Browse files Browse the repository at this point in the history
  • Loading branch information
ridoo committed Jun 25, 2024
1 parent 8c9fbe4 commit ec42692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ def set_styles(layer, gs_catalog: Catalog):
layer.default_style,
]
):
if style:
if style and layer.subtype != "tabular":
style_name = os.path.basename(urlparse(style.sld_url).path).split(".")[0]
legend_url = get_legend_url(layer, style_name)
if dataset_legends.filter(resource=layer.resourcebase_ptr, name="Legend", url=legend_url).count() < 2:
Expand Down
7 changes: 4 additions & 3 deletions geonode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
# Set download links for WMS, WCS or WFS and KML
logger.debug(" -- Resource Links[Set download links for WMS, WCS or WFS and KML]...")
instance_ows_url = f"{instance.ows_url}?" if instance.ows_url else f"{ogc_server_settings.public_url}ows?"
links = wms_links(instance_ows_url, instance.alternate, bbox, srid, height, width)
links = wms_links(instance_ows_url, instance.alternate, bbox, srid, height, width) if instance.subtype != "tabular" else []

for ext, name, mime, wms_url in links:
try:
Expand All @@ -1506,7 +1506,7 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
resource=instance.resourcebase_ptr, name=gettext_lazy(name), link_type="image"
).update(**_d)

if instance.subtype == "vector":
if instance.subtype == "vector" or instance.subtype == "tabular":
links = wfs_links(
instance_ows_url,
instance.alternate,
Expand Down Expand Up @@ -1592,7 +1592,7 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
instance.default_style,
]
):
if style:
if style and instance.subtype != "tabular":
style_name = os.path.basename(urlparse(style.sld_url).path).split(".")[0]
legend_url = get_legend_url(instance, style_name)
if Link.objects.filter(resource=instance.resourcebase_ptr, url=legend_url).count() < 2:
Expand Down Expand Up @@ -1650,6 +1650,7 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):
ogc_wms_url = instance.ows_url or urljoin(ogc_server_settings.public_url, "ows")
ogc_wms_name = f"OGC WMS: {instance.workspace} Service"
if (
instance.subtype != "tabular" and
Link.objects.filter(resource=instance.resourcebase_ptr, name=ogc_wms_name, url=ogc_wms_url).count()
< 2
):
Expand Down

0 comments on commit ec42692

Please sign in to comment.