List:General Discussion« Previous MessageNext Message »
From:Ben Clewett Date:January 10 2006 12:01pm
Subject:Geographical advice
View as plain text  

I have a need to locate (x,y) coordinates from mysql where they are 
close to another coordinate.  For instance, all pizza bars near my car.

Example:  Searching for points closer than z to (i,j) using Pythagoras:

SET i = 10;
SET j = 10;
SET z = 30;
   FROM coordinates
   WHERE POW(x - @i, 2) + POW(y - @i, 2) < POW(@z, 2)

Big problem!  Must searches every row.  Linear indexing not able to help 

I have been reading the Geographic Spacial extensions to MySQL.  Which 
enable me to store the coordinates in a far more useful form.  But do 
not seem to offer me the type of index I need.

This must be a common problem, is there any person who can help me?

Thanks in advance,

Ben Clewett.

Geographical adviceBen Clewett10 Jan
  • Re: Geographical adviceJames Harvard10 Jan
    • RE: Geographical adviceAndy Eastham10 Jan
  • Re: Geographical advicedouglass_davis14 Jan
RE: Geographical adviceBen Clewett10 Jan