-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nyudlts/geotiff-geoserver
Adds GeoTIFF previews via GeoServer
- Loading branch information
Showing
5 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
invenio_previewer_geospatial/extensions/geotiff_geoserver.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""GeoTIFF previews via GeoServer.""" | ||
|
||
from flask import current_app, render_template | ||
from invenio_previewer.proxies import current_previewer | ||
from invenio_previewer.utils import dotted_exts | ||
|
||
previewable_extensions = ["tif", "tiff", "gtiff"] | ||
|
||
|
||
def can_preview(file): | ||
"""Check if file can be previewed.""" | ||
return file.is_local() and file.has_extensions(*dotted_exts(previewable_extensions)) | ||
|
||
|
||
def preview(file): | ||
"""Render the Geoserver template.""" | ||
return render_template( | ||
"invenio_previewer_geospatial/geoserver.html", | ||
record=file.record, | ||
wms_url_field=( | ||
current_app.config.get( | ||
"PREVIEWER_GEOSPATIAL_CUSTOM_FIELDS_GEOSERVER_WMS_URL" | ||
) | ||
), | ||
layer_name_field=( | ||
current_app.config.get( | ||
"PREVIEWER_GEOSPATIAL_CUSTOM_FIELDS_GEOSERVER_LAYER_NAME" | ||
) | ||
), | ||
js_bundles=current_previewer.js_bundles + ["geoserver_js.js"], | ||
css_bundles=current_previewer.css_bundles + ["geoserver_css.css"], | ||
) |
6 changes: 3 additions & 3 deletions
6
...viewer_geospatial/extensions/geoserver.py → ...spatial/extensions/shapefile_geoserver.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters