Jump to content

Wikipedia:Creating route maps from OpenStreetMap data

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mxn (talk | contribs) at 19:20, 2 May 2020. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


The process:

  1. Find the route relation ID:
    • On OpenStreetMap:
      1. Switch to the "Transport Map" layer using the 'Layers' sidebar on the right.
      2. Now you should see all the transit routes highlighted on the map, with numbers indicating the route numbers. Select a route by right-clicking and selecting 'Query features'.
      3. Then search through the list for the route you desire; selecting it will bring you the relation representing the route, with the route displayed beside it on the mạp
    • Using the OSM Relation Analyzer (if you already know how the relation would be tagged):
      1. Set Relation Type to route.
      2. Set Network to a route network identifier, such as COTA, or set Operator to an agency name, such as Central Ohio Transit Authority.
      3. Set Ref Tag to the route number, for example 10.
      4. Optionally set Route to bus if the same agency assigns the same route number to a bus line and another kind of route.
      5. Click Search.
  2. Copy the relation ID (generally several digits long) and paste into this Overpass query, replacing '8343040'. The ID filter is actually one of many possible filters you could use here.
  3. Run the query, then click 'Export' in the toolbar and select the 'copy' part of 'download/copy as GeoJSON'
  4. In Wikimedia Commons, create a page in the Data: namespace with the .map extension, like c:Data:COTA10.map
  5. When you create the page, replace the 'Data' placeholder (including the two brackets) with the GeoJSON you copied.
  6. Uncomment the line "license": "ODbL-1.0", // ODC Open Database License v1.0 and save the page.
  7. You may need to adjust the coordinates or zoom level in order for the map to display properly; here you can also add parameters for line width, color, etc.
  8. Then you can use the map data in Wikipedia articles, through {{maplink}} using the parameter |from=COTA10.map, or manually, like seen here.

Theoretically there should be a simpler way, involving just linking the route's Wikidata QID into OSM, and linking the OSM relation ID into Wikidata. However, according to phab:T218097#6011573, any OSM element tagged after January 24 won't be picked up by this service, making this easier route impossible for newly-tagged elements.