Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3641,7 +3641,7 @@
"download": "تنزيل",
"adding": "جارٍ إضافة {{asset}}…",
"added": "تمت إضافة {{asset}} إلى الخريطة.",
"addUnsupported": "يمكن إضافة أصول GeoTIFF/COG وGeoJSON وPMTiles فقط إلى الخريطة",
"addUnsupported": "يمكن إضافة أصول GeoTIFF/COG وGeoJSON وGeoParquet وPMTiles فقط إلى الخريطة",
"addFailed": "تعذّرت إضافة الأصل",
"addNoSourceLayers": "لا يسرد هذا الأرشيف أي طبقات لرسمها",
"cogUnsupported": "لا يستطيع مضيف GeoLibre هذا عرض أصول GeoTIFF البعيدة",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Herunterladen",
"adding": "{{asset}} wird hinzugefügt…",
"added": "{{asset}} zur Karte hinzugefügt.",
"addUnsupported": "Nur GeoTIFF/COG-, GeoJSON- und PMTiles-Assets können zur Karte hinzugefügt werden",
"addUnsupported": "Nur GeoTIFF/COG-, GeoJSON-, GeoParquet- und PMTiles-Assets können zur Karte hinzugefügt werden",
"addFailed": "Asset konnte nicht hinzugefügt werden",
"addNoSourceLayers": "Dieses Archiv führt keine zeichenbaren Ebenen auf",
"cogUnsupported": "Dieser GeoLibre-Host kann entfernte GeoTIFF-Assets nicht darstellen",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3428,7 +3428,7 @@
"download": "Download",
"adding": "Adding {{asset}}…",
"added": "Added {{asset}} to the map.",
"addUnsupported": "Only GeoTIFF/COG, GeoJSON, and PMTiles assets can be added to the map",
"addUnsupported": "Only GeoTIFF/COG, GeoJSON, GeoParquet, and PMTiles assets can be added to the map",
"addFailed": "Could not add asset",
"addNoSourceLayers": "This archive lists no layers to draw",
"cogUnsupported": "This GeoLibre host cannot visualize remote GeoTIFF assets",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Descargar",
"adding": "Añadiendo {{asset}}…",
"added": "{{asset}} añadido al mapa.",
"addUnsupported": "Solo se pueden añadir al mapa recursos GeoTIFF/COG, GeoJSON y PMTiles",
"addUnsupported": "Solo se pueden añadir al mapa recursos GeoTIFF/COG, GeoJSON, GeoParquet y PMTiles",
"addFailed": "No se pudo añadir el recurso",
"addNoSourceLayers": "Este archivo no incluye capas que dibujar",
"cogUnsupported": "Este host de GeoLibre no puede visualizar recursos GeoTIFF remotos",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "دانلود",
"adding": "در حال افزودن {{asset}}…",
"added": "{{asset}} به نقشه افزوده شد.",
"addUnsupported": "تنها دارایی‌های GeoTIFF/COG، GeoJSON و PMTiles را می‌توان به نقشه افزود",
"addUnsupported": "تنها دارایی‌های GeoTIFF/COG، GeoJSON، GeoParquet و PMTiles را می‌توان به نقشه افزود",
"addFailed": "افزودن دارایی با شکست مواجه شد",
"addNoSourceLayers": "این بایگانی هیچ لایه‌ای برای ترسیم فهرست نکرده است",
"cogUnsupported": "این میزبان GeoLibre نمی‌تواند دارایی‌های GeoTIFF دوردست را نمایش دهد",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Télécharger",
"adding": "Ajout de {{asset}}…",
"added": "{{asset}} ajouté à la carte.",
"addUnsupported": "Seules les ressources GeoTIFF/COG, GeoJSON et PMTiles peuvent être ajoutées à la carte",
"addUnsupported": "Seules les ressources GeoTIFF/COG, GeoJSON, GeoParquet et PMTiles peuvent être ajoutées à la carte",
"addFailed": "Impossible d'ajouter la ressource",
"addNoSourceLayers": "Cette archive ne répertorie aucune couche à dessiner",
"cogUnsupported": "Cet hôte GeoLibre ne peut pas visualiser les ressources GeoTIFF distantes",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "डाउनलोड करें",
"adding": "{{asset}} जोड़ा जा रहा है…",
"added": "{{asset}} मानचित्र में जोड़ा गया।",
"addUnsupported": "मानचित्र में केवल GeoTIFF/COG, GeoJSON और PMTiles एसेट जोड़ी जा सकती हैं",
"addUnsupported": "मानचित्र में केवल GeoTIFF/COG, GeoJSON, GeoParquet और PMTiles एसेट जोड़ी जा सकती हैं",
"addFailed": "एसेट नहीं जोड़ी जा सकी",
"addNoSourceLayers": "इस संग्रह में बनाने के लिए कोई लेयर सूचीबद्ध नहीं है",
"cogUnsupported": "यह GeoLibre होस्ट दूरस्थ GeoTIFF एसेट प्रदर्शित नहीं कर सकता",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
"download": "Unduh",
"adding": "Menambahkan {{asset}}…",
"added": "{{asset}} ditambahkan ke peta.",
"addUnsupported": "Hanya aset GeoTIFF/COG, GeoJSON, dan PMTiles yang dapat ditambahkan ke peta",
"addUnsupported": "Hanya aset GeoTIFF/COG, GeoJSON, GeoParquet, dan PMTiles yang dapat ditambahkan ke peta",
"addFailed": "Tidak dapat menambahkan aset",
"addNoSourceLayers": "Arsip ini tidak mencantumkan lapisan untuk digambar",
"cogUnsupported": "Host GeoLibre ini tidak dapat memvisualisasikan aset GeoTIFF jarak jauh",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Scarica",
"adding": "Aggiunta di {{asset}}…",
"added": "{{asset}} aggiunto alla mappa.",
"addUnsupported": "Solo le risorse GeoTIFF/COG, GeoJSON e PMTiles possono essere aggiunte alla mappa",
"addUnsupported": "Solo le risorse GeoTIFF/COG, GeoJSON, GeoParquet e PMTiles possono essere aggiunte alla mappa",
"addFailed": "Impossibile aggiungere la risorsa",
"addNoSourceLayers": "Questo archivio non elenca livelli da disegnare",
"cogUnsupported": "Questo host GeoLibre non può visualizzare risorse GeoTIFF remote",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
"download": "ダウンロード",
"adding": "{{asset}} を追加しています…",
"added": "{{asset}} を地図に追加しました。",
"addUnsupported": "地図に追加できるのは GeoTIFF/COG、GeoJSON、PMTiles のアセットのみです",
"addUnsupported": "地図に追加できるのは GeoTIFF/COG、GeoJSON、GeoParquet、PMTiles のアセットのみです",
"addFailed": "アセットを追加できませんでした",
"addNoSourceLayers": "このアーカイブには描画できるレイヤーがありません",
"cogUnsupported": "この GeoLibre ホストはリモートの GeoTIFF アセットを表示できません",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/ka.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "ჩამოტვირთვა",
"adding": "მიმდინარეობს {{asset}}-ის დამატება…",
"added": "{{asset}} დაემატა რუკაზე.",
"addUnsupported": "რუკაზე შეიძლება დაემატოს მხოლოდ GeoTIFF/COG, GeoJSON და PMTiles აქტივები",
"addUnsupported": "რუკაზე შეიძლება დაემატოს მხოლოდ GeoTIFF/COG, GeoJSON, GeoParquet და PMTiles აქტივები",
"addFailed": "აქტივის დამატება ვერ მოხერხდა",
"addNoSourceLayers": "ეს არქივი არ შეიცავს დასახატ ფენებს",
"cogUnsupported": "ამ GeoLibre ჰოსტს არ შეუძლია დისტანციური GeoTIFF აქტივების ვიზუალიზაცია",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
"download": "다운로드",
"adding": "{{asset}} 추가 중…",
"added": "{{asset}}을(를) 지도에 추가했습니다.",
"addUnsupported": "GeoTIFF/COG, GeoJSON 및 PMTiles 자산만 지도에 추가할 수 있습니다",
"addUnsupported": "GeoTIFF/COG, GeoJSON, GeoParquet 및 PMTiles 자산만 지도에 추가할 수 있습니다",
"addFailed": "자산을 추가하지 못했습니다",
"addNoSourceLayers": "이 아카이브에는 그릴 레이어가 없습니다",
"cogUnsupported": "이 GeoLibre 호스트는 원격 GeoTIFF 자산을 표시할 수 없습니다",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Downloaden",
"adding": "{{asset}} wordt toegevoegd…",
"added": "{{asset}} toegevoegd aan de kaart.",
"addUnsupported": "Alleen GeoTIFF/COG-, GeoJSON- en PMTiles-assets kunnen aan de kaart worden toegevoegd",
"addUnsupported": "Alleen GeoTIFF/COG-, GeoJSON-, GeoParquet- en PMTiles-assets kunnen aan de kaart worden toegevoegd",
"addFailed": "Kan asset niet toevoegen",
"addNoSourceLayers": "Dit archief bevat geen tekenbare lagen",
"cogUnsupported": "Deze GeoLibre-host kan externe GeoTIFF-assets niet weergeven",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "Baixar",
"adding": "Adicionando {{asset}}…",
"added": "{{asset}} adicionado ao mapa.",
"addUnsupported": "Apenas recursos GeoTIFF/COG, GeoJSON e PMTiles podem ser adicionados ao mapa",
"addUnsupported": "Apenas recursos GeoTIFF/COG, GeoJSON, GeoParquet e PMTiles podem ser adicionados ao mapa",
"addFailed": "Não foi possível adicionar o recurso",
"addNoSourceLayers": "Este arquivo não lista camadas para desenhar",
"cogUnsupported": "Este host do GeoLibre não consegue visualizar recursos GeoTIFF remotos",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3530,7 +3530,7 @@
"download": "Скачать",
"adding": "Добавление {{asset}}…",
"added": "{{asset}} добавлен на карту.",
"addUnsupported": "На карту можно добавить только ресурсы GeoTIFF/COG, GeoJSON и PMTiles",
"addUnsupported": "На карту можно добавить только ресурсы GeoTIFF/COG, GeoJSON, GeoParquet и PMTiles",
"addFailed": "Не удалось добавить ресурс",
"addNoSourceLayers": "В этом архиве нет слоёв для отрисовки",
"cogUnsupported": "Этот хост GeoLibre не может отображать удалённые ресурсы GeoTIFF",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
"download": "ดาวน์โหลด",
"adding": "กำลังเพิ่ม {{asset}}…",
"added": "เพิ่ม {{asset}} ลงในแผนที่แล้ว",
"addUnsupported": "เพิ่มลงแผนที่ได้เฉพาะแอสเซตแบบ GeoTIFF/COG, GeoJSON และ PMTiles เท่านั้น",
"addUnsupported": "เพิ่มลงแผนที่ได้เฉพาะแอสเซตแบบ GeoTIFF/COG, GeoJSON, GeoParquet และ PMTiles เท่านั้น",
"addFailed": "ไม่สามารถเพิ่มแอสเซตได้",
"addNoSourceLayers": "ไฟล์เก็บถาวรนี้ไม่มีเลเยอร์ให้วาด",
"cogUnsupported": "โฮสต์ GeoLibre นี้ไม่สามารถแสดงผลแอสเซต GeoTIFF จากระยะไกลได้",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@
"download": "İndir",
"adding": "{{asset}} ekleniyor…",
"added": "{{asset}} haritaya eklendi.",
"addUnsupported": "Haritaya yalnızca GeoTIFF/COG, GeoJSON ve PMTiles varlıkları eklenebilir",
"addUnsupported": "Haritaya yalnızca GeoTIFF/COG, GeoJSON, GeoParquet ve PMTiles varlıkları eklenebilir",
"addFailed": "Varlık eklenemedi",
"addNoSourceLayers": "Bu arşiv çizilecek katman listelemiyor",
"cogUnsupported": "Bu GeoLibre ana bilgisayarı uzak GeoTIFF varlıklarını görselleştiremiyor",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3349,7 +3349,7 @@
"collectionsHint": "Giữ Ctrl/Cmd để chọn nhiều bộ sưu tập; kéo cạnh dưới để thay đổi kích thước",
"limitToExtent": "Giới hạn tìm kiếm trong phạm vi bản đồ hiện tại",
"bboxLabel": "Hộp giới hạn (tây, nam, đông, bắc)",
"addUnsupported": "Chỉ có thể thêm nội dung GeoTIFF/COG, GeoJSON và PMTiles vào bản đồ",
"addUnsupported": "Chỉ có thể thêm nội dung GeoTIFF/COG, GeoJSON, GeoParquet và PMTiles vào bản đồ",
"addFailed": "Không thể thêm nội dung",
"addNoSourceLayers": "Kho lưu trữ này không liệt kê lớp nào để vẽ",
"cogUnsupported": "Máy chủ GeoLibre này không thể hiển thị nội dung GeoTIFF từ xa",
Expand Down
2 changes: 1 addition & 1 deletion apps/geolibre-desktop/src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@
"download": "下载",
"adding": "正在添加 {{asset}}…",
"added": "已将 {{asset}} 添加到地图。",
"addUnsupported": "只有 GeoTIFF/COG、GeoJSON 和 PMTiles 资源可以添加到地图",
"addUnsupported": "只有 GeoTIFF/COG、GeoJSON、GeoParquet 和 PMTiles 资源可以添加到地图",
"addFailed": "无法添加资源",
"addNoSourceLayers": "此归档未列出可绘制的图层",
"cogUnsupported": "此 GeoLibre 主机无法可视化远程 GeoTIFF 资源",
Expand Down
2 changes: 1 addition & 1 deletion e2e/stac-api-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ test("asset options identify their format and whether they can be added", async
"Red Band — COG",
"Boundaries — GeoJSON",
"Vector tiles — PMTiles",
"Dataset root — Parquet (not addable)",
"Dataset root — Parquet",
"Metadata — Unknown format (not addable)",
]);
});
Expand Down
9 changes: 8 additions & 1 deletion e2e/stac-pmtiles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ test("a PMTiles asset from a STAC item reaches the map", async ({ page }) => {
await collection.dblclick();
await expect(page.getByText(/Showing \d+ of \d+ items\./)).toBeVisible();

// The panel offers the archive rather than the parquet beside it, and Add is live.
// The parquet beside the archive is addable too, and being listed first it is the one the
// panel preselects, so the archive is chosen explicitly rather than taken as the default.
const assets = page
.locator("select")
.filter({ has: page.locator('option[value="pmtiles"]') })
.first();
await assets.selectOption("pmtiles");
Comment thread
giswqs marked this conversation as resolved.

const add = page.getByRole("button", { name: "Add", exact: true }).first();
await expect(add).toBeEnabled();
await add.click();
Expand Down
50 changes: 46 additions & 4 deletions packages/plugins/src/plugins/maplibre-stac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
assetFormat,
connectStac,
horizontalBbox,
isAzureBlobHref,
isVisualizableAsset,
itemBbox,
loadStacIndex,
Expand All @@ -25,6 +26,7 @@ import {
} from "./stac-api";
import { buildCatalogTree } from "./stac-catalog-tree";
import { el, setDisabled } from "../panel-dom";
import { addVectorLayerFromUrl } from "./maplibre-vector";

export const STAC_PLUGIN_ID = "geolibre-stac-catalogs";
const PANEL_ID = STAC_PLUGIN_ID;
Expand Down Expand Up @@ -219,7 +221,8 @@ let labels: StacLabels = {
zoom: "Zoom",
add: "Add",
download: "Download",
addUnsupported: "Only GeoTIFF/COG, GeoJSON, and PMTiles assets can be added to the map",
addUnsupported:
"Only GeoTIFF/COG, GeoJSON, GeoParquet, and PMTiles assets can be added to the map",
addFailed: "Could not add asset",
addNoSourceLayers: "This archive lists no layers to draw",
cogUnsupported: "This GeoLibre host cannot visualize remote GeoTIFF assets",
Expand Down Expand Up @@ -538,6 +541,36 @@ function assetOptionLabel(key: string, asset: StacAsset): string {
return `${assetLabel(key, asset)} — ${assetFormatLabel(asset)}${addability}`;
}

type SasSigner = { signUrl(url: string, collectionId: string): Promise<string> };
let sasManager: Promise<SasSigner> | null = null;

function planetaryComputerSigner(): Promise<SasSigner> {
sasManager ??= import("maplibre-gl-planetary-computer")
.then((module) => new module.SASTokenManager())
.catch((error) => {
// Don't let one failed import disable signing for the rest of the session.
sasManager = null;
throw error;
});
return sasManager;
}

/**
* Planetary Computer serves several collections — most of the GeoParquet ones — from private
* containers that answer 409 without a SAS token, while others (NAIP) read fine anonymously.
* Tokens are per-collection and expire within the hour, so they are minted when the asset is
* added rather than when the item is parsed, and the upstream manager caches them. Anything
* that is not an Azure blob, or that cannot be signed, is read unsigned.
*/
async function readableHref(item: StacItem, href: string): Promise<string> {
if (!isAzureBlobHref(href) || !item.collection) return href;
try {
return await (await planetaryComputerSigner()).signUrl(href, item.collection);
} catch {
return href;
}
}
Comment thread
giswqs marked this conversation as resolved.
Comment thread
giswqs marked this conversation as resolved.

async function visualizeAsset(
item: StacItem,
key: string,
Expand All @@ -547,28 +580,37 @@ async function visualizeAsset(
): Promise<void> {
const name = `${item.id} — ${assetLabel(key, asset)}`;
const format = assetFormat(asset);
const href = await readableHref(item, asset.href);
switch (format) {
case "pmtiles": {
// No appRef check: the layer goes to the store, not through the app API.
if (!(await addPMTilesAsset(asset.href, name, signal))) {
if (!(await addPMTilesAsset(href, name, signal))) {
throw new Error(labels.addNoSourceLayers);
}
return;
}
case "geojson": {
if (!appRef) throw new Error(labels.addFailed);
const response = await fetch(asset.href, {
const response = await fetch(href, {
headers: { Accept: "application/geo+json, application/json" },
signal,
});
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
const data = (await response.json()) as FeatureCollection;
// Provenance keeps the unsigned href so no expiring token is saved into the project.
appRef.addGeoJsonLayer(name, data, asset.href);
return;
}
case "parquet": {
if (!appRef) throw new Error(labels.addFailed);
if (!(await addVectorLayerFromUrl(appRef, href, { name }))) {
throw new Error(labels.addFailed);
}
return;
}
case "cog": {
if (!appRef?.addCogLayer) throw new Error(labels.cogUnsupported);
await appRef.addCogLayer(name, asset.href, cogOptions);
await appRef.addCogLayer(name, href, cogOptions);
return;
Comment thread
giswqs marked this conversation as resolved.
Outdated
}
case null:
Expand Down
Loading
Loading