forked from MapComplete/MapComplete
Feature: offline basemaps: first working version (without ability to install basemaps from the UI)
This commit is contained in:
parent
4c858fbe7e
commit
2cd0b11448
13 changed files with 494 additions and 178 deletions
|
@ -1,63 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { PMTiles } from "pmtiles"
|
||||
|
||||
// What piece of the map to download and cache locally for the current map view?
|
||||
const gentBBox = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
3.6911333519349228,
|
||||
51.069673467969096
|
||||
],
|
||||
[
|
||||
3.6911333519349228,
|
||||
51.02886180987505
|
||||
],
|
||||
[
|
||||
3.773873676856965,
|
||||
51.02886180987505
|
||||
],
|
||||
[
|
||||
3.773873676856965,
|
||||
51.069673467969096
|
||||
],
|
||||
[
|
||||
3.6911333519349228,
|
||||
51.069673467969096
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
}
|
||||
|
||||
// URL or fetch source of the PMTiles archive
|
||||
let source = new PMTiles("https://cache.mapcomplete.org/planet-latest.pmtiles")
|
||||
|
||||
async function test(z: number, x: number, y: number) {
|
||||
|
||||
|
||||
const meta = await source.getMetadata()
|
||||
console.log(meta)
|
||||
const minzoom = meta["minzoom"]
|
||||
const maxzoom = meta["maxzoom"]
|
||||
console.log("Range is", minzoom, maxzoom)
|
||||
for (const l of meta["vector_layers"]) {
|
||||
// console.log(l)
|
||||
}
|
||||
// const header = await source.getHeader()
|
||||
// console.log(header)
|
||||
let resp = await source.getZxy(z, x, y)
|
||||
console.log(resp)
|
||||
// let tileData = resp?.data
|
||||
// do something with tileData
|
||||
}
|
||||
|
||||
test(14, 8338, 5469) // Elf-julistraat Brugge
|
||||
test(15, 12233, 10534)
|
||||
</script>
|
||||
|
||||
Nothing to test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue