Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Oct 25, 2024
1 parent 41fde02 commit 8a31efc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions packages/h3-filter-ingest/add-geohashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import * as cliProgress from "cli-progress";
import { stops, Stop } from "./src/stops";
const tilebelt = require("@mapbox/tilebelt");

const BATCH_SIZE = 5000; // Define the batch size for processing
const BATCH_SIZE = 50_000; // Define the batch size for processing
const zoomLevel = 7;
const limits = { min_zoom: zoomLevel, max_zoom: zoomLevel };
// const limits = { min_zoom: zoomLevel, max_zoom: zoomLevel };

// Define the CLI options
const argv = yargs(process.argv.slice(2))
Expand Down Expand Up @@ -66,10 +66,10 @@ async function processBatch(
const valuesStatements: string[] = [];
// Process each geometry in the batch
for (const row of result) {
const geohashes: string[] = tileCover.indexes(
JSON.parse(row.geojson),
limits
);
const geohashes: string[] = tileCover.indexes(JSON.parse(row.geojson), {
min_zoom: stop.zoomLevel,
max_zoom: stop.zoomLevel,
});

// console.log("\n");

Expand Down Expand Up @@ -161,7 +161,8 @@ async function prepare() {

(async () => {
await prepare();
for (const stop of stops.reverse()) {
const steps = stops.reverse().slice(0, stops.length - 1);
for (const stop of steps) {
await processAllRows(stop);
}
connection.close();
Expand Down
2 changes: 1 addition & 1 deletion packages/h3-filter-ingest/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ app.get("/mvt/:z/:x/:y", async (c, next) => {
const query = `
with ids as (
select
id,
distinct(id),
from
geohashes
where
Expand Down

0 comments on commit 8a31efc

Please sign in to comment.