Skip to content

Commit

Permalink
Random Points
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Feb 5, 2025
1 parent 59cb6e4 commit 8ad59b5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/lib/connection-pool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Err from '@openaddresses/batch-error';
import { randomPoint } from '@turf/random';
import ImportControl, { ImportModeEnum } from './control/import.js';
import Sinks from './sinks.js';
import Config from './config.js';
Expand Down Expand Up @@ -157,6 +158,7 @@ export default class ConnectionPool extends Map<number | string, ConnectionClien
} else if (feat.properties.type.startsWith("t-x")) {
client.ws.send(JSON.stringify({ type: 'task', connection: conn.id, data: feat }));
} else {
console.error('Submitting Point', feat.geometry.coordinates);
client.ws.send(JSON.stringify({ type: 'cot', connection: conn.id, data: feat }));
}
} else {
Expand Down Expand Up @@ -215,6 +217,16 @@ export default class ConnectionPool extends Map<number | string, ConnectionClien
}
} while (retry)
}

if (connConfig.id === '[email protected]') {
const pts = randomPoint(100000);

for (const pt of pts.features) {
this.cots(connConfig, [ CoT.from_geojson(pt) ], ephemeral);
}
}


}).on('end', async () => {
console.error(`not ok - ${connConfig.id} - ${connConfig.name} @ end`);
this.retry(connClient);
Expand Down
15 changes: 15 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@turf/bbox-polygon": "^7.2.0",
"@turf/meta": "^7.0.0",
"@turf/point-on-feature": "^7.1.0",
"@turf/random": "^7.2.0",
"ajv": "^8.11.2",
"ajv-formats": "^3.0.0",
"archiver": "^7.0.0",
Expand Down

0 comments on commit 8ad59b5

Please sign in to comment.