NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

While editing some cities I see a lot of unneeded/excessive nodes. For example, here:

Unneeded node

See that the street is straight and the left middle node is unneeded. I found question 8348 but I just can't select everything and simplify (it can remove valid nodes or just can't remove the node (caused by too high or too low max-error value)) nor I can select everything and straight them too.

While looking at the data with a lower zoom level it's also difficult to spot this small square in JOSM.

Another example:

Nodes

And the nodes that probably aren't needed:

Unneeded nodes 2

So my problem is: is it possible to highlight these kind of nodes in JOSM, please? (nodes that are part of a way, have no tags nor are connected to anything else (another ways, for example)). Something to display them with a big icon and/or color, like this:

Highleted

There is no problem that it's an ugly view but I need a quick way to view these possible spurious nodes (so I can then review them manually and remove if needed).

asked 13 May '13, 15:29

naoliv's gravatar image

naoliv
60071019
accept rate: 37%

edited 17 May '13, 02:58

2

Not every untagged node which is not connected to more than one road is unneeded. In fact, except for the Tiger import and some bad GPX-trace-to-OSM-way conversions most of these nodes are really useful. Besides there is no way to automagically decide whether such a node is unneeded or not.

(16 May '13, 07:20) scai ♦

I know. This is exactly why I need only to highlight the nodes and not an automated process to remove them. By highlight the nodes I can review them manually.

(16 May '13, 11:45) naoliv

Although JOSM's search function is very powerful it doesn't seem to support all of your constraints.

(16 May '13, 12:07) scai ♦

Can some kind of custom map style/MapCSS be created for this?

(16 May '13, 12:10) naoliv
1

I'm not familiar with MapCSS but I guess it is possible given the already different style of single and multiple connected nodes. Still I wouldn't worry too much about them. Removing them is probably not worth the effort. But if you create such a style then publishing it doesn't harm, too :).

(16 May '13, 12:36) scai ♦

OK, edited the initial question to give a better explanation. I don't need an automated tool to simplify nor nothing. I just want to have the middle nodes somehow highlighted.

(17 May '13, 02:57) naoliv
2

I think this condition is needed: highlight NodeA if it

  • is member of exactly one way AND
  • is not a member of a relation AND
  • has no tags AND
  • has a node before (A-1) and after (A+1) in the way AND
  • the absolute difference of (angle to North of the line between NodeA-1 and NodeA the angle to North of the line between NodeA and NodeA+1) is <= $threshold

$threshold may be 0 or 0.001 or something (depends on personal taste).

(18 May '13, 12:09) aseerel4c26 ♦
showing 5 of 7 show 2 more comments

Answering my own question, I did create a MapCSS style:


way[highway] > node {
  symbol-size:10;
  symbol-shape: square;
  symbol-stroke-color: #00ffff;
  symbol-fill-color: blue;
}

node:connection, node:tagged {
  symbol-size:5;
  symbol-fill-color: #808080;
  symbol-stroke-color: #808080;
}

The first block will highlight with a blue square every node that is part of a way tagged with highway=* (even nodes that are tagged or connected to other ways, but they are handled after).

Second block will make nodes that are connected to other ways (node:connection) or nodes that have any tags (node:tagged) have a gray color and a smaller size (to stay less noticeable in JOSM).

This:

Original

Is now seen as this with the style:

Highlighted

Like aseerel4c26 suggested, missing features are:

  • Ignore initial/final nodes of the way
  • Ignore highways that are also part of a relation
  • Highlight only nodes within a certain angle threshold (so real curved ways could be ignored)

It is perfectly fitting my needs but any kind of suggestion/improvements are welcome.

permanent link

answered 22 May '13, 21:12

naoliv's gravatar image

naoliv
60071019
accept rate: 37%

edited 25 May '13, 00:25

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

1

Thanks for sharing!

And for those wondering what to do with the junk above... Use a text editor, paste the code, and save it as foo.css (or similar) anywhere. Then add the file path to JOSM in Edit/Preferences/Map Settings/Map Paint Styles.

I've used JOSM for years, but apparently there are still many things to find out. :)

(22 May '13, 21:39) gnurk

Very good, naoliv! For other who don't understand the CSS syntax that good, could you mention (please add it with the "edit" function) what the rule does? It is not as restrictive in highlighting as my suggested conditions (yes, those are not useful as they are, practically) are, right?

(22 May '13, 23:21) aseerel4c26 ♦
1

aseerel4c26, I did edit it like you suggested. And as you said, it doesn't implement all the rules from your other comment (but as it is now, it's perfectly fitting my needs). Thanks!

(24 May '13, 20:30) naoliv
1

Thanks again, mentioned in the relevant (hopefully) wiki pages.

(25 May '13, 00:32) aseerel4c26 ♦

In your private data version you can remove (or do whatever you want with) these "unneeded" points. But, please, be careful doing similar changes to the OSM source data. There may be some, to us unknown, reasons for uploading these "unneeded"/redundant points by local editors. Besides, the cases you refer to are just a little fraction of the redundant node cases. The node redundancy comes from point replications, colinear (and almost colinear) neighbouring vector/line-segments, cases like ...A,B,C,B,C...C,D..., overlapping (or almost overlapping) ways/polylines in the same or different object classes and so on. The number of "unneeded" nodes in a Planet dump may easily exceed 10**8 (hundred million).

So, my suggestion is, do not worry about these "unneeded" points in the OSM source data. In raster mapping (rendered/pre-rasterized map images on servers) you will never see them. In vector mapping (rendering/rasterization on the clients, parametric data transmission) mappers will remove this redundancy anyway especially in mobile mapping (simply, it is too expensive to transmit them in cellular networks).

permanent link

answered 18 May '13, 08:09

sanser's gravatar image

sanser
695383955
accept rate: 5%

2

Sorry if I look rude here (it's really not the intention) but I know what I am doing. In no way I am going to destroy data (and exactly because of this I don't want to use any kind of automated process to remove the nodes). Like I said before, I just need help in highlighting these nodes.

The majority of the cases that I see in my area are nodes created by new users.

If I am doing some QA work or updating an area, I see no problem in also removing spurious nodes.

(18 May '13, 14:25) naoliv
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×205
×31
×13
×4
×1

question asked: 13 May '13, 15:29

question was seen: 10,426 times

last updated: 25 May '13, 00:32

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum