Modify

Ticket #6696 (closed enhancement: fixed)

Opened 10 months ago

Last modified 10 months ago

[PATCH] Another way of computing merged node location

Reported by: Martin Ždila <m.zdila@…> Owned by: team
Priority: normal Component: Core
Version: latest Keywords:
Cc:

Description

Hello

I've implemented third way how to compute location of the merged node. Please see my attached patch.

  1. First way is to use location of the last selected node.
  2. Second way is to average locations of all selected nodes.
  3. Third way is to do weighted average where nearby nodes have lower weight than remote.

This behavior can be controlled by merge-nodes.mode property (0, 1, 2). I would like to create a GUI control in preferences to enable its easy setup, but I am not sure what tab should it belong to.

Attachments

merge.patch (2.7 KB) - added by Martin Ždila <m.zdila@…> 10 months ago.
the patch
merge.2.patch (3.2 KB) - added by Martin Ždila <m.zdila@…> 10 months ago.
improved patch using NorthEast
merge.3.patch (2.9 KB) - added by Martin Ždila <m.zdila@…> 10 months ago.
optimized patch

Change History

Changed 10 months ago by Martin Ždila <m.zdila@…>

the patch

comment:1 Changed 10 months ago by stoecker

  • Summary changed from Another way of computing merged node location to [PATCH] Another way of computing merged node location

comment:2 Changed 10 months ago by bastiK

You cannot do average on lat/lon coordinates, use EastNorth space or 3D instead.

What is the weighted average supposed to do, exactly?

comment:3 follow-up: ↓ 4 Changed 10 months ago by Martin Ždila <m.zdila@…>

You cannot do average on lat/lon coordinates, use EastNorth space or 3D instead.

Could you please help me with this? For two nodes I am able to find the formula but for more than two I am not successful. In any case results are very good for small distances (eg. 100km and less).

Visual example, (.) represents node: Classic merge:

Input : ...                       .
Result:        .

Weighted merge:

Input : ...                       .
Result:             .

comment:4 in reply to: ↑ 3 Changed 10 months ago by bastiK

Replying to Martin Ždila <m.zdila@…>:

You cannot do average on lat/lon coordinates, use EastNorth space or 3D instead.

Could you please help me with this?

Should be easy: Just use candidates.get(i).getEastNorth(); and new Node(EastNorth en).

In any case results are very good for small distances (eg. 100km and less).

But still, it just looks wrong. :-)

Visual example, (.) represents node: Classic merge:

Input : ...                       .
Result:        .

Weighted merge:

Input : ...                       .
Result:             .

Changed 10 months ago by Martin Ždila <m.zdila@…>

improved patch using NorthEast

comment:5 Changed 10 months ago by Martin Ždila <m.zdila@…>

Attached improved patch. Is it better now? :-)

Changed 10 months ago by Martin Ždila <m.zdila@…>

optimized patch

comment:6 Changed 10 months ago by bastiK

  • Status changed from new to closed
  • Resolution set to fixed

In [4315/josm]:

applied #6696 - Another way of computing merged node location (patch by Martin Ždila)

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.