advisoryTrack = {
const data = await shpToGeoJSON(advisoryTrackShp);
const keys = Object.keys(data);
const points = data[keys.find(key => key.endsWith('5day_pts'))];
const line = data[keys.find(key => key.endsWith('5day_lin'))];
const watches = data[keys.find(key => key.endsWith('ww_wwlin'))];
console.log(points);
points.features.forEach((point, idx) => {
const properties = point.properties;
const stormType = properties.STORMTYPE;
let STORM_LABEL;
switch (stormType) {
case 'MH':
case 'HU':
STORM_LABEL = properties.SSNUM;
break;
case 'TS':
STORM_LABEL = 'S';
break;
case 'TD':
STORM_LABEL = 'D';
break;
case 'STD':
case 'STS':
STORM_LABEL = 'P';
break;
}
let parsedDate;
if (idx === 0) {
const rawDate = properties.ADVDATE.replace(' CDT', '');
parsedDate = DateTime.fromFormat(rawDate, 'hmm a EEE MMM dd yyyy', {
zone: 'America/Chicago'
});
} else {
const rawDate = properties.FLDATELBL.replace(' CDT', '');
parsedDate = DateTime.fromFormat(rawDate, 'yyyy-MM-dd h:mm a EEE', {
zone: 'America/Chicago'
});
}
const options = {
weekday: 'short',
hour: 'numeric'
};
if (parsedDate.minute > 0) {
options.minute = 'numeric';
}
if (idx === 0) {
options.timeZoneName = 'short';
}
properties.STORM_LABEL = STORM_LABEL;
properties.FORMATTED_DATE = parsedDate.toLocaleString(options);
});
const firstPoint = points.features[0].geometry.coordinates;
return {
points,
line,
watches,
firstPoint
};
}