Skip to content

Commit 33e442a

Browse files
authored
Merge pull request #2389 from Plant-for-the-Planet-org/hotfix/fires-latlng-convention-fix
LatLng convention fixed.
2 parents 7690192 + 5692667 commit 33e442a

File tree

1 file changed

+8
-4
lines changed
  • src/features/projectsV2/ProjectsMap/FirePopup

1 file changed

+8
-4
lines changed

src/features/projectsV2/ProjectsMap/FirePopup/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ export default function FirePopup({ isOpen, feature }: Props) {
9090
return { amount: `${days}`, unit: 'd' }; // 24 hours or more
9191
}, [feature.properties.eventDate]);
9292

93+
const alertCoordinates = useMemo(() => {
94+
const [lng, lat] = feature.geometry.coordinates;
95+
const latString = lat >= 0 ? `${Math.abs(lat)}°N` : `${Math.abs(lat)}°S`;
96+
const lngString = lng >= 0 ? `${Math.abs(lng)}°E` : `${Math.abs(lng)}°W`;
97+
return `${latString}, ${lngString}`;
98+
}, [feature.geometry.coordinates]);
99+
93100
const alertConfidence = useMemo(() => {
94101
const confidenceMap: Record<string, string> = {
95102
high: 'highAlertConfidenceText',
@@ -155,10 +162,7 @@ export default function FirePopup({ isOpen, feature }: Props) {
155162
</p>
156163
</header>
157164
<div className={styles.popupText}>
158-
<p className={styles.coordinates}>
159-
{feature.geometry.coordinates[0]},{' '}
160-
{feature.geometry.coordinates[1]}
161-
</p>
165+
<p className={styles.coordinates}>{alertCoordinates}</p>
162166
<p>
163167
{tProjectDetails.rich(alertConfidence, {
164168
important: (chunks) => <span>{chunks}</span>,

0 commit comments

Comments
 (0)