GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Largest 10 cities algorithm  XML
Forum Index -> General
Author Message
Kpoxman



Joined: 10/09/2008 22:00:48
Messages: 2
Offline

Hello,

When browsing largest cities though the web interface, 10 largest cities in the rectangle are shown.

Could you please hint an algorithm for querying 10 "largest" items from a rectangle? Is this some kind of R-Tree modification?

Thanks.
marc



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

The rectangle index is handled by the database. Just use a spatially enabled database like postgres.


Marc

[WWW]
Kpoxman



Joined: 10/09/2008 22:00:48
Messages: 2
Offline

Rectangle index is not a problem. It can be just an R-Tree (GiST) or, as you said, using spatial extentions (for example, PostGis for Postrges).

But rectangle index does not bring an effective solution for for querying 10 largest cities from a rectangle.

Obviously, something like

SELECT * FROM cities WHERE coordinates INSIDE (alt1, lng1, alt2, lng2) ORDER BY population LIMIT 10;

is far from optimal even if INSIDE relation is handled by spatial index.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team