Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
fallaciousreasoning committed Apr 22, 2024
2 parents c867b70 + 115f36c commit 6fde3e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/components/MapPin.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@
const { map } = getOlContext()
map.on('click', async (e) => {
const LONG_PRESS_THRESHOLD = 500;
let mouseDownAt: number;
map.getTargetElement().addEventListener('mousedown', e => {
mouseDownAt = Date.now();
});
map.on('singleclick', async (e) => {
const pressDuration = Date.now() - mouseDownAt
if (pressDuration < LONG_PRESS_THRESHOLD) {
return
}
const [lng, lat] = toLonLat(e.coordinate)
const closestPoint = await findPlace(lat, lng)
$fragment.label = {
Expand Down
10 changes: 5 additions & 5 deletions src/layers/layerDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const linzTopo: TileLayerDefinition =
},
};

const LINZ_BASEMAPS = 'd01fbtg0ar3v159zx4e0ajt0n09'
export const layerDefinitions: TileLayerDefinition[] = [
linzTopo,
{
Expand All @@ -52,16 +53,15 @@ export const layerDefinitions: TileLayerDefinition[] = [
description: "High resolution imagery of New Zealand, provided by LINZ",
type: 'base',
url: ([z,x,y]: TileCoord) => {
return `https://basemaps.linz.govt.nz/v1/tiles/aerial/EPSG:3857/${z}/${x}/${y}.webp?api=d01fbtg0ar3v159zx4e0ajt0n09`;
return `https://basemaps.linz.govt.nz/v1/tiles/aerial/EPSG:3857/${z}/${x}/${y}.webp?api=${LINZ_BASEMAPS}`;
}
},
{
name: "Hillshade",
name: "Hill shade",
description: "Terrain relief overlay",
type: 'overlay',
defaultVisible: true,
prerender: e => e.context!.canvas.getContext('2d')!.globalCompositeOperation = 'multiply',
minZoom: 10,
url: 'https://tiles-cdn.koordinates.com/services;key=d0772bed2204423f87157f7fb1223389/tiles/v4/layer=50765/EPSG:3857/{z}/{x}/{y}.png'
}
url: `https://basemaps.linz.govt.nz/v1/tiles/geographx-nz-dem-2012-8m/WebMercatorQuad/{z}/{x}/{y}.webp?api=${LINZ_BASEMAPS}`,
},
]

0 comments on commit 6fde3e5

Please sign in to comment.