Skip to content

Nearby notable things from OpenStreetMap #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nicolas-raoul opened this issue Sep 19, 2017 · 9 comments
Open

Nearby notable things from OpenStreetMap #883

nicolas-raoul opened this issue Sep 19, 2017 · 9 comments
Assignees
Labels
enhancement gsoc Google Summer of Code nearby

Comments

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Sep 19, 2017

Wikidata only has 2000 embassies, while OpenStreetMap has 8000.
All embassies are notable enough to have their picture in Commons.
OSM has gotten quite good at linking to Wikidata, so an OSM item without a Wikidata link probably is not in Wikidata yet.
So, let's display them in Nearby, as soon as technically possible.
An advantage of OSM is that the items are all current (all buildings still exist in the present day, if you go there you will have something to take a picture of).
When the user uploads a picture,

  1. Create a Wikidata item with the correct type, such as embassy, name/description, image, lat/long from EXIF if available (not from OSM for license reasons)
  2. Link to it from the OSM item. This task is probably better left to a bot, and the Commons app would only send data to that bot (in order to avoid authentication issues and to be able to modify the code that talks to OSM without having to force all app users to update).

I believe OSM items with these tags are notable (every instance is worth having its picture in Commons):

@Bluesir9
Copy link
Contributor

Does the scope of this issue entail:
1-Fetching a list of nearby places from OSM based on the current coordinates of the user which will be then shown on the map?
2-Creating a WikiData item every time an image is uploaded(based on whether we have an existing WikiData item) and linking it to an OSM item based on the coordinates of that item?
3-Both of the above

@nicolas-raoul
Copy link
Member Author

@Bluesir9 (3) Both of the above. Linking from OSM is important so that at the next Nearby search this point is not shown anymore.

@nicolas-raoul nicolas-raoul changed the title Nearby notable things from OpenStreetMap with no Wikidata item Nearby notable things from OpenStreetMap Jan 27, 2018
@misaochan
Copy link
Member

misaochan commented May 3, 2018

Any thoughts on whether it would be feasible/useful to include this in 2019's PG application? I think it will be a fairly long and involved task, but the benefits look worth the while to me. @maskaravivek @neslihanturan @VojtechDostal

@VojtechDostal
Copy link
Collaborator

Woohoo! An interesting idea @nicolas-raoul . My worry is that we lose the cool connection to real items in Wikidata which we have just embraced using Nearby maps and lists. Images uploaded this way would have to be somehow properly tagged - but OSM identifiers are notoriously unstable, so it would be really complicated. Most OSM objects aren't still connected to existing Wikidata items, at least in our country (try this tool to see for yourself how many are still not connected).

My thought is that all these types of places belong to Wikidata and will actually be imported sooner or later. Within a few years there will probably be no need to read these kinds of objects from OSM because we'll have them in Wikidata. Also it might make the Nearby query take even longer than it does now which wouldn't be very user-friendly.

I've given several reasons why we shouldn't do this but there are of course many pros as well - obviously our dataset would be much richer than it is now.

@maskaravivek
Copy link
Member

This feature would be a really good addition to our app. I am in favor of having this task for 2019's PG application. Having worked with Wikidata APIs for P18 edits, we will have a better clarity of how Wikidata works and we should be able to manage this task well. :)

@nicolas-raoul
Copy link
Member Author

nicolas-raoul commented May 5, 2018

@VojtechDostal Many OSM objects are not connected to WIkidata objects because OSM has way more geographical objects than Wikidata. Looking at an OSM maps around me right now, I see dozens of notable places, and almost none of them has a Wikidata item. Even though I am in a country with a strong Wikipedia community writing many local articles. I am sure that Wikidata coverage is very low in countries with a weaker Wikipedia community, for instance the PRC of Guinea.

Conakry on OSM and Wikishootme:
screenshot from 2018-05-05 17-31-07
screenshot from 2018-05-05 17-31-48

While I could create a Wikidata item for every hospital on OSM, there are multiple problems:

  • The OSM license does not allow exporting to CC0 WIkidata (but using OSM to go to each hospital, then take a picture and add the hospital on Wikidata is OK)
  • Creating a hospital item on Wikidata requires a reference. OSM is not a good reference as mistakes are frequent (for instance people tagging while in a bus or taxi, or people using old maps). OSM + a picture is not a perfect reference either but still much better, as two persons have seen the hospital at that place.

@nicolas-raoul
Copy link
Member Author

nicolas-raoul commented Oct 12, 2018

I wrote this Overpass API query:

(
  node(43.08,131.84,43.13,131.93)[amenity=hospital];
  node(43.08,131.84,43.13,131.93)[building=hospital];
  node(43.08,131.84,43.13,131.93)[amenity=embassy];
  node(43.08,131.84,43.13,131.93)[diplomatic=embassy];
  node(43.08,131.84,43.13,131.93)[diplomatic=consulate];
  node(43.08,131.84,43.13,131.93)[man_made=bridge];
  node(43.08,131.84,43.13,131.93)[building=bridge];
  node(43.08,131.84,43.13,131.93)[Key=place];
  node(43.08,131.84,43.13,131.93)[railway=station];
  node(43.08,131.84,43.13,131.93)[tourism=zoo];
);
out;

Paste it into https://overpass-turbo.eu , press Run and Zoom to data to see the results on the map, then press Export to download as GeoJSON/GPX/KML.

It already provides results, but it could be improved further by catching:

  • not only nodes but also ways (see https://stackoverflow.com/a/41395312/226958)
  • filtering out items that have a k="wikidata", since the Wikidata query is already showing them (and not showing those that have a picture, which is good).

The API can be called directly like this:

https://overpass-api.de/api/interpreter?data=%28%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bamenity%3Dhospital%5D%3B%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bbuilding%3Dhospital%5D%3B%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bamenity%3Dembassy%5D%3B%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bdiplomatic%3Dembassy%5D%3B%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bdiplomatic%3Dconsulate%5D%3B%0A%20%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bman_made%3Dbridge%5D%3B%0A%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Bbuilding%3Dbridge%5D%3B%0A%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5BKey%3Dplace%5D%3B%0A%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Brailway%3Dstation%5D%3B%0A%20node%2843.08%2C131.84%2C43.13%2C131.93%29%5Btourism%3Dzoo%5D%3B%0A%29%3B%0Aout%3B%0A

Which returns:

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API 0.7.55.4 3079d8ea">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2018-10-12T13:00:02Z"/>

  <node id="292656979" lat="43.1046142" lon="131.9031830">
    <tag k="esr:user" v="980802"/>
    <tag k="name" v="Мыс Чуркин"/>
    <tag k="name:en" v="Mys Churkin"/>
    <tag k="name:ru" v="Мыс Чуркин"/>
    <tag k="railway" v="station"/>
    <tag k="wikidata" v="Q4309444"/>
    <tag k="wikipedia" v="ru:Мыс-Чуркин"/>
  </node>
  <node id="653094788" lat="43.1154793" lon="131.9071069">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Женская консультация"/>
    <tag k="name:en" v="Female consultation"/>
    <tag k="name:ru" v="Женская консультация"/>
    <tag k="operator" v="МУЗ &quot;Городской родильный дом&quot;"/>
    <tag k="source" v="photograph"/>
  </node>
  <node id="748478673" lat="43.1269020" lon="131.9137695">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Детская поликлиника №7"/>
  </node>
  <node id="748642606" lat="43.1280520" lon="131.9052518">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Поликлиника №7"/>
  </node>
  <node id="1010183669" lat="43.1133205" lon="131.9149436">
    <tag k="alt_name" v="Городской центр медицинской профилактики."/>
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Клинико-диагностический центр г. Владивостока."/>
  </node>
  <node id="1017861711" lat="43.1111356" lon="131.9259545">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Отделение микробиологической лаборатории"/>
    <tag k="source" v="image"/>
  </node>
  <node id="1143948753" lat="43.1215174" lon="131.9072099">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Краевой психоневрологический диспансер"/>
    <tag k="opening_hours" v="Mo-Fr 08:00-20:00; Sa 09:00-15:30"/>
  </node>
  <node id="1894124126" lat="43.0923586" lon="131.9169089">
    <tag k="amenity" v="hospital"/>
  </node>
  <node id="3224648070" lat="43.1148451" lon="131.8946463">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Приморское краевое бюро судебно-медицинской экспертизы, ГБУЗ"/>
  </node>
  <node id="3965162817" lat="43.1112094" lon="131.8819268">
    <tag k="name" v="Владивосток"/>
    <tag k="name:de" v="Wladiwostok"/>
    <tag k="name:en" v="Vladivostok"/>
    <tag k="name:ja" v="ウラジオストク"/>
    <tag k="name:ko" v="블라디보스토크"/>
    <tag k="name:ru" v="Владивосток"/>
    <tag k="name:zh" v="海参崴站"/>
    <tag k="railway" v="station"/>
    <tag k="uic_name" v="Vladivostok"/>
    <tag k="uic_ref" v="2000199"/>
    <tag k="wikidata" v="Q567308"/>
    <tag k="wikipedia" v="ru:Железнодорожный вокзал Владивостока"/>
  </node>
  <node id="4917891862" lat="43.1161852" lon="131.9078650">
    <tag k="amenity" v="hospital"/>
    <tag k="description" v="Отделение восстановительного лечения"/>
    <tag k="name" v="Владивостокская поликлинника №2"/>
  </node>
  <node id="5049861926" lat="43.1226438" lon="131.8808284">
    <tag k="amenity" v="embassy"/>
    <tag k="country" v="KR"/>
    <tag k="name" v="Генеральное Консульство Республики Корея"/>
  </node>
  <node id="5063330121" lat="43.1011919" lon="131.9153792">
    <tag k="amenity" v="hospital"/>
    <tag k="name" v="Краевая клиническая больница №2"/>
  </node>

</osm>

@misaochan
Copy link
Member

Wow, nice! 👍

@nicolas-raoul
Copy link
Member Author

nicolas-raoul commented Mar 28, 2024

The next steps could be:

Phase 1

  1. In Nearby's ... menu, add a "Show OpenStreetMap notable nodes"
  2. When enabled, run the over-pass query above in parallel, and show the nodes on the map in a different color.
  3. When uploading from an OSM node, add to the picture's description the URL to the FSM node.

Phase 2

  1. Modify the over-pass query to get whether the OSM node has a picture or not.
  2. Show the OSM node pin in green or red accordingly.
  3. Modify the query to get whether the OSM node's Wikidata QID, if any.
  4. Filter out OSM nodes that have a Wikidata QID, as they presumably are shown already. Or if easy, hide the pins with the same Wikidata QID as another pin already present on the map.

Phase 3

Edit OpenStreetMap to link from the OpenStreetMap node to the URL of the uploaded Commons picture.

@nicolas-raoul nicolas-raoul self-assigned this Jan 17, 2025
@nicolas-raoul nicolas-raoul added the gsoc Google Summer of Code label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement gsoc Google Summer of Code nearby
Projects
None yet
Development

No branches or pull requests

5 participants