< JOSM

JOSM/Validator

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):

ValidationDescriptionFix
Duplicated nodesChecks that there are no nodes in the very same locationMerge the nodes into only one, adding the properties from all nodes to the merged one
Duplicated way nodesChecks 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 sideChecks 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 loopsChecks for coastlines ways that are not connected to the end of other coastline ways
Unordered coastline: coastline ways are not connected start-to-endChecks 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 coastlineReverse coastline
Incomplete waysChecks for ways with zero or only one nodeRemoves the way
Check property keysChecks misspelled property keys. See the User:JLS/speller page for information about misspelled property keysReplace wrong key with right one
Check property valuesChecks misspelled property values. Uses the tagging presets file for checkingNONE
Empty propertiesChecks for properties with empty valuesRemove the empty properties
Crossing waysChecks for ways (with highway/railway/waterway tags) that crosses in same layer with no crossing nodeAdd appropriate layer (and possibly bridge or tunnel)
Unordered waysChecks that all segments in a way are properly orderedReorder the way
Overlapping (high)waysChecks for two (high)ways that share the same nodesRemove the double (high)way
Self-intersecting waysA way intersects itself, possibly sharing same nodesTry to delete overlapping segments, possibly using cut(p) and unglue(g) ways, and middle mouse button to select from overlapping lines
Similar named waysChecks for ways with very similar names, possibly a typoNONE
Unclosed waysChecks that way types, which should be closed really are closedNONE
Untagged waysChecks for untagged waysNONE
Way end node near other highwayWays end within a few meters, possibly accidentally unconnected waysIf required connect the ways (join ways or merge nodes)
Style for outer way mismatchesWithin 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 multipolygonWithin 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 closedOne 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 ("AZ") 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.
FixmeChecks for any property with the word "fixme" insideNONE
Highway without a referenceChecks if there is a ref tag for highways that are tagged tertiary. Not always required, see for instance NL:Map_Features#WegenAdd ref property or ignore
Key 'x' invalid. - ...
Nodes with the same nameMultiple nodes use the same name, possibly duplicatesNONE
Overlapping areasAreas overlap
Unknown property valueChecks for proper use of tags (only those known to JOSM)Remove or change incorrectly used tag
Untagged and unconnected nodesChecks 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 relationThe multipolygon relation is missing a tag describing what it is/representsFor a building, add building=yes to the relation etc. See also Relation:multipolygon

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

This article is issued from Openstreetmap. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.