2023-01-29 13:10:57 +01:00
|
|
|
import ContactLink from "./UI/BigComponents/ContactLink.svelte"
|
|
|
|
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
|
|
|
import { Utils } from "./Utils"
|
2023-01-21 23:58:14 +01:00
|
|
|
import List from "./UI/Base/List"
|
2023-01-29 13:10:57 +01:00
|
|
|
import { GeoOperations } from "./Logic/GeoOperations"
|
|
|
|
import { Tiles } from "./Models/TileRange"
|
|
|
|
import { Stores } from "./Logic/UIEventSource"
|
2022-10-29 03:05:29 +02:00
|
|
|
|
2023-01-29 13:10:57 +01:00
|
|
|
async function main() {
|
|
|
|
const location: [number, number] = [3.21, 51.2]
|
|
|
|
const t = Tiles.embedded_tile(location[1], location[0], 6)
|
|
|
|
const url = `https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/community_index/tile_${t.z}_${t.x}_${t.y}.geojson`
|
|
|
|
const be = Stores.FromPromise(Utils.downloadJson(url)).mapD(
|
|
|
|
(data) => data.features.find((f) => GeoOperations.inside(location, f)).properties
|
|
|
|
)
|
|
|
|
new SvelteUIElement(ContactLink, { country: be }).AttachTo("maindiv")
|
|
|
|
/*
|
|
|
|
const links = data.features
|
|
|
|
.filter((f) => GeoOperations.inside(location, f))
|
|
|
|
.map((f) => new SvelteUIElement(ContactLink, { country: f.properties }))
|
|
|
|
new List(links).AttachTo("maindiv")
|
|
|
|
//*/
|
2023-01-21 23:58:14 +01:00
|
|
|
}
|
|
|
|
|
2023-01-29 13:10:57 +01:00
|
|
|
main().then((_) => {})
|