Opened 3 years ago
Last modified 3 years ago
#22492 new defect
Deleting GPX point timestamp does not work
| Reported by: | anonymous | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | |
| Keywords: | template_report | Cc: |
Description
What steps will reproduce the problem?
- Open GPX file, convert is to a data layer
- Select 1 or ALL points in the track.
- Remove the timestamp of 1 or ALL points
- Export to GPX or convert back to GPX.
- The timestamps all remain unchanged.
- It only works if the timestamps of the points are CHANGED to a different time, not deleted.
What is the expected result?
Expected will be a GPX track with NO timestamps.
What happens instead?
All the timestamps remain unchanged.
Please provide any additional information below. Attach a screenshot if possible.
Revision:18543 Build-Date:2022-08-30 13:34:09 Identification: JOSM/1.5 (18543 en_GB) Windows 10 64-Bit OS Build number: Windows 10 Home N 2009 (19044) Memory Usage: 426 MB / 4028 MB (94 MB allocated, but free) Java version: 17.0.4+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1920×1080 (scaling 1.00×1.00) Maximum Screen Size: 1920×1080 Best cursor sizes: 16×16→32×32, 32×32→32×32 System property file.encoding: Cp1252 System property sun.jnu.encoding: Cp1252 Locale info: en_GB Numbers with default locale: 1234567890 -> 1234567890 VM arguments: [-Djpackage.app-version=1.5.18543, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe] Program arguments: [C:\0807\Desktop\Projects\TurnovoRuns\Projects\Traseta\Shipka-Buzludzha\2022-02-25 124752 ????__20220225_1247.gpx] Dataset consistency test: No problems found Plugins: + imagery_offset_db (35978) + measurement (35978) + turnrestrictions (36011) Last errors/warnings: - 00012.677 E: Error - <html>Could not read file '2022-02-25 124752 ????__20220225_1247.gpx'.<br>Error is:<br>java.nio.file.InvalidPathException: Illegal char <?> at index 89: C:\0807\Desktop\Projects\TurnovoRuns\Projects\Traseta\Shipka-Buzludzha\2022-02-25 124752 ????__20220225_1247.gpx</html> - 00170.345 E: Failed to locate image 'Summit' - 00170.346 E: Failed to locate image 'Skull and Crossbones' - 00170.347 E: Failed to locate image 'Skull and Crossbones' - 00170.350 E: Failed to locate image 'Parking Area' - 00170.353 E: Failed to locate image 'Trail Head' - 00170.354 E: Failed to locate image 'Trail Head' - 00170.355 E: Failed to locate image 'Lodge' - 00170.356 E: Failed to locate image 'Drinking Water' - 00313.661 W: java.net.SocketTimeoutException: Connect timed out
Attachments (0)
Change History (2)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
The time element is technically optional. So this shouldn't be too difficult to fix.
EDIT: Nevermind. It looks like it is going to be breaking several public methods to fix this.
This would be the "easiest" fix that closes this ticket. Unfortunately, it also means that older behavior would not work, and converting an arbitrary way to a GPX file would probably fail.
-
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
a b 886 886 wpt.setTimeInMillis(time); 887 887 } else if ((v = gpxVal(n, gpxPrefix, GpxConstants.PT_TIME)) != null) { 888 888 wpt.setInstant(DateUtils.parseInstant(v)); 889 } else if (!n.isTimestampEmpty()) {890 wpt.setInstant(n.getInstant());891 889 } 892 890 } catch (UncheckedParseException | DateTimeException e) { 893 891 Logging.error(e);
In order to really fix this, I'm going to need to extract the OSM to GPX translation code to its own class and add a UI asking the user if they want to keep the node timestamp.



I am not sure if timestamps are needed for gpx files. E.g. the editgpx plugin sets the time to "1970-01-01 00:00" to anonymize the timestamp.