-
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.
- Loading branch information
1 parent
9e9d2b2
commit 76748d3
Showing
8 changed files
with
157 additions
and
57 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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{% extends 'core/base.html' %} | ||
{% load static %} | ||
|
||
{% load static %} | ||
|
||
{% block content %} | ||
<div id="image" style="width:100%; height:800px;"></div> | ||
|
||
<div id="image" style="width:100%; height:400px;"></div> | ||
|
||
<script type="module" src="{% static 'core/dist/cog.js' %}"></script> | ||
|
||
<script type="text/javascript"> | ||
initializeCogViewer('{{ accession.blob.url|safe }}'); | ||
</script> | ||
<script src="{% static 'core/dist/cog.js' %}"></script> | ||
|
||
<script type="text/javascript"> | ||
initializeCogViewer('{{ accession.blob.url|safe }}', | ||
{{ accession.width }}, | ||
{{ accession.height }}); | ||
</script> | ||
{% endblock %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import GeoTIFF from 'ol/source/GeoTIFF.js'; | ||
import Map from 'ol/Map.js'; | ||
import Projection from 'ol/proj/Projection.js'; | ||
import TileLayer from 'ol/layer/WebGLTile.js'; | ||
import View from 'ol/View.js'; | ||
import { getCenter } from 'ol/extent.js'; | ||
|
||
// TODO: figure out how to override getOrigin, see | ||
// https://github.com/geotiffjs/geotiff.js/blob/da936684e30ef994f1d0d1e2da844b0e9a6c3cd0/src/geotiffimage.js#L825. | ||
// This will obviate the need for exif stripping the model transformation tag. | ||
|
||
function initializeCogViewer(url, width, height) { | ||
const extent = [0, 0, width, height]; | ||
|
||
const projection = new Projection({ | ||
code: 'custom', | ||
units: 'pixels', | ||
extent: extent, | ||
}); | ||
|
||
const geotiff = new GeoTIFF({ | ||
sources: [ | ||
{ | ||
url: url, | ||
nodata: 0, | ||
}, | ||
], | ||
}); | ||
|
||
const map = new Map({ | ||
target: 'image', | ||
layers: [ | ||
new TileLayer({ | ||
source: geotiff, | ||
}), | ||
], | ||
view: new View({ | ||
projection: projection, | ||
center: getCenter(extent), | ||
extent: extent, | ||
zoom: 1, | ||
}), | ||
}); | ||
} | ||
|
||
window.initializeCogViewer = initializeCogViewer; |
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