diff --git a/src/components/Datasets/VientianeLanduse/index.stories.ts b/src/components/Datasets/VientianeLanduse/index.stories.ts new file mode 100644 index 0000000..569ccef --- /dev/null +++ b/src/components/Datasets/VientianeLanduse/index.stories.ts @@ -0,0 +1,14 @@ +import { Meta, StoryObj } from "@storybook/react"; +import { VientianeLanduseMap } from "."; + +const meta = { + component: VientianeLanduseMap, + parameters: { + layout: "fullscreen", + }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Preview: Story = {}; diff --git a/src/components/Datasets/VientianeLanduse/index.tsx b/src/components/Datasets/VientianeLanduse/index.tsx new file mode 100644 index 0000000..953966e --- /dev/null +++ b/src/components/Datasets/VientianeLanduse/index.tsx @@ -0,0 +1,37 @@ +import { Protocol } from "pmtiles"; +import maplibregl from "maplibre-gl"; +import "maplibre-gl/dist/maplibre-gl.css"; +import { Layer, Map, Source } from "react-map-gl/maplibre"; +import { useEffect } from "react"; +import { VientianeLandusePMTilesSource as source } from "../../Datasets/VientianeLanduse/source"; + +export const VientianeLanduseMap: React.FC = () => { + useEffect(() => { + const protocol = new Protocol(); + maplibregl.addProtocol("pmtiles", protocol.tile); + return () => { + maplibregl.removeProtocol("pmtiles"); + }; + }, []); + + return ( + + + {source.layers?.map((layer) => ( + + ))} + + + ); +};