Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#18494 closed enhancement (fixed)

[RFC PATCH] GPX layers should use the name from the file instead of `Downloaded GPX Data` whenever possible

Reported by: taylor.smock Owned by: team
Priority: normal Milestone: 20.01
Component: Core Version:
Keywords: gpx Cc:

Description (last modified by Don-vip)

Right now it is not possible to set the name of a GPX layer on download. This means that GPX layers are commonly called Download GPX Data. It would be nice, if there is a name in the metadata, if JOSM could use that instead.

Use cases:
Tasking Managers could send an XML file that looks like this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<gpx creator="HOT Tasking Manager" version="1.1">
  <metadata>
    <link href="https://github.com/hotosm/tasking-manager">
      <text>HOT Tasking Manager</text>
    </link>
    <time>2019-12-31T21:56:28.586152</time>
    <name>Tasking Manager: Project 1, Task 1</name>
  </metadata>
  <trk>
    <name>Task for project 1. Do not edit outside of this area!</name>
    <trkseg>
      <trkpt lat="39.070328" lon="-108.561121"/>
      <trkpt lat="39.070438" lon="-108.571025"/>
      <trkpt lat="39.077663" lon="-108.57099"/>
      <trkpt lat="39.077499" lon="-108.56091"/>
      <trkpt lat="39.070328" lon="-108.561121"/>
    </trkseg>
  </trk>
  <wpt lat="39.070328" lon="-108.561121"/>
  <wpt lat="39.070438" lon="-108.571025"/>
  <wpt lat="39.077663" lon="-108.57099"/>
  <wpt lat="39.077499" lon="-108.56091"/>
  <wpt lat="39.070328" lon="-108.561121"/>
</gpx>

Please note that the current version of the tasking manager (TM3) creates an empty layer with the desired name and then loads in the GPX file.

Attachments (3)

18494.patch (1.5 KB ) - added by taylor.smock 5 years ago.
Initial patch (no tests)
18494.1.patch (4.3 KB ) - added by taylor.smock 5 years ago.
Move newLayerName logic to getLayerName function. Also, remove a pointless call in GpxLayer (super(nameInFile); setName(name);, where the super call essentially sets the name is pointless).
18494.2.patch (4.9 KB ) - added by taylor.smock 5 years ago.
Add advanced config variable to use meta data name over filename

Download all attachments as: .zip

Change History (10)

by taylor.smock, 5 years ago

Attachment: 18494.patch added

Initial patch (no tests)

comment:1 by taylor.smock, 5 years ago

Summary: [PATCH] GPX layers should use the name from the file instead of `Downloaded GPX Data` whenever possible[RFC PATCH] GPX layers should use the name from the file instead of `Downloaded GPX Data` whenever possible

As I was writing the test, I noticed that the default name comes from the file name.

What should be preferred? Name from file name, or name from the metadata? I (think) name from file name should be preferred, but it will make it harder to write a test case.

by taylor.smock, 5 years ago

Attachment: 18494.1.patch added

Move newLayerName logic to getLayerName function. Also, remove a pointless call in GpxLayer (super(nameInFile); setName(name);, where the super call essentially sets the name is pointless).

comment:2 by Don-vip, 5 years ago

Description: modified (diff)

comment:3 by Don-vip, 5 years ago

I would say file name should have priority over metadata. An advanced property that inverts this behaviour would be okay if you think it's worth it.

in reply to:  3 comment:4 by taylor.smock, 5 years ago

Replying to Don-vip:

I would say file name should have priority over metadata. An advanced property that inverts this behaviour would be okay if you think it's worth it.

I don't think it would be worth the added complexity. I'd pretty much have to have two branches, both doing essentially the same thing, but with the order reversed.

by taylor.smock, 5 years ago

Attachment: 18494.2.patch added

Add advanced config variable to use meta data name over filename

comment:5 by Don-vip, 5 years ago

Milestone: 20.01

comment:6 by Don-vip, 5 years ago

Resolution: fixed
Status: newclosed

In 15646/josm:

fix #18494 - GPX layers should use the name from the file instead of Downloaded GPX Data whenever possible (patch by taylor.smock, modified)

comment:7 by Don-vip, 5 years ago

In 15652/josm:

see #18494 - fix NPE when downloading GPX data by bounds and not by URL

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.