New viewer [#49] (#549)

app: Rewrite of PMTiles viewer (pmtiles.io) [#49, #551, #555, #556]

* Rewrite the app using SolidJS / Tailwind.
* Make the map view mobile friendly.
* Add an archive inspector for viewing the low level structure of PMTiles.
* Add a tile inspector for viewing a single tile in isolation. 
* Support TileJSON.
* Support raster archives.
This commit is contained in:
Brandon Liu
2025-04-22 11:05:19 +08:00
committed by GitHub
parent c9b7f73f28
commit 731f03d325
34 changed files with 4786 additions and 4032 deletions

47
app/src/FeatureTable.tsx Normal file
View File

@@ -0,0 +1,47 @@
import { For } from "solid-js";
export interface InspectableFeature {
layerName: string;
type: number;
id: number;
properties: { [key: string]: string | number | boolean };
}
const intToGeomType = (n: number) => {
if (n === 1) return "Point";
if (n === 2) return "LineString";
return "Polygon";
};
export const FeatureTable = (props: { features: InspectableFeature[] }) => {
return (
<div class="max-h-120 overflow-y-scroll divide-y app-divide">
<For each={props.features}>
{(f) => (
<div class="p-2">
<div>
{f.layerName} {intToGeomType(f.type)}
</div>
<div class="text-xs font-mono app-text-light">ID {f.id}</div>
<table class="font-mono table-auto border-separate border-spacing-x-2">
<tbody>
<For each={Object.entries(f.properties)}>
{([key, value]) => (
<tr>
<td class="text-right app-text-light">{key}</td>
<td>
{typeof value === "boolean"
? JSON.stringify(value)
: value.toString()}
</td>
</tr>
)}
</For>
</tbody>
</table>
</div>
)}
</For>
</div>
);
};