Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:OSM/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Module rating |beta}} == Goal == On this page [[Wikipedia:WikiProject_OpenStreetMap]] it becomes clear different approaches have been tried before to link from Wikipedia to Openstreetmap. But why is this so hard? Well, there are a few problems, one of them is that ids for nodes, ways and relations on Openstreetmap are not guaranteed to be stable. When ways are split the id will point to a shorter stretch and the other part will get a new id. Sometimes points of interest which start as nodes, are converted to (closed) ways. Some contributors delete items, which get recreated by them a bit further along. Or somebody notices it's missing and recreates it fresh. So pointing directly to the OSM objects themselves doesn't work all that well. Let's say it's not future proof. It may work at the moment you define the link and a good while after, or it may fail the next day already. ===Wikidata=== Luckily Wikidata came along and this forms a part of the puzzle that can help solve this problem. What we can do is add tags which refer back to Wikidata items on the Openstreetmap side. [https://wiki.openstreetmap.org/wiki/Proposed_features/Wikidata wikidata tag] Now if a way is split, both parts will continue with the proper wikidata tag. ===Overpass API=== But now we have a new problem. How to find those elements in the Openstreetmap DB, which got wikidata tags assigned to them? Well there is a tool to help with this. It has the whole database of Openstreetmap, updated on a minutely basis and it's fast to query, on condition the queries can be kept simple. It's called [https://wiki.openstreetmap.org/wiki/Overpass_API Overpass API]. ===Overpass Turbo=== Looking at raw data, is not very instructive either, so another tool was built around it, which is called [https://wiki.openstreetmap.org/wiki/Overpass_turbo Overpass Turbo]. ===Query=== Developing these queries takes some trial and error. What this module does for you, is to automate the process and come up with a query that works, with sensible default values. For example if you omit the Wikidata id, the id of the corresponding article will be used. But it's also possible to write your own custom queries, or to specify further filters. Normally all objects' types, nodes, ways and relations will be fetched, but it's possible to limit to only ways, for example. ===in style=== Adding a style sheet allows you to present the data in a more suitable way. An attempt is being made to add a style sheet that makes sense, but it's possible to define your own. == Usage == * Search Openstreetmap independently of wikidata tags <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''overpass''}} * Search Openstreetmap for items which have wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''wd''}} * Search Openstreetmap for items which have name:etymology:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''etym''}} * Search Openstreetmap for items which have subject:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''subject''}} * Search Openstreetmap for items which have artist:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''artist''}} * Search Openstreetmap for items which have architect:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''architect''}} * Search Openstreetmap for items which have operator:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''operator''}} * Search Openstreetmap for items which have brand:wikidata=Q.... <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''brand''}} * Search Openstreetmap for public transport lines related to the current article <nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''pt''}} ===Parameters=== * display : Text shown on outgoing link * link : defaults to yes, but can be set to no for use in other templates * timeout : defaults to 15 seconds, needs to be set higher for more complicated queries * id : can link to a 1 or more Q-numbers of wikidata items, defaults to the Q-number id of the calling page * query : makes it possible to extend the query, which can be used to limit the search to highways or tombstones * prim : only fetch '''n'''ode, '''w'''ay and/or '''r'''elation primitives * coord : coordinates and a zoom factor in this format: '''47.0618984;15.4370248;17''' from which a bbox will be determined. * limitToBBOX: defaults to yes. If coord is set the query is limited to the resulting bbox * run : defaults to yes. Use no if you want the user to be able to move the map or change the query before searching * style : it's possible to define a MapCSS style to present the result in a nicer way == Test values == {{#invoke:OSM/testcases|run_tests}} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | }}</includeonly>
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Stockhub entities used in this page
logo image
: Label: en-gb
Ernest Claes
: Statement: P154
Cemetery of Arlon
: Statement: P154
Fontenoille
: Statement: P154
Templates used on this page:
Template:Cross
(
edit
)
Template:Module rating
(
edit
)
Template:Tick
(
edit
)
Module:OSM
(
edit
)
Module:OSM/testcases
(
edit
)
Module:UnitTests
(
edit
)