User:Bjohas/OSMgadget

= A Mediawiki gadget to pull in OSM data. =

This mediawiki gadget adds an unattractive box below the sitenotice, that may or may not display related information from httpː//www.openstreetmap.org. E.g. for Nuraghe_Santu_Antine it looks like thisː



How it works
The gadget facilitates making new links between wikipedia and OpenStreeMap by displaying the result of an OSM search for wikidata and title. If nothing is found, you can use a direct link to OSM to try and spot the object manually.

It works in several steps: The script adds link texts that explain what the links do - hover over a link to see them.
 * Top box:
 * On load, the script fetches the coords/WD from the wiki page, and offers an OSM/JOSM link for the bounding box.
 * It then asynchronously does an overpass search based on wiki title (search OSM for "wikipedia=") and WD (search OSM for "wikidata="). If a match is found, the OSM/JOSM links are replaced by edit/load links for the found OSM object. If several matches are found, additional links to those objects are appended. This only finds existing objects (obviously), i.e. OSM objects that are tagged with wp/wd tags.
 * Bottom box:
 * The Gadget now also queries https://osm.wikipedia.link, which can provide suggestions for matches where the link doesn't already exist. It runs a more complex query, able to discover potential matches for as yet untagged objects in OSM.

Report an issue
Report an issue hereː User_talk:Bjohas/OSMgadget or here https://github.com/bjohas/OSM-Wikipedia-Monkey/issues

Code

 * Current code: User:Bjohas/common.js
 * Also: https://github.com/bjohas/OSM-Wikipedia-Monkey/blob/master/Gadget%20Wikipedia%20to%20OSM.js
 * Ideas for improvement
 * First version avaialble here: https://github.com/bjohas/OSM-Wikipedia-Monkey (see ).

Installation
To install this script, go to the wikipedia on which you want to run it, and then go to "USERPAGE/common.js", e.g. this is my USERPAGE/common.js on wikipedia: https://en.wikipedia.org/wiki/User:Bjohas/common.js. You page will be https://en.wikipedia.org/wiki/User:SOMEBODY/common.js.

Copy this text to the page: /* Code available at https://www.mediawiki.org/wiki/User:Bjohas/common.js Documentation available at https://www.mediawiki.org/wiki/User:Bjohas/OSMgadget mw.loader.load("//www.mediawiki.org/w/index.php?title=User:Bjohas/common.js&action=raw&ctype=text/javascript"); (Strictly speaking you don't need the comment, but it helps others find the script.) You'll need to do this on each wikipedia where you want to use it.

Important
The gadget now puts a switch into the left-hand tools menu, that allows you to enable/disable the gadget.

Related

 * https://osm.wikidata.link/ - a tool for creating links (used by the gadget)
 * en:Module:OSM (by en:User:Polyglot) - a module to perform searches and insert search results into wikipedia pages. The main difference is that the OSMgadget is installed by yourself, and once installed it's active on all pages that you visit. It's thus good for running a 'campaign' to create a set of new links between wikipedia and OSM. The Module:OSM needs to be embedded into a page, to show output from searches. It's thus ideal for making the Wikipedia-OSM links permanently visible for all users.
 * Wikidata can also accommodate OSM tags, see e.g. https://www.wikidata.org/wiki/Q33506