Commit 9feca22 1 parent d884aee commit 9feca22 Copy full SHA for 9feca22
File tree 1 file changed +5
-5
lines changed
front/src/modules/simulationResult/components/SimulationResultsMap
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ export default function RenderItinerary(props: RenderItineraryProps) {
23
23
'line-color' : '#158DCF' ,
24
24
} ;
25
25
26
- const startCoordinate = geojsonPath . geometry . coordinates [ 0 ] ;
27
- const endCoordinate =
28
- geojsonPath . geometry . coordinates [ geojsonPath . geometry . coordinates . length - 1 ] ;
26
+ // We know we have a geometry so we have at least 2 coordinates
27
+ const [ startLongitude , startLatitude ] = geojsonPath . geometry . coordinates . at ( 0 ) ! ;
28
+ const [ endLongitude , endLatitude ] = geojsonPath . geometry . coordinates . at ( - 1 ) ! ;
29
29
30
30
return (
31
31
< Source type = "geojson" data = { geojsonPath } >
32
- < Marker longitude = { startCoordinate [ 0 ] } latitude = { startCoordinate [ 1 ] } anchor = "bottom" >
32
+ < Marker longitude = { startLongitude } latitude = { startLatitude } anchor = "bottom" >
33
33
< img src = { originIcon } alt = "origin" />
34
34
</ Marker >
35
35
< OrderedLayer
@@ -40,7 +40,7 @@ export default function RenderItinerary(props: RenderItineraryProps) {
40
40
layerOrder = { layerOrder }
41
41
/>
42
42
< OrderedLayer id = "geojsonPathLine" type = "line" paint = { paintLine } layerOrder = { layerOrder } />
43
- < Marker longitude = { endCoordinate [ 0 ] } latitude = { endCoordinate [ 1 ] } anchor = "bottom" >
43
+ < Marker longitude = { endLongitude } latitude = { endLatitude } anchor = "bottom" >
44
44
< img src = { destinationIcon } alt = "destination" />
45
45
</ Marker >
46
46
</ Source >
You can’t perform that action at this time.
0 commit comments