Skip to content

Commit d41492f

Browse files
committed
feat: Simplify download to GeoTIFF-only
- Remove format selector and PNG option - Remove rescale/colormap from API calls - Update downloadApi.js for simplified request - Keep S3 presigned URL download flow
1 parent 52e7b2f commit d41492f

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

src/components/DownloadModal.jsx

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const TURNSTILE_SITE_KEY = import.meta.env.VITE_TURNSTILE_SITE_KEY || '0x4AAAAAA
1212

1313
function DownloadModal({ item, collection, onClose }) {
1414
const [selectedAsset, setSelectedAsset] = useState(null);
15-
const [selectedFormat, setSelectedFormat] = useState('geotiff');
1615
const [isDownloading, setIsDownloading] = useState(false);
1716
const [error, setError] = useState(null);
1817
const [backendAvailable, setBackendAvailable] = useState(null);
@@ -59,9 +58,6 @@ function DownloadModal({ item, collection, onClose }) {
5958
const collectionConfig = getCollection(collection);
6059
const availableBands = collectionConfig ? Object.keys(collectionConfig.bands) : [];
6160

62-
// Check if PNG format is supported for this collection (disable for SAR)
63-
const supportsPNG = collectionConfig?.type !== 'sar';
64-
6561
// Check if downloads are disabled for this collection (SAR files too large)
6662
const downloadsDisabled = collectionConfig?.type === 'sar';
6763

@@ -100,17 +96,14 @@ function DownloadModal({ item, collection, onClose }) {
10096
const bandConfig = collectionConfig.bands[selectedAsset];
10197
const assetKey = bandConfig.assets[0]; // Use first asset for the band
10298

103-
const filename = `${collection}_${item.id}_${assetKey}.${selectedFormat === 'geotiff' ? 'tif' : 'png'}`;
99+
const filename = `${collection}_${item.id}_${assetKey}.tif`;
104100

105101
// Get presigned URL from backend
106102
const response = await downloadTile({
107103
collection: collection,
108104
itemId: item.id,
109105
assetKey: assetKey,
110106
bbox: null, // Full tile download
111-
format: selectedFormat,
112-
rescale: bandConfig.rescale || null,
113-
colormap: bandConfig.colormap || null,
114107
turnstileToken: turnstileToken,
115108
}, filename, controller.signal);
116109

@@ -242,33 +235,10 @@ function DownloadModal({ item, collection, onClose }) {
242235
</div>
243236
</div>
244237

245-
{/* Format selection */}
238+
{/* Format info */}
246239
<div className="download-section">
247-
<h3>Select Format</h3>
248-
{!supportsPNG && (
249-
<div className="format-note">
250-
PNG conversion is disabled for SAR data (slow processing)
251-
</div>
252-
)}
253-
<div className="format-options">
254-
<button
255-
className={`format-option ${selectedFormat === 'geotiff' ? 'selected' : ''}`}
256-
onClick={() => setSelectedFormat('geotiff')}
257-
disabled={isDownloading}
258-
>
259-
<span className="format-name">GeoTIFF</span>
260-
<span className="format-desc">With georeferencing</span>
261-
</button>
262-
{supportsPNG && (
263-
<button
264-
className={`format-option ${selectedFormat === 'png' ? 'selected' : ''}`}
265-
onClick={() => setSelectedFormat('png')}
266-
disabled={isDownloading}
267-
>
268-
<span className="format-name">PNG</span>
269-
<span className="format-desc">Smaller, no geo data</span>
270-
</button>
271-
)}
240+
<div className="format-note">
241+
Downloads are provided as GeoTIFF format with full georeferencing.
272242
</div>
273243
</div>
274244

src/utils/downloadApi.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ export async function getCollectionAssets(collectionId) {
2727
* @param {string} params.itemId - STAC item ID
2828
* @param {string} params.assetKey - Asset/band to download
2929
* @param {Array<number>} [params.bbox] - Bounding box [minLon, minLat, maxLon, maxLat]
30-
* @param {string} params.format - Output format ('geotiff' or 'png')
31-
* @param {string} [params.rescale] - Rescale range for PNG (e.g., '0,4000')
32-
* @param {string} [params.colormap] - Matplotlib colormap name for PNG
30+
* @param {string} params.turnstileToken - Cloudflare Turnstile token
3331
* @param {Function} [onProgress] - Progress callback
3432
* @param {AbortSignal} [signal] - AbortSignal for request cancellation
3533
* @returns {Promise<Object>} Object with download_url and filename
3634
*/
37-
export async function downloadTile({ collection, itemId, assetKey, bbox, format, rescale, colormap, turnstileToken }, onProgress, signal) {
35+
export async function downloadTile({ collection, itemId, assetKey, bbox, turnstileToken }, onProgress, signal) {
3836
const response = await fetch(`${BACKEND_URL}/download`, {
3937
method: 'POST',
4038
headers: {
@@ -45,9 +43,6 @@ export async function downloadTile({ collection, itemId, assetKey, bbox, format,
4543
item_id: itemId,
4644
asset_key: assetKey,
4745
bbox: bbox || null,
48-
format: format,
49-
rescale: rescale || null,
50-
colormap: colormap || null,
5146
turnstile_token: turnstileToken || null,
5247
}),
5348
signal: signal,

0 commit comments

Comments
 (0)