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

Change Map provider #44

Merged
merged 1 commit into from
Oct 23, 2023
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
21 changes: 2 additions & 19 deletions web/src/components/PixiMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Center,
Divider,
Flex,
Link,
Stack,
Text,
Tooltip,
Expand All @@ -15,6 +14,7 @@ import {
useConst,
} from "@chakra-ui/react";
import { Bounds, Map, PigeonProps, Point } from "pigeon-maps";
import { osm } from "pigeon-maps/providers";
import * as PIXI from "pixi.js";
import * as React from "react";
import Select, { GroupBase, StylesConfig } from "react-select";
Expand All @@ -29,22 +29,6 @@ import {
} from "@/data/recoil";
import { useConnectionState } from "@/view/hooks/hooks";

const stamenProvider =
(flavor: "toner" | "toner-lite") =>
(x: number, y: number, z: number, dpr = 1) =>
`https://stamen-tiles.a.ssl.fastly.net/${flavor}/${z}/${x}/${y}${
dpr >= 2 ? "@2x" : ""
}.png`;

const stamenAttribution = (
<>
Map tiles by <Link href="http://stamen.com">Stamen Design</Link>, under{" "}
<Link href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</Link>.
Data by <Link href="http://openstreetmap.org">OpenStreetMap</Link>, under{" "}
<Link href="http://www.openstreetmap.org/copyright">ODbL</Link>.
</>
);

export const DEFAULT_CENTER: [number, number] = [
DEFAULT_CITY.lonlat[1],
DEFAULT_CITY.lonlat[0],
Expand Down Expand Up @@ -371,8 +355,7 @@ export const PixiMap = <T,>({
<Box width="100%" overflow="hidden" height={height} {...rest}>
<Map
dprs={[1, 2]}
provider={stamenProvider("toner-lite")}
attribution={stamenAttribution}
provider={osm}
maxZoom={18}
minZoom={5}
onBoundsChanged={handleBoundsChange}
Expand Down
6 changes: 3 additions & 3 deletions web/src/data/recoil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ export const selectedCity = atom({

export const defaultSelectedCities = selector<Array<City>>({
key: "defaultSelectedCities",
get: async ({get}) => {
get: async ({ get }) => {
const config = get(connectionConfig);
let selectedCities: Array<City> = [];
try {
selectedCities = await getCities(config);
} catch (error) {
selectedCities = [];
console.log('Failed to fetch selected cities details from the Database.');
console.log("Failed to fetch selected cities details from the Database.");
}
return selectedCities;
}
},
});

export const selectedCities = atom<Array<City>>({
Expand Down