Depends on the editor you use
JOSM: select both ways and type c (combine), that’s it
Is there a reason to merge them?
There might be a reason not to merge them; e.g. one part may be marked with
sidewalk=no and other part with
sidewalk=left (or they might have different
maxspeed. Or any number of other tags might differ).
In general, it is quite normal that any street will be split in several segments at least. Only if all the tags are the same, should merging be considered.
True. JOSM also should warn if tags differ, giving you a chance to abort (one should not blindly merge unless they are sure the result would be correct of course)
As Matija said, first check that the segments have all of the exact same tags.
You should also check that the segments are members of the same relations. You’ll commonly see highways as part of relations for bus routes and turn restrictions. See how this segment says “Part of 2 relations”.
If the segments have exactly the same tags and aren’t part of any relations it’s probably safe to combine them. If they are part of relations it may be possible to combine them if you understand how the relations are constructed. Otherwise just leave them alone, as having multiple segments for a single road is very common and doesn’t cause any issues.
- join: ways have a common node, this can be achieved by merging a node from one way with the other, or starting/ending a way with a node of the other (and a handful of other ways)…
- merge: all nodes of two joined ways are moved from one way to the other. This requires that the ways are joined at an end node. The way that is donating the nodes is deleted.
Having longer linear features, say a road, consisting of multiple joined ways is completely normal in OSM, and as had already been said is often required to reflect changing attributes (tags) and relation memberships.
Thanks for all of your input. I see now that it makes sense not to join segments of the road I was looking at because different segments have different attributes.