-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated web client to include pg_tilserv vector tiles on the visualiz…
…ations page - test to see that I can thread geometry through the server to the client (#12)
- Loading branch information
Showing
13 changed files
with
405 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ jobs: | |
DEPLOYMENT_ENV=production | ||
TZ=utc | ||
[email protected] | ||
TILESERV_BASE_URL=https://maps.somisana.ac.za | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ jobs: | |
DEPLOYMENT_ENV=development | ||
TZ=utc | ||
[email protected] | ||
TILESERV_BASE_URL=https://maps.somisana.dvn | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useEffect, useRef, useContext } from 'react' | ||
import { ctx as configContext } from '../../../modules/config' | ||
import Div from '../../../components/div' | ||
import useTheme from '@mui/material/styles/useTheme' | ||
import maplibre from 'maplibre-gl' | ||
|
||
export default ({ Attribution }) => { | ||
const { TILESERV_BASE_URL } = useContext(configContext) | ||
const theme = useTheme() | ||
const ref = useRef(null) | ||
|
||
useEffect(() => { | ||
const map = new maplibre.Map({ | ||
container: ref.current, | ||
style: 'https://api.maptiler.com/maps/voyager/style.json?key=Ahq5ZorUyvbxSA7shjIP', | ||
center: [25, -31], | ||
zoom: 5.5, | ||
}) | ||
|
||
map.on('load', () => { | ||
map.addSource('coordinates', { | ||
type: 'vector', | ||
tiles: [`${TILESERV_BASE_URL}/public.coordinates/{z}/{x}/{y}.pbf`], | ||
url: `${TILESERV_BASE_URL}/public.coordinates.json`, | ||
}) | ||
|
||
map.addLayer({ | ||
id: 'points', | ||
type: 'circle', | ||
source: 'coordinates', | ||
'source-layer': 'public.coordinates', | ||
paint: { | ||
'circle-color': theme.palette.primary.dark, | ||
'circle-opacity': 0.9, | ||
'circle-radius': 2, | ||
}, | ||
}) | ||
}) | ||
}, []) | ||
|
||
return ( | ||
<Div | ||
ref={ref} | ||
sx={{ | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
}} | ||
> | ||
<Attribution /> | ||
</Div> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
import Ol from './_ol' | ||
import OSM from './layers/open-street-maps' | ||
// import TerrestrisBaseMap from './layers/terrestris-base-map' | ||
import { useState, useEffect } from 'react' | ||
import MapLibre from './_maplibre' | ||
import Attribution from './_attribution' | ||
import Link from '@mui/material/Link' | ||
|
||
export default () => { | ||
return <Ol Attribution={Attribution} layers={[OSM()]} /> | ||
const [isClient, setIsClient] = useState(false) | ||
|
||
useEffect(() => { | ||
setIsClient(true) | ||
}, []) | ||
|
||
if (isClient) { | ||
return ( | ||
<MapLibre | ||
Attribution={() => ( | ||
<Attribution> | ||
<Link href="https://carto.com/" target="_blank"> | ||
© CARTO | ||
</Link>{' '} | ||
<Link href="https://www.maptiler.com/copyright/" target="_blank"> | ||
© MapTiler | ||
</Link>{' '} | ||
<Link href="https://www.openstreetmap.org/copyright" target="_blank"> | ||
© OpenStreetMap contributors | ||
</Link> | ||
</Attribution> | ||
)} | ||
/> | ||
) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.