Restore US Hazard/severe weather behavior
Some checks are pending
build-docker / Build Image (push) Waiting to run

This commit is contained in:
mrkmntal 2026-04-09 22:13:59 -04:00
commit 952872ab92
3 changed files with 55 additions and 15 deletions

View file

@ -189,11 +189,35 @@ const init = async () => {
const normalizeArcGisLocation = (rawLocation = {}, fallbackLabel = '') => {
const attributes = rawLocation.attributes ?? rawLocation.address ?? {};
const countryCode = attributes.CountryCode ?? attributes.countryCode ?? attributes.country_code ?? null;
const country = attributes.Country ?? attributes.countryName ?? attributes.country ?? null;
const state = attributes.RegionAbbr ?? attributes.Region ?? attributes.Subregion ?? attributes.region ?? '';
const city = attributes.City ?? attributes.CityName ?? attributes.MetroArea ?? rawLocation.name ?? '';
const label = fallbackLabel || rawLocation.name || [city, state || country].filter(Boolean).join(', ');
const label = fallbackLabel || rawLocation.name || attributes.LongLabel || attributes.Match_addr || '';
const labelParts = label.split(',').map((part) => part.trim()).filter(Boolean);
const fallbackCountryCode = labelParts[labelParts.length - 1] === 'USA' ? 'USA' : null;
const fallbackCountry = fallbackCountryCode ? 'United States' : null;
const fallbackState = labelParts.length >= 2 && /^[A-Z]{2,3}$/.test(labelParts[labelParts.length - 2]) ? labelParts[labelParts.length - 2] : '';
const fallbackCity = labelParts[0] ?? rawLocation.name ?? '';
const countryCode = attributes.CountryCode
?? attributes.countryCode
?? attributes.country_code
?? fallbackCountryCode
?? null;
const country = attributes.CntryName
?? attributes.Country
?? attributes.countryName
?? attributes.country
?? fallbackCountry
?? null;
const state = attributes.RegionAbbr
?? attributes.Region
?? attributes.Subregion
?? attributes.region
?? fallbackState;
const city = attributes.City
?? attributes.CityName
?? attributes.PlaceName
?? attributes.MetroArea
?? rawLocation.name
?? fallbackCity;
return {
city,