JOSM/Validator

From OpenStreetMap Wiki
(Redirected from JOSM validator)
Jump to navigation Jump to search
Validator panel in action, showing various problems

The JOSM Validator is a core feature of JOSM which checks and fixes invalid data. It can find many problems, it is especially useful for finding geometry errors like invalid multipolygons that may be extremely hard to detect manually. It may also help to discover new types of issues that were earlier unknown to the mapper.

JOSM validator is in nearly all aspects the most powerful and the most useful validator available for mappers. For example, diagnosing broken multipolygon with iD or Vespucci may be extremely frustrating, nearly impossible for large objects. JOSM will often diagnose exactly what and where went wrong.

Warning: Do not map for JOSM Validator. Only fix real errors which you understand and know how to improve correctly!

Yes, JOSM Validator has some false positives, like any other validator. Systematic issues should be reported

Osmose is also powerful and works in a browser - but has significant update lag (24 hours is typical) and reports many irrelevant issues.

Usage

  1. Get JOSM installed and loaded. Starting guide is available at JOSM/Guide. Download some data in your area of interest. For example, a place where a forest is mapped but not appearing on the map due to a broken multipolygon.
  2. Click on the tick icon in the vertical toolbar to show the validator panel on the right.
  3. Click on the Validate button at the bottom of the validator panel.

This will check the data and display all errors, categorized as errors, warnings, and other, depending on the severity of the error.

While some of the errors must be manually fixed, most of them can be automatically fixed. Just select the error or errors and click the Fix button to automatically fix them. You can select multiple errors, and all of them will be fixed.

Other usage tips:

  • You can select the data you want to validate and ignore anything else (or run validator while not selecting anything to validate all downloaded data)
  • In preference settings, you can activate only the tests you need. By default, warning and errors are reported, while information level reports are hidden.
  • In preference settings, in the toolbar panel, you can include a validation icon in the horizontal toolbar at the top of the window (does the same as the Validate button on the right hand panel)
  • The screenshot shows the validator panel undocked, in a separate window. Do this with the little pin icon if you need more space to see the errors tree.
  • In case of the validator reporting things that are not actually a problem, it can be avoided by adding an exception, so report it to the JOSM developers. They fixed and keep fixing massive number of validator bugs making it even better. They also keep adding new detectors, some based on proposed ideas..

Validations

These are examples of validations performed by the validator (these rules are present in JOSM validator since 2013, many, many, many, many were added since that time):

Validation Description Fix
Duplicated nodes Checks that there are no nodes in the very same location Merge the nodes into only one, adding the properties from all nodes to the merged one
Duplicated way nodes Checks that ways contain no loop edges (i.e., a single step from a node to itself) Split the way, and delete the way consisting of the loop edge.
Reversed coastline: land not on left side Checks for coastlines that are not counter-clockwise or that are otherwise misplaced (coastline misused as inland lake) Reverse coastline
Unconnected coastline: coastline ways do not form closed loops Checks for coastlines ways that are not connected to the end of other coastline ways
Unordered coastline: coastline ways are not connected start-to-end Checks for coastline ways of which either the start is not connected to the end of another coastline or the end is not connected to the start of another coastline Reverse coastline
Incomplete ways Checks for ways with zero or only one node Removes the way
Check property keys Checks misspelled property keys. See the User:JLS/speller page for information about misspelled property keys Replace wrong key with right one
Check property values Checks misspelled property values. Uses the tagging presets file for checking NONE
Empty properties Checks for properties with empty values Remove the empty properties
Crossing ways Checks for ways (with highway/railway/waterway tags) that crosses in same layer with no crossing node Add appropriate layer (and possibly bridge or tunnel)
Unordered ways Checks that all segments in a way are properly ordered Reorder the way
Overlapping (high)ways Checks for two (high)ways that share the same nodes Remove the double (high)way
Self-intersecting ways A way intersects itself, possibly sharing same nodes Try to delete overlapping segments, possibly using cut(p) and unglue(g) ways, and middle mouse button to select from overlapping lines
Similar named ways Checks for ways with very similar names, possibly a typo NONE
Unclosed ways Checks that way types, which should be closed really are closed NONE
Untagged ways Checks for untagged ways NONE
Way end node near other highway Ways end within a few meters, possibly accidentally unconnected ways If required connect the ways (join ways or merge nodes)
Style for outer way mismatches Within a multipolygon relation, one of the tags rendering style(?) of the relation and the outer ways is shared but with different values
Style for inner way equals multipolygon Within a multipolygon relation the JOSM rendering style of the outer way is the same as the result style of the inner way (all of these depend on the current JOSM setings and user view preferences) Check if the tags are the same and remove tags from inner way, otherwise NONE
Multipolygon is not closed One possible problem is that there is a multipolygon relation where the members do not form a loop. The other possibility is that there are more than one objects (like a relation and a few nodes) listed together which means what? Try to order the nodes in the relation ("A→Z") and see where the gaps are, and connect them. Hidden elements may trick you. Prevent polygon from intersecting itself, and remove duplicated nodes or ways. Ensure all parts of the closed area have the same role. If everything looks allright then it's probably due to dark matter, leave it alone or the Universe will be destroyed.
Area style on outer way This warning occurs if the same tags are found duplicated on the multipolygon relation and on the outer geometry of the multipolygon. If the area is simple enough (if it doesn't need to be a multipolygon), then transferring the relevant tags from the relation to the geometry and deleting the relation should do. If it needs to be a multipolygon, then instead transfer the tags from the outer geometry to the relation.
Fixme Checks for any property with the word "fixme" inside NONE
Highway without a reference Checks if there is a ref tag for highways that are tagged tertiary. Not always required, see for instance NL:Map_Features#Wegen Add ref property or ignore
Key 'x' invalid. - ...
Nodes with the same name Multiple nodes use the same name, possibly duplicates NONE
Overlapping areas Areas overlap
Unknown property value Checks for proper use of tags (only those known to JOSM) Remove or change incorrectly used tag
Untagged and unconnected nodes Checks rogue nodes (possible remnants of redaction bot) Delete unused nodes when they have no further tags (or try to reconstruct redacted objects)
No style in multipolygon relation The multipolygon relation is missing a tag describing what it is/represents For a building, add building=yes to the relation etc. See also Relation:multipolygon

From MultipolygonTest.java

Validation Check Description Fix Idea
Multipolygon is not closed Multipolygons consist of a list of closed ways. If this error is raised, either one of the ways in that list is open, or the list is empty. Close the ways, add missing members, or remove invalid members.
Multipolygon inner way is outside If this error is raised, that means that the outermost way in the multipolygon has the role "inner". The outermost way in the multipolygon should never have the role "inner". Adjust accordingly.
Intersection between multipolygon ways Occurs when two ways intersect without sharing a node. Fix geometry.
Multipolygon ring contains segment twice A single way in a multipolygon contains the same segment twice, often as a result of double-backing on itself. An inner area double-backing on itself in a figure-eight shape with an elongated middle is one way to get this error. Switch to a proper "donut" topology.
Multipolygon outer way shares segment with other ring This error occurs when the outer way and an inner way share a segment. Consider whether or not a multipolygon is right for that particular geometry, or whether or not that "inner" way should really just be a separate object.
⛔⚠️ Intersection between multipolygon ways The ways of the multipolygon are forming an "X" shape somewhere. Multipolygons require a clean topology, where closed ways are contained entirely within other closed ways. Identify the intersecting points, remove them, and fix the remaining invalid geometries.
Role for multipolygon way member should be inner or outer Error is raised if a member of the relation has a role other than "inner" or "outer". Each member in the multipolygon needs to have a role either "inner" or "outer".
Multipolygon member repeated (same primitive, same role) Both of these errors occur when, in the member list, a member of the relation is repeated twice. Double-check the member list by clicking one of the ways, then in the tag list find the relation by double-clicking the entry under "Member Of". Remove the duplicate entries.
Multipolygon member repeated (same primitive, different role)
⚠️ Self-intersecting polygon ring Each way in a multipolygon must be a valid, closed polygon by itself. This error is thrown if one of the ways self-intersects, specifically when it self-intersects without a connecting node. Repair or remove invalid geometries. There is no instance in which this is good practice.
ℹ️ Style for outer way mismatches / With the currently used mappaint style(s) the style for outer way mismatches the area style The outer way has tags which would render it differently to how the multipolygon relation would render it. (for example, the outer member has tags for a wetland, and the relation has tags for water) Move tags from outer way entirely, putting them on the relation. No tags on outer relation.
⚠️ Area style on outer way The outer way has tags which are identical to the relation's tags. This is more likely to be the result of a data organization problem than the above, hence a warning. Move tags from outer way entirely, putting them on the relation. No tags on outer relation.
ℹ️ With the currently used mappaint style the style for inner way equals the multipolygon style The inner parts of the multipolygon (the "holes") will render the same as the rest of the multipolygon. If the tags for the inner part of the multipolygon really belong to the outside of the multipolygon, then move the tags to the multipolygon relation instead of the inside geometry.
ℹ️ No area style for multipolygon If a relation is tagged as a multipolygon, but does not have any area-related tags (natural=wood for example), then this error is thrown. This check is skipped for administrative boundaries. Not necessarily an error/warning if the multipolygon does represent an area but JOSM doesn't understand the tags. However, if the multipolygon is supposed to represent an area, then make sure the appropriate relation tags are present.
⚠️ Multipolygon ring is equal to another ring Two ways in the multipolygon occupy the exact same geometry, possibly in different directions. With the default JOSM keybinds, "g" unglues two ways when selected on a node. Select a node, press g, then move one node away to identify the two different areas. Then fix accordingly.
ℹ️ Multipolygon rings share nodes This is thrown when two members of a multipolygon share a node. If two holes are touching, or if a hole touches the outer border, then that situation is legitimate, but generally multipolygons should have a clean topology. Consider fixing by separating into two distinct non-multipolygon areas or by removing the duplicated nodes.
⚠️ Incomplete multipolygon relation was modified Warning is thrown when a non-empty multipolygon is both incomplete and modified. Complete the multipolygon relation.

Custom validator rules

Users can create custom validation rules through MapCSS-based custom validator files. Simple documentation for JOSM's validator syntax can be found at JOSM/MapCSS Validator Syntax.

Source code

The Validator's source code can be viewed at http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/data/validation/tests and https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator

Wish list

Wishes for new features or bug reports should be reported at the bug tracker of JOSM.

#15182 tracks progress (stalled for now) to make JOSM validator available as standalone headless program.

See also