Project the whole track to the map, and show both versions
This commit is contained in:
parent
cb837ef5f2
commit
34660b266c
|
@ -151,7 +151,9 @@ async def process_track(session, track, data_source):
|
||||||
)
|
)
|
||||||
|
|
||||||
annotator = AnnotateMeasurements(
|
annotator = AnnotateMeasurements(
|
||||||
data_source, cache_dir=app.config.OBS_FACE_CACHE_DIR
|
data_source,
|
||||||
|
cache_dir=app.config.OBS_FACE_CACHE_DIR,
|
||||||
|
fully_annotate_unconfirmed=True,
|
||||||
)
|
)
|
||||||
input_data = await annotator.annotate(imported_data)
|
input_data = await annotator.annotate(imported_data)
|
||||||
|
|
||||||
|
@ -188,10 +190,19 @@ async def process_track(session, track, data_source):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
track_raw_json = {
|
||||||
|
"type": "Feature",
|
||||||
|
"geometry": {
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [[m["longitude_GPS"], m["latitude_GPS"]] for m in track_points],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for output_filename, data in [
|
for output_filename, data in [
|
||||||
("measurements.json", measurements_json),
|
("measurements.json", measurements_json),
|
||||||
("overtakingEvents.json", overtaking_events_json),
|
("overtakingEvents.json", overtaking_events_json),
|
||||||
("track.json", track_json),
|
("track.json", track_json),
|
||||||
|
("trackRaw.json", track_raw_json),
|
||||||
]:
|
]:
|
||||||
target = join(output_dir, output_filename)
|
target = join(output_dir, output_filename)
|
||||||
log.debug("Writing file %s", target)
|
log.debug("Writing file %s", target)
|
||||||
|
|
|
@ -181,6 +181,7 @@ async def get_track_data(req, slug: str):
|
||||||
"measurements": "measurements.json",
|
"measurements": "measurements.json",
|
||||||
"overtakingEvents": "overtakingEvents.json",
|
"overtakingEvents": "overtakingEvents.json",
|
||||||
"track": "track.json",
|
"track": "track.json",
|
||||||
|
"trackRaw": "trackRaw.json",
|
||||||
}
|
}
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
import produce from 'immer'
|
||||||
|
|
||||||
import bright from './bright.json'
|
import bright from './bright.json'
|
||||||
import positron from './positron.json'
|
import positron from './positron.json'
|
||||||
|
@ -70,4 +71,10 @@ export const trackLayer = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const trackLayerRaw = produce(trackLayer, draft => {
|
||||||
|
draft.paint['line-color'] = '#81D4FA'
|
||||||
|
draft.paint['line-width'][4] = 1
|
||||||
|
draft.paint['line-width'][6] = 3
|
||||||
|
})
|
||||||
|
|
||||||
export const basemap = positron
|
export const basemap = positron
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {Source, Layer} from 'react-map-gl'
|
||||||
import type {TrackData} from 'types'
|
import type {TrackData} from 'types'
|
||||||
import {Map} from 'components'
|
import {Map} from 'components'
|
||||||
|
|
||||||
import {colorByDistance, trackLayer} from '../../mapstyles'
|
import {colorByDistance, trackLayer, trackLayerRaw} from '../../mapstyles'
|
||||||
|
|
||||||
export default function TrackMap({
|
export default function TrackMap({
|
||||||
trackData,
|
trackData,
|
||||||
|
@ -25,14 +25,20 @@ export default function TrackMap({
|
||||||
return (
|
return (
|
||||||
<div style={props.style}>
|
<div style={props.style}>
|
||||||
<Map boundsFromJson={trackData.track}>
|
<Map boundsFromJson={trackData.track}>
|
||||||
|
{showTrack && trackData.trackRaw != null && (
|
||||||
|
<Source key="trackRaw" id="trackRaw" type="geojson" data={trackData.trackRaw}>
|
||||||
|
<Layer id="trackRaw" {...trackLayerRaw} />
|
||||||
|
</Source>
|
||||||
|
)}
|
||||||
|
|
||||||
{showTrack && (
|
{showTrack && (
|
||||||
<Source id="route" type="geojson" data={trackData.track}>
|
<Source key="track" id="track" type="geojson" data={trackData.track}>
|
||||||
<Layer id="route" {...trackLayer} />
|
<Layer id="track" {...trackLayer} />
|
||||||
</Source>
|
</Source>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{pointsMode !== 'none' && (
|
{pointsMode !== 'none' && (
|
||||||
<Source id="overtakingEvents" type="geojson" data={trackData[pointsMode]}>
|
<Source key="overtakingEvents" id="overtakingEvents" type="geojson" data={trackData[pointsMode]}>
|
||||||
<Layer
|
<Layer
|
||||||
id="overtakingEvents"
|
id="overtakingEvents"
|
||||||
type="circle"
|
type="circle"
|
||||||
|
|
|
@ -10,6 +10,7 @@ import Markdown from 'react-markdown'
|
||||||
import api from 'api'
|
import api from 'api'
|
||||||
import {Page} from 'components'
|
import {Page} from 'components'
|
||||||
import type {Track, TrackData, TrackComment} from 'types'
|
import type {Track, TrackData, TrackComment} from 'types'
|
||||||
|
import {trackLayer, trackLayerRaw} from '../../mapstyles'
|
||||||
|
|
||||||
import TrackActions from './TrackActions'
|
import TrackActions from './TrackActions'
|
||||||
import TrackComments from './TrackComments'
|
import TrackComments from './TrackComments'
|
||||||
|
@ -31,6 +32,14 @@ function TrackMapSettings({showTrack, setShowTrack, pointsMode, setPointsMode, s
|
||||||
<List>
|
<List>
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<Checkbox checked={showTrack} onChange={(e, d) => setShowTrack(d.checked)} /> Show track
|
<Checkbox checked={showTrack} onChange={(e, d) => setShowTrack(d.checked)} /> Show track
|
||||||
|
<div style={{marginTop: 8}}>
|
||||||
|
<span style={{background: trackLayerRaw.paint['line-color'], height: 6, width: 24, display: 'inline-block', verticalAlign: 'middle', marginRight: 4}} />
|
||||||
|
GPS track
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span style={{background: trackLayer.paint['line-color'], height: 6, width: 24, display: 'inline-block', verticalAlign: 'middle', marginRight: 4}} />
|
||||||
|
Snapped to road
|
||||||
|
</div>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<List.Header>Points</List.Header>
|
<List.Header>Points</List.Header>
|
||||||
|
|
Loading…
Reference in a new issue