Mapbox linters types description

From OpenStreetMap Wiki
Jump to navigation Jump to search


This wiki page describes the Mapbox project ‘Linters’ which is connected with improvements of OSM data. Here you can find how we get and process linters, their types with examples.

What are linters?

Linters are data validators that identify logical errors in OpenStreetMap data. We use the open source tool OSMLint to run these data validators at a global scale.

How do we get linters?

Currently we are using the approach described below, the only difference is that we have an internal automated process by our developers. As it’s not easy for most mappers to run these checks themselves, we attach ready-made data for each Github Ticket and OSM Wiki pages as soon as we can.

Generally the process is:

First, we download fresh data from .Then convert data from *.osm.pbf into geojson format for further packing into *.mbtiles. Use tippecanoe to make *.mbtiles. After that we use osmlint and osmlint-osmium which help us to spread linters by their types. Then received files come through our improvement algorithm, after which we get only needed linters for us. On this step we cut off footways, cycleways, golf carthpathes, aeroways, etc.

Screenshot from 2021-09-21 14-51-15.png

We share json archives with linters that we plan to fix, which can be looked through You can add json features into it and use next script for moving into osm:

javascript: (function() {
  id = location.href.match(/\#(?:.*map=)?((\d{1,2})(\.\d+)?(\/\-?(\d{1,2}(\.\d+)?)\/\-?(\d{1,3}(\.\d+)?)))/);
  if (id != null) {'' + id[2] + id[4]);
  else {
    alert('This is not a valid Url.')

Also you can use where users can make a project by adding json files. After that, there will be a project with the same tasks as from the archive.

For all categories we have several rules:

  1. We fix only highways with tags: Motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary,secondary_link,tertiary,tertiary_link,residential,living_street,service,unclassified,track.
  2. We don’t fix buildings
  3. We don’t fix roads with emergency tags or service with access=no
  4. We don’t fix restrictions for buses, caravans, bicycles, agricultural transport, motorcycles and hazmats. We work only with restrictions for all types of vehicles, hgv and motorcars.

How do we process issues?

First, we find sources for fixes. It can be searched through aerial photos (Bing, Esri, Maxar, etc) or street level photos in some cases. We use only sources that are allowed in OSM ID.

We choose a source with the best quality of the picture and the newest one. On chosen sources should be seen features that we want to map.

We can watch OSM history to understand what changes were done with the feature, compare dates of changing.

In cases of lack of up to date satellite or imagery the team doesn’t make any edits. And always taking care about local sources, which are the most relevant and unique for each country.

Incoming tags:

  • crossing_highways
  • impossible_angle
  • impossible_oneways
  • islands_highways
  • mixed_layer
  • tr_excessive_roles_str
  • tr_invalid_role_tr
  • tr_missing_role_tr
  • tr_missing_type_restriction_tr

Crossing Highways

Highways that cross each other without a common node at its intersection.

In this category we fix only roads on the same layer/level.

How to fix:

  • Check in satellite imagery to see if highways intersect each other.
  • Connect them with a node at the intersection.
  • or Delete the intersection node if it’s different roads, for example, bridge and road underneath.
  • There also could be a dragged node, so you need to fix it carefully by disconnecting necessary nodes from each other, and moving back to the right place.
Example: Link changeset link
Before fix: roads aren't connected at the intersection After fix: added common point on the roads
Image (3).png
Image (2).png

Impossible Oneways

Highways with incorrectly mapped oneways. More often it’s oneways that don’t have logical end/start or wrong direction.

Highway with oneway=yes tag should form a loop in the same direction and navigable from end to end. Any highway with oneway tag connecting each other in the opposite direction indicates a wrong way of oneway mapping.

In this category we don’t fix roads that end/start with amenity or entrance points. Also we don’t fix ‘no exit’ tag on the end point of oneways.

How to fix:

  • Inspect the flow of oneway tag of neighboring connected roads.
  • Verify the oneway tag from satellite imagery or streetlevel photos.
  • Change/delete the wrong oneway tag according to the traffic flow direction.
  • If oneway connected with building (usually parking), create a point on the end of the road with tag amenity=parking_entrance and parking=multistorey or parking=underground if possible.
  • If oneway connected with building and we can’t say that it’s a parking, we should make sure that there’s entrance and create a point on the end of the road with tag ‘entrance=yes’.
  • If oneway road should be mapped more - edit it. For example, entrance and exit roads of surface parking are not connected - map to resolve impossible oneway issue.
  • If it’s a carwash roads - connect them and add covered=yes tag.
Example: Link changeset link
Before fix: oneway which leads to the multi-level parking has no end point After fix: added amenity point on the end of oneway
Screenshot from 2021-09-21 12-49-19.png
Screenshot from 2021-09-21 12-51-49.png

Islands Highways

Motorable highway that doesn’t connect to other highways in the same area.

How to fix:

  • Inspect satellite imagery to see how roads in the area connect to each other.
  • Connect the unconnected road to the nearest highway.
Example: Link chageset link
Before fix: road don't connected with road network After fix: road is connected
Image (1).png


Impossible Angle

Highways with sharp turn angles within itself (<10 degrees), or what we usually call dragged nodes.

In this category we don’t fix the valid sharp angles.

How to fix:

  • Inspect satellite imagery.
  • Deleting extra nodes which causes sharp angle.
  • Aligning the highway nodes based on satellite imagery.
Examples: Link changeset link
Before fix: roads overlap each other After fix: the road corresponds to the image
Screenshot from 2021-09-21 12-34-48.png
Screenshot from 2021-09-21 12-40-04.png

Mixed Layer

In this category we fix only highways that intersect with another highway with a different layer tag. For example, we don’t fix cases when the road with layer=1 continues the road with layer=0 tag.

How to fix:

  • Inspect imagery.
  • Observe if the roads are on the same layer, if not - investigate the reason
  • Is the bridge/tunnel connected to a highway? - Remove the node at which different roads are connected.
  • Is the highway with the layer tag missing a bridge or tunnel tag? - Сheck whether it's a bridge or tunnel and add or delete the respective tag.
  • If the highway has layer tag without bridge or tunnel tag:

a) remove the layer tag if the road is on the ground surface or,

b) add missing bridge=yes or tunnel=yes.

Examples: Link changeset link
Before fix: road has wrong layer tag and intersects with road that have layer=0 tag After fix: roads that have common point are on the same layer
Screenshot from 2021-09-21 12-28-40.png
Screenshot from 2021-09-21 12-29-17.png

Turn restrictions

  • InvalidRoleTR (restriction with all roles which is not connected in via)
  • excessiveRoleTR (turn-restriction that has more than one from/via/to roles)
  • missingRoleTR (turn-restriction with missing from/via/to role)
  • missingTypeRestrictionTR (missing type=restriction or restriction=* tags in the relation)

After discussion of our work with restrictions with the Italy OSM community, we changed the approach. Now we don’t delete restrictions if there are no clear proofs of it. We leave notes about broken restrictions if we don’t have ground truth sources for mapping them.

How to fix:

  1. Verify from street level photos if the turn restriction exists or related features history.
  2. If we find street level photos or road markings, choose the right edit (edits depends from initial data):
    • Delete the extra from/via/to roles;
    • Add the missing from/via/to role or create new turn-restriction instead of "old" one;
    • Fix type or restriction tags in iD;
    • Fix roles or re-add this restriction and it will be fixed automatically.
  3. If we don’t have enough sources for fix, leave restrictions and make a note.
Example: link changeset link
Before fix: restriction with excessive roles After fix: working and valid turn restriction
Screenshot from 2021-09-21 11-25-55.png
Screenshot from 2021-09-21 11-27-51.png