Re: [Wikitech-l] Geolocation and WikiVoyage

2015-07-26 Thread Sylvain Arnouts

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.arno...@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[625,46.016667,-1.175,10] 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[625,46.016667,-1.175,10]%20AND%20link[enwikivoyage,dewikivoyage,frwikivoyage]
(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=wbgetentitiesids=Q214568|Q292111props=sitelinks/urlssitefilter=enwikivoyage|dewikivoyage|frwikivoyage

.

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 mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Geolocation and WikiVoyage

2015-07-22 Thread Sylvain Arnouts

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=queryformat=json; //Base

.prop=coordinates|info|langlinks//Props list
.inprop=url //Properties 
dedicated to url
.llprop=url//Properties 
dedicated to langlinks
.generator=geosearchggscoord=$user_latitude|$user_longitudeggsradius=1ggslimit=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.arno...@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=queryprop=coordinatestitles=Lille
while the French page does not 
https://fr.wikivoyage.org/w/api.php?action=queryprop=coordinatestitles=Lille.
The coordinates are stored into the page properties using the
{{#coordinates:}} special function, see 
https://www.mediawiki.org/wiki/Extension:GeoData#Usage. On English
Wiktionary, this function is called using the {{Geo}} template (see 
https://en.wikivoyage.org/w/index.php?title=Template:Geoaction=edit). 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


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Geolocation and WikiVoyage

2015-07-22 Thread Sylvain Arnouts

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.arno...@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=queryformat=json; //Base
.prop=coordinates|info|langlinks//Props list
 .inprop=url //Properties dedicated
to url
 .llprop=url//Properties dedicated
to langlinks
.generator=geosearchggscoord=$user_latitude|$user_longitudeggsradius=1ggslimit=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=queryprop=coordinates|infoinprop=urlgenerator=geosearchggscoord=46.016667|-1.175ggsradius=1ggslimit=50ggsradius=1ggslimit=50,
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=queryprop=coordinates|infoinprop=urlgenerator=geosearchggscoord=46.016667|-1.175ggsradius=1ggslimit=50ggsradius=1ggslimit=50
(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


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Geolocation and WikiVoyage

2015-07-22 Thread Sylvain Arnouts

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=queryprop=coordinates|infoinprop=urlgenerator=geosearchggscoord=50.6|3.02ggsradius=1ggslimit=50ggsradius=1ggslimit=50

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.arno...@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



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Geolocation and WikiVoyage

2015-07-21 Thread Sylvain Arnouts

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

Re: [Wikitech-l] Geolocation and WikiVoyage

2015-07-21 Thread Sylvain Arnouts

Thanks, it perfectly works ! :D

Le 21/07/2015 19:44, Max Semenik a écrit :

https://en.wikivoyage.org/w/api.php?action=querylist=geosearchgsradius=2gscoord=51.507222|-0.1275gslimit=100format=json

On Tue, Jul 21, 2015 at 10:40 AM, Sylvain Arnouts 
sylvain.arno...@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






___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l