Its a bad example. try increasing the radious.
mysql> SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin ( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25000 ORDER BY distance LIMIT 0 , 20; +----+-----------------+ | id | distance | +----+-----------------+ | 1 | 27.10972821988 | | 2 | 27.139837055227 | | 3 | 27.561050922149 | | 5 | 27.728370356255 | | 4 | 28.16302689554 | | 6 | 28.466410083489 | +----+-----------------+ Seems there arent any points within 25 miles. They slightly further from the example coordinate. :) (lowering the radius would decrease the number of results, not increase them :) On Thu, Sep 1, 2011 at 8:32 PM, John <[email protected]> wrote: > Hello, > > I'm trying to follow Creating a Store Locator as per > http://code.google.com/apis/maps/articles/phpsqlgeocode.html > > I'm only trying to just get the SQL to work. I created the table and > populated it with the examples provided. > > However, when I tried to execute the SQL that it provided: SELECT id, > ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * > cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * > sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < > 25 ORDER BY distance LIMIT 0 , 20; > > This executed without error but returned 0 rows. I then tried to > lower the 25 mile radius to 1 mile and still it returned 0 rows. > > Has anyone gotten this to work? It seems odd that Google would post > an article that doesn't work! > > Cheers, > J > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps API V2" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
