From c3d863f89f5db15c580da100a972def4fc0a6e8b Mon Sep 17 00:00:00 2001 From: Eddy G Date: Sun, 13 Jul 2025 22:45:04 -0400 Subject: [PATCH] Fixup mapclick.mjs --- server/scripts/modules/utils/mapclick.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/scripts/modules/utils/mapclick.mjs b/server/scripts/modules/utils/mapclick.mjs index 9396b6d..532f386 100644 --- a/server/scripts/modules/utils/mapclick.mjs +++ b/server/scripts/modules/utils/mapclick.mjs @@ -339,15 +339,14 @@ export const convertMapClickForecastToApiFormat = (mapClickData) => { return { type: 'Feature', geometry: { - type: 'Polygon', - coordinates: [[[mapClickData.location?.longitude, mapClickData.location?.latitude]]], // Approximate + type: 'Point', + coordinates: [mapClickData.location?.longitude, mapClickData.location?.latitude], }, properties: { - updated: mapClickData.creationDate || new Date().toISOString(), units: 'us', forecastGenerator: 'MapClick', generatedAt: new Date().toISOString(), - updateTime: mapClickData.creationDate || new Date().toISOString(), + updateTime: parseMapClickDate(mapClickData.creationDateLocal)?.toISOString() || new Date().toISOString(), validTimes: `${time.startValidTime[0]}/${time.startValidTime[time.startValidTime.length - 1]}`, elevation: { unitCode: 'wmoUnit:m', @@ -619,6 +618,7 @@ export const enhanceObservationWithMapClick = async (observationData, options = // Build improvements list for logging const improvements = []; if (isFresher) { + // NOTE: for the forecast version, we'd want to use the `updateTime` property instead of `timestamp` const mapClickAgeInMinutes = Math.round((Date.now() - mapClickTimestamp) / (1000 * 60)); improvements.push(`${mapClickAgeInMinutes} minutes old vs. ${ageInMinutes.toFixed(0)} minutes old`); }