-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Garmin GPX Conversion #416
Comments
Additional notes:
File NOT OK = Windows (CR LF) File NOT OK = Unix (LF) I don’t know – at this moment – if (CR LF) or (LF) is relevant. But for Unix (LF) seems best option, always accepted.
BOM might be the only issue! BOM is first 3 – invisible - Characters in a file: Chr(239) & Chr(187) & Chr(191) These 3 characters have to be removed! This is the Error Message: “ERROR:root:not well-formed (invalid token): line 1, column 1” IMO: line 1, column 1 (+2, +3) = BOM Remark:
|
Just to add a small nuance: BOM (Byte Order Mark) is not a requirement for Windows. In Windows, interpreting the correct file encoding is up to the software, not the OS. However, you were almost correct, almost all Microsoft software and compilers require and use the BOM for UTF-8 files. So while it's not a requirement for Windows software, it is the de facto default... Also note that while the Unicode Standard does not recommend using a BOM for UTF-8, it does allow it, so it is perfectly valid. |
Steps to reproduce the Error: mapillary_tools process If [gpx file] is directly copied from GPS device (f.i. “2021-10-12 15.02.gpx”) then [gpx file] is in “UTF-8, no BOM” format. This is “perfectly valid” for “mapillary_tools process”. If, however, [gpx file] is first uploaded to BaseCamp en then exported as [gpx file] from BaseCamp (f.i. “GPX_BASECAMP_BOM.gpx”), the exported [gpx file] is in “UTF-8, BOM” format. BOM in [gpx file] is not accepted as valid by “mapillary_tools process”: “mapillary_tools:" version 0.8.0 (or older version). To resolve by “mapillary_tools": either remove BOM if present in [gpx file], or “\gpxpy\parser.py" should accept BOM as being valid in a [gpx file]. Error Message: ERROR:root:not well-formed (invalid token): line 1, column 1 Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
I could if I would know how to get this: "which upgrade the gpx library to latest"". It's not in my recent update: python3 -m pip install --force-reinstall --upgrade git+https://github.com/mapillary/mapillary_tools (Or: it's not fixed...) |
Could you check:
It should be 1.4.2. If not
|
e:_APPS\Mapillary\mapillary_tools>Python -m pip show gpxpy So: it's not fixed. But Error Msg is different and shorter (see below). If I do remove BOM in <<gpx_file>> before processing, then it's okay. mapillary_tools process G:\2_mapillary\20210612_GPX_BOM_TEST --skip_subfolders --geotag_source_path G:\2_mapillary\20210612_GPX_BOM_TEST\Woerden-Soest_12-06-2021_51km_BOM.gpx --geotag_source gpx --interpolate_directions Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
User reports: “ERROR: mapillary_tools process not possible when parameter = --geotag_source gpx”.
User finds the issue is that the specific Garmin device's GPX seems to not match the format that mapillary_tools expects:
--geotag_source gpx is processing a gpx file.
But mapillary_tools is expecting a Unix, UTF8 file.
If the gpx file is created by Garmin GPS and processed on a Windows OS, the file is not expected format.
mapillary_tools is not validating the input file and not returning an Error Message I understand.
To convert the GPX file:
Replace CrLf (Windows) by Lf (Unix)
Remove 3x BOM header characters (Windows)
And - perhaps - convert to UTF8.
Now the GPX input file will be processed correctly
^^ following this, we should consider either a handler with the GPX process fails to then run this conversion, or a handler before attempting to process the GPX to run this conversion or see if the headers exist and should be removed, and if not in UTF8 to then convert it.
@ptpt could you take a look at this in a next update?
The text was updated successfully, but these errors were encountered: