Author |
Message |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/04/2007 11:57:53
|
pde
Joined: 29/04/2007 10:55:09
Messages: 3
Offline
|
Hi,
I'm building an app that uses the geonames.org API to query for place information about photos. Basically, it searches for all places within a threshold radius and uses the closest one.
Since photo's are usually spatially clustered, I want to use an easy method to prevent the querying of geonames.org for every separate picture. It involves getting the center of a cluster within (twice) the threshold radius, and querying for all places within that circle.
I thought I had it working, but I just discovered that geonames.org returns the 10 closest results, not all of them. Is there some way to get all the places within the specified (reasonable) radius?
Thanks,
Pieter
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/04/2007 22:03:39
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4486
Offline
|
Hi Pieter
You can use the parameter 'maxRows' to get more than the default 10 rows.
Regards
Marc
|
 |
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 30/04/2007 11:41:12
|
pde
Joined: 29/04/2007 10:55:09
Messages: 3
Offline
|
Hi Marc,
This isn't exactly what I need, but it comes close. I now have a few options to implement this;
- If I give the command with radius = 10 and maxRows = 10000, I'm pretty sure to get all the places within a 10 km range.
- If I give the command with radius = 1000 and maxRows = 10, I'm sure to get the ten most relevant results.
I notice that the first command gives nearly instantaneous results, but that it takes much longer to load the second command in areas that are sparsely populated. So I'm wondering what the least demanding is for the Geonames servers. And is this behavior actually considered good netiquete?
Thanks,
Pieter
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 01/05/2007 22:14:09
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4486
Offline
|
Hi Pieter
The second query is problematic since a huge area is covered and all places in this area have to be sorted by distance to the given lat/lng.
I have added a max radius restriction of 300km to protect the server from being overloaded by this type of query. If your application really needs we can speak about it and see how it could be perfomance-optimized on the server side.
Cheers
Marc
|
 |
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 01/05/2007 22:32:52
|
pde
Joined: 29/04/2007 10:55:09
Messages: 3
Offline
|
No, a radius of, say, 15 kilometer is usually the most I need. Actually, the first query would work out much better for me because I can work more efficiently with the the predictable results, so if you don't have any problem with it I will use that one.
Thanks,
Pieter
|
|
 |
|