Server: add first docs and experiments

This commit is contained in:
Pieter Vander Vennet 2024-01-15 15:23:40 +01:00
parent ce654cbcf9
commit c98891d4bd
2 changed files with 56 additions and 2 deletions

11
Docs/SettingUpPSQL.md Normal file
View file

@ -0,0 +1,11 @@
sudo docker run --name some-postgis -e POSTGRES_PASSWORD=none -e POSTGRES_USER=user -d -p 5444:5432 -v /home/pietervdvn/data/pgsql/:/var/lib/postgresql/data postgis/postgis
-> Via PGAdmin een database maken en:
1) Postgis activeren (rechtsklikken > Create > extension)
2) HStore activeren
Installeer osm2pgsql (hint: compile from source is painless)
pg_tileserv kan hier gedownload worden: https://github.com/CrunchyData/pg_tileserv
DATABASE_URL=postgresql://user:none@localhost:5444/osm-poi ./pg_tileserv

View file

@ -1,7 +1,50 @@
<script lang="ts">
// Testing grounds
import { UIEventSource } from "../Logic/UIEventSource"
import MaplibreMap from "./Map/MaplibreMap.svelte"
import { Map as MlMap } from "maplibre-gl"
import { MapLibreAdaptor } from "./Map/MapLibreAdaptor"
import Icon from "./Map/Icon.svelte"
let map: UIEventSource<MlMap> = new UIEventSource<MlMap>(undefined)
let adaptor = new MapLibreAdaptor(map)
adaptor.location.setData({
lat: 42.5404,
lon:1.4832
})
adaptor.zoom.setData(10)
map.addCallbackAndRunD(map => {
map.on("load", () => {
map.addSource("drinking_water", {
"type": "vector",
"tiles": ["http://127.0.0.2:7800/public.drinking_water/{z}/{x}/{y}.pbf"] // http://127.0.0.2:7800/public.drinking_water.json",
})
map.addLayer(
{
"id": "drinking_water_layer",
"type": "circle",
"source": "drinking_water",
"source-layer": "public.drinking_water",
"paint": {
"circle-radius": 5,
"circle-color": "#ff00ff",
"circle-stroke-width": 2,
"circle-stroke-color": "#000000",
},
},
)
map.on('click', 'drinking_water_layer', (e) => {
// Copy coordinates array.
console.log(e)
console.warn(">>>", e.features[0])
})
})
})
</script>
<Icon clss="h-16 w-16" icon="heart" color="#ff0000"/>
<div class="h-screen w-screen">
<MaplibreMap {map} />
</div>