Hi Jim,

You're welcome. Good luck.

Frances

On Tue, Sep 16, 2014 at 5:23 PM, jim andrews <[email protected]> wrote:
> Hi Frances,
>
> Thanks very much. That has all the info I need and more.
>
> ja
>
> On Sep 15, 2014, at 10:42 PM, Frances Hocutt <[email protected]> wrote:
>
>> Hi Jim,
>>
>> What's going on is that the geosearch extension has two different API
>> modules: prop=coordinates, which the first suggested query used, and
>> list=geosearch, which gives the "dist" result that you want. Using
>> geosearch as a "generator" just tells the "prop=coordinates|extracts"
>> query what items you want those properties for. You can add the
>> list=geosearch query to your query string as well:
>>
>> https://en.wikipedia.org/w/api.php?action=query&list=geosearch&prop=coordinates|extracts&format=json&gscoord=51.507222%7C-0.1275&gsradius=1000&gslimit=10&colimit=10&exchars=300&exlimit=10&exintro=&indexpageids=&generator=geosearch&ggscoord=51.507222%7C-0.1275&ggsradius=1000&ggslimit=10&ggsprop=dim
>>
>> I added the 
>> "list=geosearch&gscoord=51.507222%7C-0.1275&gsradius=1000&gslimit=10"
>> to the query string. I also told it to give a list of the pageids in
>> the result with indexpageids; if you don't need that you can remove
>> the parameter, but it can be very helpful for iterating through search
>> results.
>>
>> -Frances
>>
>> On Mon, Sep 15, 2014 at 10:24 PM, jim andrews <[email protected]> wrote:
>>> Hi Frances,
>>>
>>> There does seem to be a “dist” parameter in the results documented at 
>>> https://www.mediawiki.org/wiki/Extension:GeoData#list.3Dgeosearch : if you 
>>> look in the results you see the “dist” value:
>>>
>>> <gs pageid="286442" ns="0" title="Wikimedia Foundation" lat="37.787" 
>>> lon="-122.4" dist="0.3" primary="" />
>>>
>>> This is the distance between the location passed to the API and the 
>>> location referenced in the result. But the “dist” value is nowhere to be 
>>> found in the excellent example you gave me which includes lat, lon, and 
>>> article summary.
>>>
>>> It’s not tragic if this info is not available cuz I can compute it, but I 
>>> thought if it was easily available, I’d fetch it.
>>>
>>> ja
>>>
>>> On Sep 15, 2014, at 8:08 PM, Frances Hocutt <[email protected]> 
>>> wrote:
>>>
>>>> Hi Jim,
>>>>
>>>> I don't see anything that would do that in the documentation for the
>>>> geosearch module.[1]
>>>>
>>>> Frances
>>>>
>>>> [1] https://www.mediawiki.org/wiki/Extension:GeoData#list.3Dgeosearch
>>>>
>>>> On Mon, Sep 15, 2014 at 7:30 PM, jim andrews <[email protected]> wrote:
>>>>> Thanks very much, Frances. I am receiving that info OK. I note that it 
>>>>> does not include the distance from the location in the query to the 
>>>>> article’s location. Is there a way of getting the query to return that 
>>>>> info also?
>>>>>
>>>>> ja
>>>>>
>>>>> On Sep 15, 2014, at 12:59 PM, Frances Hocutt <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Jim, try this:
>>>>>>
>>>>>> https://en.wikipedia.org/w/api.php?action=query&prop=coordinates|extracts&format=json&colimit=10&exchars=300&exlimit=10&exintro=&generator=geosearch&ggscoord=51.507222%7C-0.1275&ggsradius=1000&ggslimit=10
>>>>>>
>>>>>> The documentation for extracts is here:
>>>>>> https://www.mediawiki.org/wiki/Extension:TextExtracts#API . It is less
>>>>>> resource-intensive to only fetch extracts from the introductory
>>>>>> section so the limits for queries that use the exintro parameter have
>>>>>> higher limits than queries that require the whole page to be parsed.
>>>>>>
>>>>>> -Frances
>>>>>>
>>>>>> On Mon, Sep 15, 2014 at 12:37 PM, jim andrews <[email protected]> wrote:
>>>>>>> Thanks, Max. I read the URL you cited and visited the API sandbox, but 
>>>>>>> I don’t understand how to get an article summary. Could you please give 
>>>>>>> me an example URL?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Jim Andrews
>>>>>>> http://vispo.com
>>>>>>>
>>>>>>> On Sep 15, 2014, at 12:14 PM, Max Semenik <[email protected]> wrote:
>>>>>>>
>>>>>>>> Jim, you already can do it using geosearch as a generator[1], e.g. [2]
>>>>>>>>
>>>>>>>>
>>>>>>>> ---
>>>>>>>> [1] https://www.mediawiki.org/wiki/API:Query#Generators
>>>>>>>> [2] http://tr.im/29XHc
>>>>>>>>
>>>>>>>> On Mon, Sep 15, 2014 at 12:05 PM, jim andrews <[email protected]> wrote:
>>>>>>>> Do you know if there are any plans to include an article summary in 
>>>>>>>> the list=geosearch results? That would be terrific. I’ve been using 
>>>>>>>> the geonames.org  API for retrieving Wikipedia articles, and it 
>>>>>>>> returns a brief (350-400 character?) article summary which seems to be 
>>>>>>>> the first 350-400 characters (or so) of the Wikipedia articles. This 
>>>>>>>> is very useful in search results, of course. The user can use that 
>>>>>>>> information to decide which of the several links to click. The title 
>>>>>>>> alone is often rather mysterious. It often does not provide enough 
>>>>>>>> info for the user to make a decision as to which link to click, if any.
>>>>>>>>
>>>>>>>> Currently, the info I get back from your service ( 
>>>>>>>> https://www.mediawiki.org/wiki/Extension:GeoData#API ) has these 
>>>>>>>> fields:
>>>>>>>> <gs pageid="167267" ns="0" title="City Lights Bookstore" lat="37.7976" 
>>>>>>>> lon="-122.407" dist="1331" primary="" />
>>>>>>>>
>>>>>>>> I’m suggesting it also include a ‘summary’ field consisting of the 
>>>>>>>> first 350-400 characters of the article.
>>>>>>>>
>>>>>>>> Is that feasible?
>>>>>>>>
>>>>>>>> What I currently do is use geonames as first choice and if that fails, 
>>>>>>>> I use your service. It would be nice to be able to use your service as 
>>>>>>>> first choice.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Jim Andrews
>>>>>>>> _______________________________________________
>>>>>>>> Mediawiki-api mailing list
>>>>>>>> [email protected]
>>>>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best regards,
>>>>>>>> Max Semenik ([[User:MaxSem]])
>>>>>>>> _______________________________________________
>>>>>>>> Mediawiki-api mailing list
>>>>>>>> [email protected]
>>>>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mediawiki-api mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mediawiki-api mailing list
>>>>>> [email protected]
>>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mediawiki-api mailing list
>>>>> [email protected]
>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>>
>>>> _______________________________________________
>>>> Mediawiki-api mailing list
>>>> [email protected]
>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>>
>>>
>>> _______________________________________________
>>> Mediawiki-api mailing list
>>> [email protected]
>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>>
>> _______________________________________________
>> Mediawiki-api mailing list
>> [email protected]
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
>
> _______________________________________________
> Mediawiki-api mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to