Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenCellId for example of preview of BaseData #76

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"arcgis",
"arcgisonline",
"BODC",
"cellid",
"clearmap",
"cyberjapandata",
"DAAC",
Expand Down
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"maplibre-gl": "^4.4.0",
"pmtiles": "^3.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-map-gl": "^7.1.7"
Expand Down
20 changes: 20 additions & 0 deletions public/stylejson/opencellid.org/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 8,
"sources": {
"opencellid": {
"type": "vector",
"url": "pmtiles://https://data.source.coop/smartmaps/opencellid/cellid.pmtiles",
"attribution": "<a href=\"https://opencellid.org/\">OpenCelliD</a>"
}
},
"layers": [
{
"id": "opencellid",
"source": "opencellid",
"source-layer": "a",
"type": "circle",
"maxzoom": 18,
"minzoom": 2
}
]
}
14 changes: 14 additions & 0 deletions src/components/BaseData/OpenCellId/index.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Meta, StoryObj } from "@storybook/react";
import { OpenCellId } from ".";

const meta = {
component: OpenCellId,
parameters: {
layout: "fullscreen",
},
} satisfies Meta<typeof OpenCellId>;

export default meta;
type Story = StoryObj<typeof OpenCellId>;

export const Preview: Story = {};
30 changes: 30 additions & 0 deletions src/components/BaseData/OpenCellId/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Protocol } from "pmtiles";
import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { Map } from "react-map-gl/maplibre";
import { useEffect } from "react";

export const OpenCellId = () => {
useEffect(() => {
const protocol = new Protocol();
maplibregl.addProtocol("pmtiles", protocol.tile);
return () => {
maplibregl.removeProtocol("pmtiles");
};
}, []);

return (
<Map
initialViewState={{
longitude: 0,
latitude: 0,
zoom: 4,
}}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/opencellid.org/style.json"
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const OpenStreetMapFrHotRaster = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/tile.openstreetmap.fr/hot/style.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const OpenStreetMapJpOSMBrightVector = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="https://tile.openstreetmap.jp/styles/osm-bright/style.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const OpenStreetMapOrgRaster = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/tile.openstreetmap.org/style.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const ArcGISWorldImagery = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/server.arcgisonline.com/world_imagery/style.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const GSISeamlessPhoto = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/cyberjapandata.gsi.go.jp/xyz/seamlessphoto/style.json"
Expand Down
4 changes: 2 additions & 2 deletions src/components/BaseMaps/UNClearMapRaster/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const UNClearMapRaster = () => {
latitude: 0,
zoom: 4,
}}
dragPan={false}
scrollZoom={false}
dragPan={true}
scrollZoom={true}
hash={false}
style={{ width: "100%", height: "100%" }}
mapStyle="stylejson/geoservices.un.org/clearmap/style.json"
Expand Down