houses: zero-pad Leefbaarometer grid cell ids (cells west of x=100 km, e.g. Zevenhuizen, Rotterdam)
Some checks failed
Deploy production / deploy (push) Has been cancelled
Some checks failed
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
@@ -5,6 +5,7 @@ describe('leefbaarometer helpers', () => {
|
||||
it('names the 100 m cell by its lower-left corner in hectometres', () => {
|
||||
expect(gridCellId([106050.4, 446899.9])).toBe('E1060N4468');
|
||||
expect(gridCellId([105866.161, 446838.902])).toBe('E1058N4468');
|
||||
expect(gridCellId([92050, 437250])).toBe('E0920N4372');
|
||||
});
|
||||
it('labels classes 1-9', () => {
|
||||
expect(lbmClassLabel(1)).toBe('zeer onvoldoende');
|
||||
|
||||
@@ -243,9 +243,10 @@ async function wfsArea(layer: string, cql: string): Promise<LbmArea | null> {
|
||||
};
|
||||
}
|
||||
|
||||
/** 100 m cell id as used by the Leefbaarometer grid: lower-left corner in hectometres. */
|
||||
/** 100 m cell id as used by the Leefbaarometer grid: lower-left corner in hectometres,
|
||||
* zero-padded to 4 digits (E0920N4372 west of x = 100 km, e.g. Rotterdam, Zevenhuizen). */
|
||||
export const gridCellId = ([x, y]: [number, number]) =>
|
||||
`E${Math.floor(x / 100)}N${Math.floor(y / 100)}`;
|
||||
`E${String(Math.floor(x / 100)).padStart(4, '0')}N${String(Math.floor(y / 100)).padStart(4, '0')}`;
|
||||
|
||||
export async function liveabilityAt(parts: AddressParts): Promise<Liveability | null> {
|
||||
const geo = await geocode(parts);
|
||||
|
||||
Reference in New Issue
Block a user