forked from MapComplete/MapComplete
More work on layerserver, generate
This commit is contained in:
parent
f0823f4c4d
commit
6b507504f8
13 changed files with 124 additions and 70 deletions
|
@ -1,42 +0,0 @@
|
|||
hosted.mapcomplete.org {
|
||||
root * public/
|
||||
file_server
|
||||
header {
|
||||
+Permissions-Policy "interest-cohort=()"
|
||||
+Report-To `\{"group":"csp-endpoint", "max_age": 86400,"endpoints": [\{"url": "https://report.mapcomplete.org/csp"}], "include_subdomains": true}`
|
||||
}
|
||||
}
|
||||
|
||||
countrycoder.mapcomplete.org {
|
||||
root * tiles/
|
||||
file_server
|
||||
header {
|
||||
+Permissions-Policy "interest-cohort=()"
|
||||
+Access-Control-Allow-Origin https://hosted.mapcomplete.org https://dev.mapcomplete.org https://mapcomplete.org
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
report.mapcomplete.org {
|
||||
reverse_proxy {
|
||||
to http://127.0.0.1:2600
|
||||
}
|
||||
}
|
||||
|
||||
studio.mapcomplete.org {
|
||||
reverse_proxy {
|
||||
to http://127.0.0.1:1235
|
||||
}
|
||||
}
|
||||
|
||||
bounce.mapcomplete.org {
|
||||
reverse_proxy {
|
||||
to http://127.0.0.1:1236
|
||||
}
|
||||
}
|
||||
|
||||
mapcomplete.osm.be {
|
||||
reverse_proxy {
|
||||
to http://127.0.0.1:1236
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"store": "console",
|
||||
"allowedOrigin": null,
|
||||
"port": 2600,
|
||||
"domainWhitelist": ["localhost:10179", "localhost:2600","hosted.mapcomplete.org", "dev.mapcomplete.org", "mapcomplete.org","*"],
|
||||
"sourceBlacklist": ["chrome-extension://gighmmpiobklfepjocnamgkkbiglidom"]
|
||||
}
|
|
@ -28,7 +28,7 @@ class OsmPoiDatabase {
|
|||
private static readonly prefixes: ReadonlyArray<string> = ["pois", "lines", "polygons"]
|
||||
private readonly _client: Client
|
||||
private isConnected = false
|
||||
private supportedLayers: string[] = undefined
|
||||
private supportedLayers: Set<string> = undefined
|
||||
private metaCache: PoiDatabaseMeta = undefined
|
||||
private metaCacheDate: Date = undefined
|
||||
|
||||
|
@ -64,7 +64,7 @@ class OsmPoiDatabase {
|
|||
this._client.end()
|
||||
}
|
||||
|
||||
async getLayers(): Promise<string[]> {
|
||||
async getLayers(): Promise<Set<string>> {
|
||||
if (this.supportedLayers !== undefined) {
|
||||
return this.supportedLayers
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ class OsmPoiDatabase {
|
|||
"WHERE table_schema = 'public' AND table_name LIKE 'lines_%';"
|
||||
)
|
||||
const layers = result.rows.map((r) => r.table_name.substring("lines_".length))
|
||||
this.supportedLayers = layers
|
||||
return layers
|
||||
this.supportedLayers = new Set(layers)
|
||||
return this.supportedLayers
|
||||
}
|
||||
|
||||
async getMeta(): Promise<PoiDatabaseMeta> {
|
||||
|
@ -218,7 +218,12 @@ const server = new Server(2345, [
|
|||
|
||||
let sum = 0
|
||||
let properties: Record<string, number> = {}
|
||||
const availableLayers = await tcs.getLayers()
|
||||
for (const layer of layers.split("+")) {
|
||||
console.log("Getting layer", layer)
|
||||
if (!availableLayers.has(layer)) {
|
||||
continue
|
||||
}
|
||||
const count = await tcs.getCount(
|
||||
layer,
|
||||
Tiles.tile_bounds_lon_lat(Number(z), Number(x), Number(y))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue