Hi guys !
I'm working on a website, which find your position using geolocation, and then show the wikipedia's pages around you on an OSM map. For the moment it works. The goal here is to create a full solution dedicated to tourism. For example a tourist is dropped in a city he doesn't know, and he can have informations on what's around thanks to Wikipedia and wikidata. But I'd like to add WikiVoyage informations too.
I know it's possible with Wikidata API to enter a position (longitude and latitude), a range, and have all Wikipedia pages around. Is it possible to do the same with WikiVoyage pages ?
Thanks a lot ! :)
Sylvain.
Somewhat... https://en.m.wikivoyage.org/wiki/Special:Nearby The problem is the search radius is so small that it doesn't always provide suitable results.
On Tue, Jul 21, 2015 at 10:40 AM, Sylvain Arnouts sylvain.arnouts@wanadoo.fr wrote:
Hi guys !
I'm working on a website, which find your position using geolocation, and then show the wikipedia's pages around you on an OSM map. For the moment it works. The goal here is to create a full solution dedicated to tourism. For example a tourist is dropped in a city he doesn't know, and he can have informations on what's around thanks to Wikipedia and wikidata. But I'd like to add WikiVoyage informations too.
I know it's possible with Wikidata API to enter a position (longitude and latitude), a range, and have all Wikipedia pages around. Is it possible to do the same with WikiVoyage pages ?
Thanks a lot ! :)
Sylvain. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
https://en.wikivoyage.org/w/api.php?action=query&list=geosearch&gsra...
On Tue, Jul 21, 2015 at 10:40 AM, Sylvain Arnouts < sylvain.arnouts@wanadoo.fr> wrote:
Hi guys !
I'm working on a website, which find your position using geolocation, and then show the wikipedia's pages around you on an OSM map. For the moment it works. The goal here is to create a full solution dedicated to tourism. For example a tourist is dropped in a city he doesn't know, and he can have informations on what's around thanks to Wikipedia and wikidata. But I'd like to add WikiVoyage informations too.
I know it's possible with Wikidata API to enter a position (longitude and latitude), a range, and have all Wikipedia pages around. Is it possible to do the same with WikiVoyage pages ?
Thanks a lot ! :)
Sylvain. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Thanks, it perfectly works ! :D
Le 21/07/2015 19:44, Max Semenik a écrit :
https://en.wikivoyage.org/w/api.php?action=query&list=geosearch&gsra...
On Tue, Jul 21, 2015 at 10:40 AM, Sylvain Arnouts < sylvain.arnouts@wanadoo.fr> wrote:
Hi guys !
I'm working on a website, which find your position using geolocation, and then show the wikipedia's pages around you on an OSM map. For the moment it works. The goal here is to create a full solution dedicated to tourism. For example a tourist is dropped in a city he doesn't know, and he can have informations on what's around thanks to Wikipedia and wikidata. But I'd like to add WikiVoyage informations too.
I know it's possible with Wikidata API to enter a position (longitude and latitude), a range, and have all Wikipedia pages around. Is it possible to do the same with WikiVoyage pages ?
Thanks a lot ! :)
Sylvain. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
There's an article about getting pages nearby with action=geosearch, http://devhub.wmflabs.org/wiki/API:Showing_nearby_wiki_information [1], I welcome feedback.
On Jul 21, 2015 10:40, "Sylvain Arnouts" sylvain.arnouts@wanadoo.fr wrote:
I know it's possible with Wikidata API to enter a position (longitude and
latitude), a range, and have all Wikipedia pages around.
How? I don't see such a feature in the wikidata modules for the MediaWiki API at https://www.wikidata.org/w/api.php , and I wasn't aware of a Wikidata query service for querying within a range of coordinate location.
[1] The same content is also at https://www.mediawiki.org/wiki/API:Showing_nearby_wiki_information
Hey !
Thanks for your answer. Now with the documentation you gave me, I'm able to catch the URL of the pages concerned, like this : https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates%7Cinfo...
But I still have some issues. I'm trying to use it in different languages. It works in english, but I'd like to have results from the french version of Wikivoyage. I don't know why, it doesn't work by calling https://fr.wikivoyage.org/w/api.php? ... same request. I've no answer, even if the page actually exists.
Maybe you got an idea ?
Thanks a lot for your help.
Le 22/07/2015 03:25, S Page a écrit :
There's an article about getting pages nearby with action=geosearch, http://devhub.wmflabs.org/wiki/API:Showing_nearby_wiki_information [1], I welcome feedback.
On Jul 21, 2015 10:40, "Sylvain Arnouts" sylvain.arnouts@wanadoo.fr wrote:
I know it's possible with Wikidata API to enter a position (longitude and
latitude), a range, and have all Wikipedia pages around.
How? I don't see such a feature in the wikidata modules for the MediaWiki API at https://www.wikidata.org/w/api.php , and I wasn't aware of a Wikidata query service for querying within a range of coordinate location.
[1] The same content is also at https://www.mediawiki.org/wiki/API:Showing_nearby_wiki_information _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Wed, Jul 22, 2015 at 9:09 AM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote:
But I still have some issues. I'm trying to use it in different languages. It works in english, but I'd like to have results from the french version of Wikivoyage. I don't know why, it doesn't work by calling https://fr.wikivoyage.org/w/api.php? ... same request. I've no answer, even if the page actually exists.
For this feature to work, the page obviously needs to know its coordinates. The English page does < https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates&ti... while the French page does not < https://fr.wikivoyage.org/w/api.php?action=query&prop=coordinates&ti.... The coordinates are stored into the page properties using the {{#coordinates:}} special function, see < https://www.mediawiki.org/wiki/Extension:GeoData#Usage%3E. On English Wiktionary, this function is called using the {{Geo}} template (see < https://en.wikivoyage.org/w/index.php?title=Template:Geo&action=edit%3E). On the French Wiktionary, the function should probably be called in {{Info Ville}} or {{Geo}}, I guess.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]]
Thanks for your help !
Actually, it's the same for other languages, but the API has a very specific way to manage languages in request.
To have the datas in different languages, we have to call the langlinks props in the url, and then do llprop=url to have the url of the page for each languages. This is the final request I send to the API : $wikivoyageRequest = "https://en.wikivoyage.org/w/api.php?action=query&format=json&" //Base ."prop=coordinates|info|langlinks&" //Props list ."inprop=url" //Properties dedicated to url ."&llprop=url"//Properties dedicated to langlinks ."&generator=geosearch&ggscoord=$user_latitude|$user_longitude&ggsradius=10000&ggslimit=50"; //Properties dedicated to geosearch
The answer contains every link for every language, so I guess it solves my problem.
Thanks a lot for helping me, I'll show you my project when it's over ! :)
Le 22/07/2015 15:44, Petr Kadlec a écrit :
On Wed, Jul 22, 2015 at 9:09 AM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote: But I still have some issues. I'm trying to use it in different languages. It works in english, but I'd like to have results from the french version of Wikivoyage. I don't know why, it doesn't work by calling https://fr.wikivoyage.org/w/api.php? ... same request. I've no answer, even if the page actually exists.
For this feature to work, the page obviously needs to know its coordinates. The English page does < https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates&ti... while the French page does not < https://fr.wikivoyage.org/w/api.php?action=query&prop=coordinates&ti.... The coordinates are stored into the page properties using the {{#coordinates:}} special function, see < https://www.mediawiki.org/wiki/Extension:GeoData#Usage%3E. On English Wiktionary, this function is called using the {{Geo}} template (see < https://en.wikivoyage.org/w/index.php?title=Template:Geo&action=edit%3E). On the French Wiktionary, the function should probably be called in {{Info Ville}} or {{Geo}}, I guess.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]] _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hi,
On Wed, Jul 22, 2015 at 5:10 PM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote:
Actually, it's the same for other languages, but the API has a very specific way to manage languages in request.
To have the datas in different languages, we have to call the langlinks props in the url, and then do llprop=url to have the url of the page for each languages. This is the final request I send to the API : $wikivoyageRequest = " https://en.wikivoyage.org/w/api.php?action=query&format=json&" //Base ."prop=coordinates|info|langlinks&" //Props list ."inprop=url" //Properties dedicated to url ."&llprop=url"//Properties dedicated to langlinks ."&generator=geosearch&ggscoord=$user_latitude|$user_longitude&ggsradius=10000&ggslimit=50"; //Properties dedicated to geosearch
The answer contains every link for every language, so I guess it solves my problem.
Well, that depends on what exactly is your problem. The query you have shown here is "find all articles within the radius on the English Wikivoyage, and give me the versions of those English articles in other languages, if they exist". However, if you try e.g. < https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates%7Cinfo..., you'll find nothing, even though there is an article about Île d'Aix (lying on those coordinates) on the French and German Wikivoyages, which you _will_ find using < https://de.wikivoyage.org/w/api.php?action=query&prop=coordinates%7Cinfo... (and you would find it also on French Wikivoyage, if it had the {{#coordinates}} I wrote about in the previous message).
In other words, you are searching _only_ within English Wikivoyage articles with the query you posted above. Whether that is enough for you, I cannot decide.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]]
Hi.
You're right, I didn't think about it. So to have all result, I have to call all API on each Wikivoyage version ?
Thank you.
Le 22/07/2015 17:51, Petr Kadlec a écrit :
Hi,
On Wed, Jul 22, 2015 at 5:10 PM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote: Actually, it's the same for other languages, but the API has a very specific way to manage languages in request.
To have the datas in different languages, we have to call the langlinks props in the url, and then do llprop=url to have the url of the page for each languages. This is the final request I send to the API : $wikivoyageRequest = " https://en.wikivoyage.org/w/api.php?action=query&format=json&" //Base ."prop=coordinates|info|langlinks&" //Props list ."inprop=url" //Properties dedicated to url ."&llprop=url"//Properties dedicated to langlinks ."&generator=geosearch&ggscoord=$user_latitude|$user_longitude&ggsradius=10000&ggslimit=50"; //Properties dedicated to geosearch
The answer contains every link for every language, so I guess it solves my problem.
Well, that depends on what exactly is your problem. The query you have shown here is "find all articles within the radius on the English Wikivoyage, and give me the versions of those English articles in other languages, if they exist". However, if you try e.g. < https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates%7Cinfo..., you'll find nothing, even though there is an article about Île d'Aix (lying on those coordinates) on the French and German Wikivoyages, which you _will_ find using < https://de.wikivoyage.org/w/api.php?action=query&prop=coordinates%7Cinfo... (and you would find it also on French Wikivoyage, if it had the {{#coordinates}} I wrote about in the previous message).
In other words, you are searching _only_ within English Wikivoyage articles with the query you posted above. Whether that is enough for you, I cannot decide.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]] _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hi,
On Wed, Jul 22, 2015 at 7:13 PM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote:
You're right, I didn't think about it. So to have all result, I have to call all API on each Wikivoyage version ?
Well, either that, or you might want to utilize Wikidata, which should basically contain everything. For instance, using < https://wdq.wmflabs.org/api?q=around%5B625,46.016667,-1.175,10%5D%3E you’ll get the list of all Wikidata items in 10km radius around Île d'Aix. You might want to limit the query to Wikidata items with a link to a Wikivoyage article in English, German or French with < https://wdq.wmflabs.org/api?q=around%5B625,46.016667,-1.175,10%5D%20AND%20li... (add more languages to the list if so desired). I don’t know if mapping those entity IDs to links could be done in a single step (@Magnus?), or you need to take the result and in another step call something < https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q214568%7CQ2...
.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]]
Hi guys !
Thanks to all your answer and advices you posted on this thread, the new version of my website is now online ! http://wikijourney.eu/ It's now working with datas from Wikipedia, Wikidata, WikiVoyage, and OpenStreetMaps. Feel free to contribute on the Github ;)
Thanks a lot !
Le 22/07/2015 22:47, Petr Kadlec a écrit :
Hi,
On Wed, Jul 22, 2015 at 7:13 PM, Sylvain Arnouts <sylvain.arnouts@wanadoo.fr
wrote: You're right, I didn't think about it. So to have all result, I have to call all API on each Wikivoyage version ?
Well, either that, or you might want to utilize Wikidata, which should basically contain everything. For instance, using < https://wdq.wmflabs.org/api?q=around%5B625,46.016667,-1.175,10%5D%3E you’ll get the list of all Wikidata items in 10km radius around Île d'Aix. You might want to limit the query to Wikidata items with a link to a Wikivoyage article in English, German or French with < https://wdq.wmflabs.org/api?q=around%5B625,46.016667,-1.175,10%5D%20AND%20li... (add more languages to the list if so desired). I don’t know if mapping those entity IDs to links could be done in a single step (@Magnus?), or you need to take the result and in another step call something < https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q214568%7CQ2...
.
HTH, -- [[cs:User:Mormegil | Petr Kadlec]] _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org