From 049e712981c948024924f90cf34db775b8b6cdb6 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 20 Feb 2024 02:17:30 +0100 Subject: [PATCH] Fix null in coordinates --- scripts/osm2pgsql/tilecountServer.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/osm2pgsql/tilecountServer.ts b/scripts/osm2pgsql/tilecountServer.ts index 0006d1892..607adfb3a 100644 --- a/scripts/osm2pgsql/tilecountServer.ts +++ b/scripts/osm2pgsql/tilecountServer.ts @@ -304,10 +304,12 @@ new Server(2345, { ignorePathPrefix: ["summary"] }, [ Tiles.tile_index(Number(z), Number(x), Number(y)) ) - latSum += count.lat * count.count - lonSum += count.lon * count.count properties[layer] = count.count - sum += count.count + if (count.count !== 0) { + latSum += count.lat * count.count + lonSum += count.lon * count.count + sum += count.count + } } properties["lon"] = lonSum / sum