Commit graph

594 commits

Author SHA1 Message Date
Marcus Jaschen
9e47cf24e4 Enable sharing via Mastodon
Sharing works now with newer Mastoton releases.
2024-06-01 16:15:34 +02:00
Henrik Fehlauer
8809fa94cf
Prevent Gpsies-style export from throwing for undefined symbols
While abrensch/brouter@82fecf9 fixed the export already by avoiding the
problematic `OFFR` voice hint, we would still throw in case we
encountered an `undefined` symbol entry:

> Uncaught TypeError: Cannot read properties of undefined (reading
> 'toLowerCase')

This can be prevented by not calling `toLowerCase()` on `undefined`
objects.

Fixes #751

Test Plan:
  - Change `VoiceHints.commands` to contain `undefined` entries for a
  particular voice hint.
  - Create a route with that voice hint.
  - Test that exporting for each `turnInstructionMode` does not throw.
2023-07-08 09:50:13 +00:00
Henrik Fehlauer
96016b7fd0
Document new export formats added in BRouter 1.7.0 and fix export error
BRouter 1.7.0 implemented support for three new export formats:
"Cruiser", "BRouter internal" and "Locus(-new)".

"Cruiser" (`turnInstructionMode=8`) and "BRouter internal"
(`turnInstructionMode=9`) are not yet exposed in BRouter-Web's UI
through profiles, so we do not need to implement them at the moment.
Here we only document them by making them explicit unimplemented `cases`
in the code.

In addition, BRouter changed "locus-style" with `turnInstructionMode=2`
to emit a different format for newer releases of Locus, while the old
format is now referred to as "locus-old-style" from profiles with
`turnInstructionMode=7`. Since BRouter-Web does not know yet about the
the new id, exports will fail with "unhandled turnInstructionMode"
errors.

To fix the latter issue, we now map `turnInstructionMode=7` to the newly
renamed `LocusOldVoiceHints()`. Note that `turnInstructionMode=2` is
also currently using `LocusOldVoiceHints()`, i.e. the new format still
needs an implementation.

Test Plan:
  - `yarn test`
  - Check choosing "locus-old-style" now exports without an error.
2023-07-07 16:44:21 +00:00
Henrik Fehlauer
eeb1c5bde3
Emit console warning when using an unsupported BRouter version
abrensch/brouter@c9ae7c8681 changed indexing of voice hint ids, because
some new hints were inserted in the middle instead of strictly at the
end, changing the numbering of existing ids. For example, now id `12`
was sent to indicate a right u-turn, while we still assume the old
meaning of `12`, i.e. "off route". This clearly was an API break.

This leads us to abort exporting with the Gpsies turn instructions
style, since `OFFR` has an `undefined` symbol assigned, as well as
emitting wrong voice hints for ids after `9`. Another unwelcome side
effect is showing negative exit numbers for roundabouts.

This breakage in the GeoJSON HTTP API has been shipping in BRouter 1.7.0
and 1.7.1 and finally got fixed with abrensch/brouter@82fecf9 contained
in BRouter 1.7.2 or later. Earlier releases like 1.6.3 are also
unaffected. To avoid emitting incorrect voice hints in BRouter-Web,
running with broken versions of BRouter should be avoided.

By checking the "Creator" field after receiving the first response from
BRouter, we can now emit a warning if the version of BRouter used is
unsupported. The warning mostly targets administrators and power users,
i.e. those responsible for choosing the software versions used, and it
is also only shown once per session.

Note that the version check is compatible with the common "SemVer"
scheme, so the check should continue working and even support more
complex version compatibility scenarios as long as BRouter stays
SemVer-compliant.

Ref #751

Test Plan:
  - Run with BRouter 1.6.3 and 1.7.2, no warnings shown.
  - Run with BRouter 1.7.0 and 1.7.1, warnings shown only for the first
  segment.
2023-07-06 09:46:47 +00:00
Henrik Fehlauer
3f241c9180
Add BL and TLU to VoiceHints as contained in BRouter 1.7.2
abrensch/brouter@c9ae7c8681 added support for two new voice hints: A
hint for beelines (`BL`), and a hint for 180 degree u-turns (`TU`). By
adding support for both, we now know about all types of voice hints as
defined in BRouter again.

What makes things confusing is that the `TU` name for the respective
`static final int` constant in BRouter's `VoiceHint.java` was repurposed
for 180 degree u-turns, with left u-turns now being mapped to the new
`TLU` constant name. Also note that originally the indexing of voice
hints as used in BRouter's GeoJSON API has been changed as well due to
inserting new commands in the middle of the numbering scheme instead of
at the end. This API break has been fixed only in
abrensch/brouter@82fecf9. Here we will rely on the fixed indexing,
BRouter versions 1.7.0 and 1.7.1 without the re-indexing revert will not
be supported.

In addition, the voice hint mapping table has been checked to be
identical to BRouter (this led to adding a missing `OFFR` symbol), and
clarifying comments for planned future changes (e.g. changing the `TU`
output token to `TLU` for OsmAnd) have been added.

Note that beelines and 180 degree u-turns are only added to the mapping
table for completeness. As BRouter-Web is handling straight lines on the
client-side exclusively (which makes sense performance-wise when loading
a route from a pasted URL with lots of them tracing an unmapped path),
they are not expected to be in any GeoJSON response from BRouter, at
least as of now. The same is true for 180 degree u-turn voice hints at
cul-de-sac-style vias. If and when to emit voice hints for both cases in
BRouter-Web itself is a different question, though it could likely also
use the table for lookup.

Test Plan:
  - `yarn test`
  - Confirm voice hints for routes with roundabouts and u-turns are
  unchanged.
2023-07-05 06:26:07 +00:00
Marcus Jaschen
4c276428a6 Add "Help" dialog which shows available keyboard shortcuts
Dialog can be toggled via button in "About" or via keyboard shortcut "?"
2023-06-11 09:21:13 +02:00
Marcus Jaschen
b78e0e82ce Wrap long URLs in custom layers overlay 2023-06-02 08:06:55 +02:00
Norbert Renner
2493fd6465 Fix hash formatting for POI at 0,0
Opening this URL and moving the map produces `pois=NaN,NaN` in the URL hash:
https://brouter.de/brouter-web/#map=2/0/0/standard&pois=0,0,Null%20Island
2023-05-17 13:02:47 +02:00
Norbert Renner
43b1b70a0a Don't filter points of GeoJSON layer (#727) 2023-05-17 12:27:23 +02:00
Norbert Renner
b772924106 Move export dialog check outside onUpdate (#729)
to only check once on init, not on every update. Waypoints available at time of callback. Add check for lonlats param as event isn't called without and error check.
2023-05-16 11:55:26 +02:00
Marcus Jaschen
3b3357c473
Share Dialog with QR Code (#729) 2023-05-16 11:31:32 +02:00
Manuel Fuhr
4e719daee1 Implement simplestyle for GeoJSON 2023-04-20 22:45:13 +02:00
Manuel Fuhr
0e462aac86 Support GeoJSON layers 2023-04-20 22:44:28 +02:00
Norbert Renner
89ecdcd84f Disable cost gradients and simplification (#693) 2023-02-20 12:48:42 +01:00
quaelnix
c2ef8e83ec
Improve 'route quality cost' color coding (#693)
This improves the color coding of the 'route quality cost' overlay by omitting 5% of the largest cost values when calculating min-max values.
2023-02-20 12:08:39 +01:00
quaelnix
a35814b8b3
Add seconds display in title attribute of total time (#696) 2023-02-16 18:44:05 +01:00
Tobias
8b311b1add Bugfix: TrackAnalysis selected edges lingered after route deletion 2022-11-05 20:05:40 +01:00
Tobias
260f34521e Bugfix: TrackMessage selected edge lingered after route deletion 2022-11-05 19:56:24 +01:00
Norbert Renner
b3e788eec4
Merge pull request #621 from tbsmark86/road-quality
Road surface as quality color + highlight matching row when hovering route on map
2022-11-03 11:55:22 +01:00
Tobias
aae95877b6 Replaced logic to find nearest segment with turf.nearestPointOnLine()
More accurate on routes that are shaped like an 'U' for whatever reason.
2022-11-02 20:26:32 +01:00
Norbert Renner
7d76ac513e
Merge pull request #641 from tbsmark86/master
Exporting to FIT #322
2022-10-01 12:08:51 +02:00
Sylvain
91a03f312c
Add IGNF Scan25 baselayer (requires key) (#643) 2022-09-28 21:03:04 +02:00
Tobias
f2d034ce8a Improved TrackMessages: highlight matching row when hovering route on map 2022-09-23 22:35:36 +02:00
Tobias
db2c43c973 Incorporated review feedback 2022-09-23 22:35:36 +02:00
Sylvain
72a92eb156
Add ignf aerial pictures and base map (#636)
* add ignf layers

* removes ignf-boundaries

* Assign France bbox to IGNF layers

but don't restrict bounds because world wide coverage in lower zooms

Co-authored-by: Sylvain Lafay <sylvain.lafay@gmail.fr>
Co-authored-by: Norbert Renner <norbert.renner@gmx.de>
2022-09-16 10:58:30 +02:00
Tobias
a376c4725c New info icons for export
* if format will include turns
* warning fit with server download
2022-09-14 21:02:50 +02:00
Tobias
3e81d80cc5 Added new export as FIT file format fixes #322
Actual FIT encoding logic created as a new repo "fit-file-writer"
2022-09-14 21:02:50 +02:00
Tobias
39aa813ea1 Added new quality mode: surface type
Required fork of leaflet-hotline with a new option to disable the
gradient display.
This is was done so that short stretches of very bad surface adjacent to
very good ones are visible.

Also note the eslint-disable-line for this compat warning:
  URLSearchParams is not supported in Safari 7, op_mini all, IE 10, android 4.1
don't seem relevant today because those are EOL for a long time now.
2022-08-28 11:46:59 +02:00
Norbert Renner
dcec6d4b77 Add GPX link (brouter#152) 2022-08-02 20:02:23 +02:00
Norbert Renner
6bcee783fd Disable go-to zones (#450) 2022-07-18 16:13:27 +02:00
Norbert Renner
8d043c9b37 Support transparent WMS property (fix #468) 2022-07-13 10:41:18 +02:00
Marcus Jaschen
e058802777
uses existing function for escaping Overpass data; escape keys too (#575) 2022-07-01 11:05:14 +02:00
Marcus Jaschen
f68d32b1f2
Improves rendering of Overpass data; add OSM link to Overpass popups (see #467) (#574)
- add some styling to the Overpass data table (alternating row colors; text alignment)
- add link to OSM object below the Overpass data table
- add 4 new entries in `en.json`
2022-06-30 11:15:01 +02:00
Norbert Renner
4a31ebe112 Fix download click for Firefox < 75 (attach to DOM) 2022-06-29 10:01:45 +02:00
Norbert Renner
74a6bcd92e Fix parse error for import() in older browsers (#571)
- add import() polyfill that evals in Function() and falls back to script tag injection
- add AbortController polyfill for MapLibre (lazy loaded so can be in bundle, not for Web Workers)
- support Firefox 56, last supporting old plugins before Web Extensions
2022-06-28 18:54:21 +02:00
Marcus Jaschen
46a1a61138
add support for vector sources specified by url (#566) 2022-06-25 11:13:04 +02:00
Norbert Renner
8194c7896c Fix trekking profile not loaded
when hash without additional params, regression of 4d44153
2022-06-24 21:35:26 +02:00
Norbert Renner
b894639c2f Prevent sporadic canvas mouseout bubbling to map
Fixes #561
2022-06-21 20:37:02 +02:00
Norbert Renner
5cce9f92c2 Fix global assignments 2022-06-20 09:38:53 +02:00
Norbert Renner
c585b5aa62 Support access tokens for Maplibre (mvt) tile urls 2022-06-17 16:58:36 +02:00
Norbert Renner
ad68d0023b Configure hillshading layer
- full attribution
- i18n key
- paint property defaults as template
2022-06-15 14:21:31 +02:00
Norbert Renner
8c8582ac19 Replace HikeBike.HillShading layer id
from hash and stored active layers, also add replacing from stored default layers
2022-06-14 13:25:51 +02:00
Norbert Renner
13efb4864c Lazy load Maplibre GL JS and add hillshading layer 2022-06-14 10:00:13 +02:00
Norbert Renner
a57a560950 Fix default profile not selected with hash 2022-06-07 19:26:41 +02:00
Marcus Jaschen
8750c37901
Fix for incomplete/buggy solution for #494 (#553)
This commit fixes the incomplete/buggy implementation of the fix for #494.
Values are now converted to the expected format before returned from
`wayTagsNormalize()`.
2022-06-07 11:32:47 +02:00
Norbert Renner
198f65e5bc Disable preloading states to reduce traffic on start 2022-06-01 16:53:23 +02:00
Marcus Jaschen
4b5d08e5ed
fix for #494 (#550)
If a way segment contains more than one `surface` tags (e.g.
`surface=*` and `cycleway:surface=*`), the tag best suited for the
current routing type (currently only *cycling* is supported) is
selected.

i.e. if a `cycleway:surface=` tag belongs to the current way segment
it will be used for the analysis exclusively (all other `surface`
tags are skipped from now on).
2022-06-01 11:08:06 +02:00
Norbert Renner
0fc60c1821 Work around iOS 3rd party browser download (#418)
- use FileReader.readAsDataURL (for iOS Chromium)
- add alternative Download from Server for now until proven in Prod and fixed in iOS Firefox (no i18n)
- replace cloud icons as client-side now
2022-05-28 14:27:32 +02:00
Norbert Renner
1d26949770 Refactor download 2022-05-27 12:16:05 +02:00
Norbert Renner
99a00e5948 Allow empty name with client-side formatting (#454) 2022-05-24 22:00:59 +02:00