GPSBabel / gpsbabel

GPSBabel: convert, manipulate, and transfer data from GPS programs or GPS receivers. Open Source and supported on MacOS, Windows, Linux, and more. Pointy clicky GUI or a command line version...
https://www.gpsbabel.org
GNU General Public License v2.0
475 stars 126 forks source link

Exporting as GPX always fills "<cmt>" and "<desc>" even if not existent in the source file #1255

Closed M-Reimer closed 8 months ago

M-Reimer commented 8 months ago

I'm not quite sure if this is a bug or intended behavior.

My source file has a waypoint like this:

<wpt lat="12.34" lon="12.34">
  <time>2015-11-13T15:26:05Z</time>
  <name>Am Hohenrod</name>
</wpt>

If I just pass this through gpsbabel, it results in:

<wpt lat="12.34" lon="12.34">
    <time>2015-11-13T15:26:05Z</time>
    <name>Am Hohenrod</name>
    <cmt>Am Hohenrod</cmt>
    <desc>Am Hohenrod</desc>
  </wpt>

And this actually also happens with other export formats.

Why?

robertlipe commented 8 months ago

Different GPX readers read different "string things" as the canonical name. So if we have nothing for a field, we give it what we have to avoid having to have flags for "populate desc from cmt", "populate cmt from desc", "populate desc from name", etc...

On Sun, Jan 21, 2024 at 10:47 AM Manuel Reimer @.***> wrote:

I'm not quite sure if this is a bug or intended behavior or a bug.

My source file has a waypoint like this:

Am Hohenrod

If I just pass this through gpsbabel, it results in:

Am Hohenrod Am Hohenrod Am Hohenrod

And this actually also happens with other export formats.

Why?

— Reply to this email directly, view it on GitHub https://github.com/GPSBabel/gpsbabel/issues/1255, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCSD344SALBMVTXOQ6GS4DYPVBALAVCNFSM6AAAAABCEDLOJ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4TENRWGYYTINI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

M-Reimer commented 8 months ago

This IMHO should be optional. I want to deliver my files over the internet and this is wasted space and takes longer to transmit.

For me the much bigger problem is that I have a similar issue with GeoJSON. The Name is copied to the description there also.

GPSBabelDeveloper commented 8 months ago

Lucky for you, compression has been the norm on the internet for most of the last 20 years. Those additional lines with completely identical tokens cost almost nothing.

If you control the reader and know exactly what fields will be harvested, you can disable the code at the end of waypt_add(), but we have to support millions of users with hundreds of applications.

On Sun, Jan 21, 2024 at 4:51 PM Manuel Reimer @.***> wrote:

This IMHO should be optional. I want to deliver my files over the internet and this is wasted space and takes longer to transmit.

For me the much bigger problem is that I have a similar issue with GeoJSON. The Name is copied to the description there also.

— Reply to this email directly, view it on GitHub https://github.com/GPSBabel/gpsbabel/issues/1255#issuecomment-1902792830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3VAD2UGZABDGDMFFXXFUDYPWLY5AVCNFSM6AAAAABCEDLOJ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG44TEOBTGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

M-Reimer commented 8 months ago

So if this is required for GPX to support some special cases, would it be OK to clean that up for GeoJSON export at least?

I wanted to use GeoJSON for a web map (Leaflet) and I need to know there if there was a description defined as having a description changes how the POI looks (POIs with a description can be clicked and the description displays in a popup). If the name is duplicated to the description, then all POIs render with "clickable style".

robertlipe commented 8 months ago

The basic problem exists in all formats. This isn't a GPX-specific issue. This is a fundamental problem of converting a hundred or so formats arbitrarily. You never know where any given writer for a format is going to store something or where any given reader is going to read from it, so we overfill to solve the "I had names in X but when i import into Y, you lost all my names, you SUCK!" problem.

Leaflet is only one reader of GeoJSON. We have over a hundred possible input types, so we can't cater to every possible reader. We provide SOMETHING in all the possible places.

As I said, you're welcome to patch your copy. I pointed you to the exact lines to change. The whole point of open source is that you're always eligible to change it to fit exactly your own needs.

On Sun, Jan 21, 2024 at 8:13 PM Manuel Reimer @.***> wrote:

So if this is required for GPX to support some special cases, would it be OK to clean that up for GeoJSON export at least?

I wanted to use GeoJSON for a web map (Leaflet) and I need to know there if there was a description defined as having a description changes how the POI looks (POIs with a description can be clicked and the description displays in a popup). If the name is duplicated to the description, then all POIs render with "clickable style".

— Reply to this email directly, view it on GitHub https://github.com/GPSBabel/gpsbabel/issues/1255#issuecomment-1902905970, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCSD32DWLQGOBC2BNPTJ2LYPXDLXAVCNFSM6AAAAABCEDLOJ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSHEYDKOJXGA . You are receiving this because you commented.Message ID: @.***>

M-Reimer commented 8 months ago

And some kind of "don't reinvent new output fields" command line switch wouldn't possibly be a feature that could be useful to others?

robertlipe commented 8 months ago

If you're asking for encouragement to submit your patch to the group, please don't.

To your original question, I should have been clearer that this is very much intended and engineered-in behaviour.

RJL

On Sun, Jan 21, 2024 at 11:46 PM Manuel Reimer @.***> wrote:

And some kind of "don't reinvent new output fields" command line switch wouldn't possibly be a feature that could be useful to others?

— Reply to this email directly, view it on GitHub https://github.com/GPSBabel/gpsbabel/issues/1255#issuecomment-1903301620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCSD37FDUTFWBDVOXDCK23YPX4J3AVCNFSM6AAAAABCEDLOJ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBTGMYDCNRSGA . You are receiving this because you commented.Message ID: @.***>

M-Reimer commented 8 months ago

Thanks for the information. Then GPSbabel is not the right tool to solve my problem.