Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Geo I] Typing functionality #5179

Merged
merged 21 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Types function
  • Loading branch information
madsnedergaard committed Mar 9, 2023
commit 100e6348a97abe4bba41fcddfd93591ad5521fe6
9 changes: 6 additions & 3 deletions web/geo/generateTopojson.ts
Original file line number Diff line number Diff line change
@@ -50,16 +50,19 @@ function getCenter(geojson: WorldFeatureCollection, zoneName: string) {
];
}

function generateTopojson(fc, { OUT_PATH, verifyNoUpdates }) {
function generateTopojson(
fc: WorldFeatureCollection,
{ OUT_PATH, verifyNoUpdates }: { OUT_PATH: string; verifyNoUpdates: boolean }
) {
const output = OUT_PATH.split('/').pop();
console.info(`Generating new ${output}`);
const topo = topology({
objects: fc,
});

// We do the following to match the specific format needed for visualization
const objects: any = topo.objects.objects;
const newObjects = {};
const objects = topo.objects.objects as any;

Check warning

Code scanning / ESLint

Disallow the `any` type

Unexpected any. Specify a different type.
const newObjects = {} as typeof topo.objects;
for (const geo of objects.geometries) {
// Precompute center for enable centering on the zone
geo.properties.center = getCenter(fc, geo.properties.zoneName);
1 change: 1 addition & 0 deletions web/geo/generateWorld.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import { generateExchangesToIgnore } from './generateExchangesToExclude.js';
import { generateTopojson } from './generateTopojson.js';
import { getJSON, round } from './utilities.js';
import { validateGeometry } from './validate.js';
import { WorldFeatureCollection } from './types.js';
madsnedergaard marked this conversation as resolved.
Show resolved Hide resolved

export const config = {
WORLD_PATH: path.resolve(fileURLToPath(new URL('world.geojson', import.meta.url))),