tumic0 / GPXSee

GPS log file viewer and analyzer with support for GPX, TCX, KML, FIT, IGC, NMEA, SLF, SML, LOC, GPI, GeoJSON and OziExplorer files.
https://www.gpxsee.org
GNU General Public License v3.0
974 stars 132 forks source link

Ignore "invalid longitude"? #460

Closed endolith closed 1 year ago

endolith commented 1 year ago

I get this error:

Error loading data file:

x.gpx

Invalid longitude Line: 141

This is because of a line

<wpt lat="" lon="">
    <name>Field: The Quarantine </name>
</wpt>

Can these points just be ignored, instead of preventing the display of the entire file?

(This is an export from thecrag.com: https://www.thecrag.com/en/climbing/united-states/shawangunks/area/12665701/gpx)

tumic0 commented 1 year ago

While some errors like this might be theoretical ignored, it is a way to hell to do so. Things that work in some cases are much harder to debug than when they do not work at all. Moreover, support for broken files additionally encourages authors of broken file generators to not care about what they produce - look at HTML where this got us... Finally, this is not some corner case but a 100% clear violation of the GPX file format so the solution is to report it to the producer and make them to fix it. For all consumers, not just GPXSee.

endolith commented 1 year ago

Things that work in some cases are much harder to debug than when they do not work at all.

All I'm asking is for invalid points to be ignored and the rest to be displayed. It's fine to also display an error message, but my usage of GPXSee is to quickly view a file and see what it contains.

Moreover, support for broken files additionally encourages authors of broken file generators to not care about what they produce

Even if you can get every publisher to fix their code to prevent creating more of them in the future, "broken" files already exist.

100% clear violation of the GPX file format

What is the violation? This is an XML attribute which is allowed to be empty? But it's a violation of the GPX rules in particular?

Ah: '' Is Not A Valid Value For 'decimal'., Line '140', Column '20'.

For all consumers, not just GPXSee.

No other software I've used has a problem with these files, only GPXSee.

tumic0 commented 1 year ago

All I'm asking is for invalid points to be ignored and the rest to be displayed. It's fine to also display an error message, but my usage of GPXSee is to quickly view a file and see what it contains.

Someone else's use case (for example mine) is to quickly view a file and at the same time see if it is valid*. Without running it from a terminal (or even much harder on windows using debugview) and looking at stderr, which is the way how warnings are handled. Without the error you would not get the message that something is wrong with the file which might be essential for you when you are a GPX file producer.

Even if you can get every publisher to fix their code to prevent creating more of them in the future, "broken" files already exist.

But they can be (in case of GPX very easily) fixed. In a way where you decide what to do - remove the point or add the missing coordinates. And as a bonus, you get the info that the file producer produces crap and does not care about it as this really is a super simple and crucial file format error.

What is the violation? This is an XML attribute which is allowed to be empty? But it's a violation of the GPX rules in particular?

The authoritative source of the GPX document format is it's XSD (human readable form), not some random Stack Overflow answer. And it clearly states, that lat/lon must be a decimal number in the correct range (the semantics even dictates more, like that the datum is WGS84 in decimal degrees notation).

No other software I've used has a problem with these files, only GPXSee.

And this is why you missed the info, that there are some broken entries in the file. You might not be interested to know that, but others may. GPXSee is in many aspects different than "other software". Sometimes it is a bug, but in many cases this is intentional. One of them is, that it does not tolerate absolute crap as input.

* GPXSee does not do a full validation of any of the supported formats, but crucial things like corect coordinates are always checked.

Tux commented 1 year ago

I am 100% with @tumic0 on this! I use it like that too. If you want more "forgiving" software offering GPXSee-like behavior, have a look at TouchTrails (Android) or Viking (Linux)