geonode
geonode copied to clipboard
3.3.X - Original Layer / Dataset not offered as Download on layer detail page
Expected Behavior
By default if an original dataset of an layer is available it should generate a download Link in the layer details page below the export button.
Actual Behavior
No Download link is generated even tho it is available and it shows up on the metadata detail page of the layer for example.
Solution
After investigating this a bit further i think it is just a typo... ;)
https://github.com/GeoNode/geonode/blob/3.3.x/geonode/layers/templates/layers/layer_detail.html#L362
Changing {% if link.name == 'Original Dataset' %}
to {% if link.name == 'Original Layer' %}
fixes the issue.
Bonus TIP
The metadata detail page shows the "Original Layer" Link even if it is NOT available.
The simple check if the resource is available from the layers_detail.html
template should be added here as well.
In https://github.com/GeoNode/geonode/blob/3.3.x/geonode/templates/metadata_detail.html
Add {% load proxy_lib_tags %}
at the top.
and replace L450 to L453
{% for link in resource.link_set.download %}
<dt>{{link.name}}</dt>
<dd><a href="{{link.url}}">{{resource.title}}.{{link.extension}}</a></dd>
{% endfor %}
with
{% for link in resource.link_set.download %}
{% if link.name == 'Original Layer' %}
{% original_link_available resource.id link.url as original_dwn_link_available %}
{% if original_dwn_link_available %}
<dt>{{link.name}}</dt>
<dd><a href="{{link.url}}">{{resource.title}}.{{link.extension}}</a></dd>
{% endif %}
{% else %}
<dt>{{link.name}}</dt>
<dd><a href="{{link.url}}">{{resource.title}}.{{link.extension}}</a></dd>
{% endif %}
{% endfor %}
Specifications
- GeoNode version: 3.3.X
- Installation method (docker, geonode-project):
- Platform: ubuntu 20.04, x64