GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Finding nearby geonameid's  XML
Forum Index -> General
Author Message
johnnytoobad



Joined: 24/08/2009 15:39:52
Messages: 1
Offline

So I have GeonameId and Lat & Long for any given position. I want to be able to find out nearby products to this position, my products tabel looks like:

ProductId ProductName GeonameId
-----------------------------------------------
1 Product 1 875124
2 Product 2 987412
etc

So my question is whats the best way to find which products are close by a given location? I am using the dump on a locale MySQL database.
marc



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

There are several approaches and which is best for your depends on your requirements, skills and environment.

You could add the lat/lng to the product table, that you don't have to join with all geonames records.

For the distance query you could use a spatial extension: http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html
(geonames is using postgres with postgis)
or you could use a bounding box restriction on the coordinates and sort by your own distance implementation:
http://forum.geonames.org/gforum/posts/list/1081.page

Other threads:
http://forum.geonames.org/gforum/posts/list/692.page
http://forum.geonames.org/gforum/posts/list/727.page

Best

Marc

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