Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
pietervdvn committed Feb 18, 2024
1 parent e7876d6 commit ab85afe
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scripts/osm2pgsql/tilecountServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class OsmPoiDatabase {
if (bbox) {
query += ` WHERE ST_MakeEnvelope (${bbox[0][0]}, ${bbox[0][1]}, ${bbox[1][0]}, ${bbox[1][1]}, 4326) ~ geom`
}
console.log("Query:", query)
const result = await this._client.query(query)
total += Number(result.rows[0].count)
}
Expand All @@ -77,7 +76,6 @@ class OsmPoiDatabase {
"FROM information_schema.tables \n" +
"WHERE table_schema = 'public' AND table_name LIKE 'lines_%';"
const result = await this._client.query(q)
console.log("Getting layers: ", q, result)
const layers = result.rows.map((r) => r.table_name.substring("lines_".length))
this.supportedLayers = new Set(layers)
this.supportedLayersDate = new Date()
Expand Down Expand Up @@ -139,10 +137,10 @@ class Server {

const url = new URL(`http://127.0.0.1/` + req.url)
let path = url.pathname
console.log("Handling ", path)
while (path.startsWith("/")) {
path = path.substring(1)
}
console.log("Handling ", path)
const handler = handle.find((h) => {
if (typeof h.mustMatch === "string") {
return h.mustMatch === path
Expand Down Expand Up @@ -213,12 +211,11 @@ const server = new Server(2345, [
handle: async (path: string) => {
const layers = await tcs.getLayers()
const meta = await tcs.getMeta()
console.log("Got layers:", layers, "for status")
return JSON.stringify({ meta, layers: Array.from(layers) })
},
},
{
mustMatch: /summary\/[a-zA-Z0-9+]+\/[0-9]+\/[0-9]+\/[0-9]+\.json/,
mustMatch: /summary\/[a-zA-Z0-9+_-]+\/[0-9]+\/[0-9]+\/[0-9]+\.json/,
mimetype: "application/json", // "application/vnd.geo+json",
async handle(path) {
console.log("Path is:", path, path.split(".")[0])
Expand Down

0 comments on commit ab85afe

Please sign in to comment.