Surface GPX/FIT parse errors instead of silently rendering nothing
_addLayers handed MapLibre a URL and let it fetch the GeoJSON internally — a 422 (a file REXML/Fit can't parse) just meant the layer never appeared, with nothing telling the user why. It now fetches the file itself first, alerts with the actual error and un-checks the box on failure.
This commit is contained in:
1 parent
a0476f1204
commit
11fc14824e
2 files changed
+41
-7
No files matched your search
@@ -189,7 +189,13 @@ equivalent, so it never produces `Point` features. MapLibre's
|
||||
`geometry-type` expression treats `MultiLineString` the same as
|
||||
`LineString`, so a single GeoJSON source per file with a `line` layer
|
||||
and a `circle` layer (each filtered by geometry type) is enough to
|
||||
render both.
|
||||
render both. Checking a file fetches its GeoJSON itself
|
||||
(`public/js/gpx.js`'s `_addLayers`) and hands the parsed result to
|
||||
`addSource` — rather than passing MapLibre a URL and letting it fetch
|
||||
internally — specifically so a `422` (a file REXML or `Fit` can't
|
||||
parse) surfaces as an alert and un-checks the box instead of the layer
|
||||
just silently never appearing, which is what a `data: url` source does
|
||||
on a failed fetch.
|
||||
|
||||
FIT parsing:: No gem was added for this — the one Ruby option
|
||||
(`fit-parser`, tjwallace/fit) hasn't been touched since 2022 and pulls
|
||||
|
||||
Reference in new issue
Block a user