Modify

Opened 5 months ago

Closed 5 months ago

Last modified 3 months ago

#23735 closed defect (fixed)

[Patch] Combine ways refused

Reported by: nkamapper Owned by: GerdP
Priority: normal Milestone: 24.06
Component: Core Version: tested
Keywords: template_report combine way parent Cc:

Description (last modified by nkamapper)

What steps will reproduce the problem?

  1. Download ways with Overpass, for example:
[out:xml][timeout:90];
{{geocodeArea:Arendal}}->.searchArea;
(
  nwr["waterway"](area.searchArea);
);
(._;>;<;);
out meta;
  1. Select two ways which are connected with a common node, for example at node 4157936458.


  1. Apply Tools -> Combine ways.

What is the expected result?

The two ways should be concatenated into one way.

What happens instead?

Since 19096 I get this error message: "Combine ways refused (A shared node may have additional referrers)."

Please provide any additional information below. Attach a screenshot if possible.

During imports I am doing hundreds of these combinations, so this slows down editing considerably. Parents were already downloaded with the recurse up operator above, so the refusal should not be needed.

Revision:19096
Build-Date:2024-06-04 11:25:36

Identification: JOSM/1.5 (19096 en_GB) Mac OS X 12.7.4
OS Build number: macOS 12.7.4 (21H1123)
Memory Usage: 1684 MB / 4096 MB (349 MB allocated, but free)
Java version: 21.0.3+9-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 69733568 1440×900 (scaling 2.00×2.00)
Maximum Screen Size: 1440×900
Best cursor sizes: 16×16→16×16, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=19096, --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.apple.eawt=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=/Applications/JOSM.app/Contents/MacOS/JOSM]
Dataset consistency test: No problems found

Plugins:
+ PicLayer (1.0.3)
+ RelationDissolve (0.2.0)
+ apache-commons (36273)
+ apache-http (36273)
+ changeset-viewer (0.0.7)
+ conflation (0.6.11)
+ ejml (36176)
+ ext_tools (36126)
+ geotools (36273)
+ imagery-xml-bounds (36196)
+ jackson (36273)
+ jaxb (36118)
+ jna (36273)
+ jts (36004)
+ log4j (36273)
+ opendata (36256)
+ pdfimport (36205)
+ reverter (36256)
+ scripting (v0.3.1)
+ todo (137)
+ utilsplugin2 (36241)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/LaneAttributes&zip=1
+ https://raw.githubusercontent.com/OpenNauticalChart/josm/master/INT-1-preset.xml

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://raw.githubusercontent.com/OpenSeaMap/josm/master/CEVNI_MapCSS.mapcss
- https://raw.githubusercontent.com/OpenSeaMap/josm/master/INT1_Seamark.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1

Attachments (7)

delete.JPG (25.3 KB ) - added by GerdP 5 months ago.
23735.patch (2.9 KB ) - added by GerdP 5 months ago.
Improve test to check selected ways and not the node, show dialog to confirm the risky operation
confirm-combine.JPG (25.4 KB ) - added by GerdP 5 months ago.
combine-hint.JPG (30.0 KB ) - added by GerdP 5 months ago.
dialog with hint for action and shortcut
23735-2.patch (3.2 KB ) - added by GerdP 5 months ago.
add hint reg. Download parent action
23735-auto-download.patch (4.5 KB ) - added by GerdP 5 months ago.
Solution for automatic download of parents? It checks if preference combine.download-parents is true.
Combine-Bug.osm (97.7 KB ) - added by MSiipola 5 months ago.
File with two ways which can't be combined. File is an extract of a bigger file, where the other objects are deleted.

Download all attachments as: .zip

Change History (38)

comment:1 by nkamapper, 5 months ago

Description: modified (diff)

comment:2 by skyper, 5 months ago

Keywords: combine way parent added
Version: tested

This check needs to be rewritten. Using the trick that at least one child node needs to be within downloaded area does not work anymore and is wrong plus the message is misleading. Additionally, this should be a non-blocking warning with an option to continue anyway.

Regarding overpass, there might be more work to get the flag that all parents have been loaded correct.

Last edited 5 months ago by skyper (previous) (diff)

comment:3 by GerdP, 5 months ago

Yes, since r19078 one has to download the parents of the connection node first. I think this was intended since #18083 but the test didn't work well without any download area.

in reply to:  2 comment:4 by GerdP, 5 months ago

Replying to skyper:

This check needs to rewritten. Using the trick that at least one child node needs to be within downloaded area does not work anymore and is wrong plus the message is misleading. Additionally, this should be a non-blocking warning with an option to continue anyway.

I think the correct way would be to check if the selected ways have the "all-referrers-downloaded" status. Instead we only check if the connection node has this status. Before r19078 this was ok because we checked if the node was inside a download area and that implied that also the parents of the ways are known.

Regarding overpass, there might be more work to get the flag that all parents have been loaded correct.

I see no way to set the flag with any query that doesn't download an area. We cannot interpret the query nor can we be sure that overpass will really do what we expect it to do.

by GerdP, 5 months ago

Attachment: delete.JPG added

comment:5 by GerdP, 5 months ago

Additionally, this should be a non-blocking warning with an option to continue anyway.

Maybe we could just show a dialog as when you delete a primitive, but with a slighlty different text?

"Combine confirmation"
"You are about to combine ways which can have other refererers not yet downloaded." (rest unchanged)

comment:6 by GerdP, 5 months ago

@nkamapper:

During imports I am doing hundreds of these combinations, so this slows down editing considerably.

I don't yet understand.

  • If you import new data the combine should just work.
  • I see no good reason to combine ways which are already on the server.

Parents were already downloaded with the recurse up operator above, so the refusal should not be needed.

(._;>;<;);

You probably suggest to parse the overpass query and detect that this line will tell overpass to send all refererres of the previous result.
The problem here is that JOSM doesn't know which data is send because it was in the initial result and which was added because of the "recurse up" operator. This would only work for nodes because they never refer to other objects.

in reply to:  6 comment:7 by nkamapper, 5 months ago

Replying to GerdP:

@nkamapper:

During imports I am doing hundreds of these combinations, so this slows down editing considerably.

I don't yet understand.

  • If you import new data the combine should just work.
  • I see no good reason to combine ways which are already on the server.

There are many cases, for example:

  • Combining a new way and an old way.
  • Combining old ways because they logically belong together (an earlier import may have excessive short segments).
  • Combining a way which I earlier accidentally split.
  • Adjusting at which node the split between two ways should occur (split + join).
  • In general, manually rearranging old and new data.

Parents were already downloaded with the recurse up operator above, so the refusal should not be needed.

(._;>;<;);

You probably suggest to parse the overpass query and detect that this line will tell overpass to send all refererres of the previous result.
The problem here is that JOSM doesn't know which data is send because it was in the initial result and which was added because of the "recurse up" operator. This would only work for nodes because they never refer to other objects.

I am not suggesting anything because I do not know how JOSM stores the data. I just wanted to highlight that parents were present in the given example. I have downloaded this way in thousands of sessions (often with pre-processing in scripts) and never had any conflicts because of it as long as I pay attention to incomplete parents.

comment:8 by GerdP, 5 months ago

I just wanted to highlight that parents were present in the given example

JOSM cannot know that.

in reply to:  8 comment:9 by nkamapper, 5 months ago

Replying to GerdP:

I just wanted to highlight that parents were present in the given example

JOSM cannot know that.

Agree. The source data could also be originating from a file with unknown history. And for this reason I do not think it makes sense to display a warning for every single possible combination in the dataset. At least there have to be a way to turn off the warning.

comment:10 by GerdP, 5 months ago

Yes, see comment:5

by GerdP, 5 months ago

Attachment: 23735.patch added

Improve test to check selected ways and not the node, show dialog to confirm the risky operation

comment:11 by GerdP, 5 months ago

Milestone: 24.06
Owner: changed from team to GerdP
Status: newassigned
Summary: Combine ways refused[Patch] Combine ways refused

by GerdP, 5 months ago

Attachment: confirm-combine.JPG added

comment:12 by GerdP, 5 months ago

With the patch the following dialog is displayed if any of the selected ways doesn't have the parents downloaded flag set:


comment:13 by skyper, 5 months ago

So far the only referrers are relations and I do not think this will change in near future. Therefore, I would call them what they are:

You are about to combine ways which can be members of relations not yet downloaded.
This can lead to damaging these parent relations (that you do not see).
Do you really want to combine.

Maybe, it would be even better to offer the download of parent objects similar to the split way action.

comment:14 by GerdP, 5 months ago

I wanted to keep as much text as possible so that translators can use paste+copy. But I wouldn't mind to use your text.

comment:15 by stoecker, 5 months ago

The text is missing what to do instead: I.e. how to download the missing data.

by GerdP, 5 months ago

Attachment: combine-hint.JPG added

dialog with hint for action and shortcut

in reply to:  15 comment:16 by GerdP, 5 months ago

Replying to stoecker:

The text is missing what to do instead: I.e. how to download the missing data.

Like this?
dialog with hint for action and shortcut

The hint would be computed with

        DownloadReferrersAction action = MainApplication.getMenu().downloadReferrers;
        final String downloadHint = tr("You should use {0}->{1}({2}) first.",
                MainApplication.getMenu().editMenu.getText(), action.getValue(NAME), action.getShortcut().toString());

Replying to skyper

Maybe, it would be even better to offer the download of parent objects similar to the split way action.

Yes. Unfortunately I am not able to code this because I don't understand how to execute the DownloadReferrersTask and wait for it to finish. I end either up with two parallel threads or one that is waiting forever :(

Last edited 5 months ago by GerdP (previous) (diff)

by GerdP, 5 months ago

Attachment: 23735-2.patch added

add hint reg. Download parent action

by GerdP, 5 months ago

Attachment: 23735-auto-download.patch added

Solution for automatic download of parents? It checks if preference combine.download-parents is true.

comment:17 by GerdP, 5 months ago

BTW: The split ways action only offers to download further members of known relations. If you split a way with "referrers-not-all-downloaded" status it will only inform about the possibly broken relations.

comment:18 by MSiipola, 5 months ago

I have the same problem/error using 19096, and I have never seen this before. Despite using JOSM several years.

For example, I have a short service road connected to a short track road, with a common node. Neither of these ways belongs to any relation, and both are well in the download area. Both are new (id=0). And JOSM refuses to combine them. If I copy both ways to new layer, they are possible to combine.

Last edited 5 months ago by MSiipola (previous) (diff)

comment:19 by GerdP, 5 months ago

I cannot reproduce this problem with new ways. Maybe you refer to the popup dialog that asks regarding the tag conflicts?

comment:20 by MSiipola, 5 months ago

The popup is not shown. I only got the error message.

I have an osm-file with the error. Is it possible to upload it here?

Last edited 5 months ago by MSiipola (previous) (diff)

comment:21 by GerdP, 5 months ago

Yes, there is a button to attach files near below the first post.

comment:22 by GerdP, 5 months ago

If you get this message after loading the data from file I don't need the data, that's a known problem.

by MSiipola, 5 months ago

Attachment: Combine-Bug.osm added

File with two ways which can't be combined. File is an extract of a bigger file, where the other objects are deleted.

comment:23 by GerdP, 5 months ago

Can you confirm that this problem only occurs when you load the data from file?

comment:24 by MSiipola, 5 months ago

Yes. Loading the file and trying to combine the two visible ways, give me the error.

comment:25 by GerdP, 5 months ago

OK. The unpatched code checks if the parents of the end nodes of the ways were downloaded. When data is loaded from file this flag is not set, even when nodes are within a download area.

comment:26 by GerdP, 5 months ago

I am not sure how to continue here.

  • With 23735-2.patch we'll just show another popup that tells the user that he has to do something to prevent data corruption unless they know what they do. Other actions show similar dialogs but without a hint what to do.
  • With 23735-3.patch (if preference combine.download-parents is set to true) the parents would be downloaded when needed but only for "Combine ways". If we go this way I'd prefer to have a general preference for all actions.
  • Another approach would be a new button "Download" in the popup dialog about the missing parent info.

My current feeling is that I should commit 23735-2.patch to close this ticket and then open a new one for a better general solution.

comment:27 by MSiipola, 5 months ago

Why has this bug(?) jumped up now?
What previous change caused it?

Last edited 5 months ago by MSiipola (previous) (diff)

comment:29 by GerdP, 5 months ago

Resolution: fixed
Status: assignedclosed

In 19119/josm:

fix #23735: Combine ways refused
(patch 23735-2.patch)

  • rewrite check so that it checks if the parents of the combined ways are known instead of the parents of the connection node(s)
  • show dialog with hint about download parents action that allows to continue

TODO: implement full automatic download of parents in all relavant action or add download button in the common dialog.

comment:30 by GerdP, 5 months ago

New ticket reg. automatic download of parents see #23744

comment:31 by anonymous, 3 months ago

Download parent ways/relations is under File not Edit

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain GerdP.
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.