GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
LIMITING QUERY RESULTS  XML
Forum Index -> General
Author Message
arlenef



Joined: 05/10/2007 04:36:25
Messages: 2
Offline

Hi. Please help me with this problem:

I need to limit wikipediaSearch results to the actual country info:
ex. http://ws.geonames.org/wikipediaSearch?q=philippines&maxRows=1
returns:
<title>Caramoan Peninsula</title>
Erlend suggested
http://ws.geonames.org/wikipediaSearch?q=republic+of+philippines&maxRows=1
and it returned
<title>Philippines</title>

but how about for other countries?
ex. http://ws.geonames.org/wikipediaSearch?q=australia&maxRows=1
will return
<title>Bolgart, Western Australia</title>

How can I tweak the query to only produce
<title>Australia</title>

Unlike the search service, wikipediaSearch is not that flexible to let me do that. Is there another way?
'allowed_parameters' => array(
//our style geonames style
'query' => 'q',
'lang' => 'lang', // Geonames default = en
'maxrows' => 'maxRows', // Geonames default = 5
),

Thanks,
Arlene.
marc



Joined: 08/12/2005 07:39:47
Messages: 4486
Offline

Hi Arlene

I have added a new parameter 'title' which allows to search on the title only :
http://ws.geonames.org/wikipediaSearch?&maxRows=1&title=philippines

I don't know how much this new parameter can solve your problem.

Regards

Marc

[WWW]
arlenef



Joined: 05/10/2007 04:36:25
Messages: 2
Offline

Thanks Marc!
This worked Another item that you might want to consider is having a hierarchy inside - like to distinguish if it's a province, a town, a city or something, from the parent (country), we need to find also which are the related boundaries, ex states, cities, regions - more like this xml file -> parameter type:city
<geonames>
<entry>
<lang>en</lang>
<title>Manila</title>
<type>city</type>
<summary>
:''For other meanings of the word, see Manila (disambiguation). For the greater metropolitan area, see Metro Manila.'' The City of Manila (Filipino: ''Lungsod ng Maynila''), or simply Manila, is the capital of the Philippines and one of the municipalities that comprise Metro Manila. The city is located on the eastern shore of Manila Bay on Luzon, the country's largest island (...)
</summary>
<feature/>
<population>1600000</population>
<elevation>0</elevation>
<lat>14.5833</lat>
<lng>121</lng>
<wikipediaUrl>http://en.wikipedia.org/wiki/Manila</wikipediaUrl>
<thumbnailImg>http://www.geonames.org/img/wikipedia/125000/thumb-124842-100.jpg
</thumbnailImg>
</entry>
</geonames>
marc



Joined: 08/12/2005 07:39:47
Messages: 4486
Offline

Hi Arlene

The missing type information has to do with problems parsing wikipedia dump. Unfortunately there is no consensus in the wikipedia community on how to add geo information like coordinates and feature types to articles. At the contrary more and more wikipedians have fun inventing new templates. I would not be suprised if sooner or later we see a complete mess in wikipedia that makes it impossible to do anything useful with it
The only solution I see is that the wikipedia administrators restrict the generation of new templates.

Regards

Marc

[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team