MCPcopy Create free account
hub / github.com/protomaps/PMTiles / ExampleChooser

Function ExampleChooser

app/src/Frame.tsx:14–97  ·  view source on GitHub ↗
(props: {
  setTileset: Setter<Tileset | undefined>;
})

Source from the content-addressed store, hash-verified

12import { GIT_SHA } from "./utils";
13
14export const ExampleChooser = (props: {
15 setTileset: Setter<Tileset | undefined>;
16}) => {
17 const loadSample = (url: string) => {
18 props.setTileset(tilesetFromString(url));
19 };
20
21 const onChangeFileInput = (
22 event: Event & { currentTarget: HTMLInputElement },
23 ) => {
24 const file = event.currentTarget.files?.[0];
25 if (file) {
26 props.setTileset(tilesetFromFile(file));
27 }
28 };
29
30 return (
31 <div class="h-full flex items-center justify-center p-4">
32 <div>
33 <div class="mb-2 app-text-light">Load an example:</div>
34 <div class="app-border divide-y">
35 <button
36 class="block p-2 flex text-left flex-col hover:bg-slate dark:hover:bg-purple w-full cursor-pointer"
37 type="button"
38 onClick={() => {
39 loadSample("https://demo-bucket.protomaps.com/v4.pmtiles");
40 }}
41 >
42 <div>v4.pmtiles</div>
43 <div class="text-xs app-text-light">
44 vector basemap, Protomaps daily build channel (OpenStreetMap data)
45 </div>
46 </button>
47 <button
48 class="block p-2 flex text-left flex-col hover:bg-slate dark:hover:bg-purple w-full cursor-pointer"
49 type="button"
50 onClick={() => {
51 loadSample("https://air.mtn.tw/flowers.pmtiles");
52 }}
53 >
54 <div>flowers.pmtiles</div>
55 <div class="text-xs app-text-light">
56 raster overlay, aerial orthomosaic
57 </div>
58 </button>
59 <button
60 class="block p-2 flex text-left flex-col hover:bg-slate dark:hover:bg-purple w-full cursor-pointer"
61 type="button"
62 onClick={() => {
63 loadSample(
64 "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-04-23/places.pmtiles",
65 );
66 }}
67 >
68 <div>places.pmtiles</div>
69 <div class="text-xs app-text-light">
70 vector overlay, Overture Places, 2025-04-23 release
71 </div>

Callers

nothing calls this directly

Calls 1

loadSampleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…