Modifications

This commit is contained in:
Sam 2024-08-13 20:14:17 +01:00
parent bc41fb2367
commit 42a32637bb
3 changed files with 5 additions and 4 deletions

View File

@ -56,8 +56,5 @@ def download_file(filename):
except FileNotFoundError:
abort(404)
if __name__ == '__main__':
app.run(debug=True)
if __name__ == '__main__':
app.run()

View File

@ -11,7 +11,7 @@ tags: ["QGIS", "SRTM", "DEM", "Raster", "download"]
{{< figure src="/pics/blog/batch-import-postgis-rasters/singapore-final.webp" width="300">}}
Download the Digital Elevation Model featured in [this](/blog/batch-import-postgis-rasters/) blog.
{{< download-data src="http://api.baseddata.io/download/singapore-srtm-dem.tif" name="singapore-srtm-dem.tif" >}}
{{< download-data src="https://api.baseddata.io/download/singapore-srtm-dem.tif" name="singapore-srtm-dem.tif" >}}
#### Citations
NASA Shuttle Radar Topography Mission (SRTM)(2013). Shuttle Radar Topography Mission (SRTM) Global. Distributed by OpenTopography. https://doi.org/10.5069/G9445JDF. Accessed: 2024-08-06

View File

@ -6,6 +6,9 @@
async function downloadFile(url, name) {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const blob = await response.blob();
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
@ -13,6 +16,7 @@
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href); // Clean up the object URL
} catch (error) {
console.error('Error downloading the file:', error);
}