diff --git a/src/components/map/TravelMapDetail.jsx b/src/components/map/TravelMapDetail.jsx index 721e5b83..2a78b187 100644 --- a/src/components/map/TravelMapDetail.jsx +++ b/src/components/map/TravelMapDetail.jsx @@ -6,6 +6,7 @@ import { GoogleMap, InfoWindowF, MarkerF, + Polyline, useJsApiLoader, } from '@react-google-maps/api'; @@ -62,6 +63,17 @@ const TravelMapDetail = ({ journeyInfo }) => { setClicked(true); }; + const markerCoordinates = scheduleLocations + ?.map(post => { + const latitude = parseFloat(post?.location?.latitude); + const longitude = parseFloat(post?.location?.longitude); + if (isNaN(latitude) || isNaN(longitude)) { + console.error('Invalid latitude or longitude:', post?.location); + return null; + } + return { lat: latitude, lng: longitude }; + }) + .filter(coordinate => coordinate !== null); return isLoaded ? ( { )} + ))}