What are some lat / longs you're using? And where are you measuring
distance from?

Make sure that your coordinates are entered correctly with a + (N for
lat, E for long) or - (S for lat, W for long).
Missoula, MT, USA    46.867703, -113.994141

Overview of lat/long
http://www-atlas.usgs.gov/articles/mapping/a_latlong.html

Here is the Great Circle DIstance formula:
http://en.wikipedia.org/wiki/Great-circle_distance

Disclaimer: I've never actually used Geocoded Behavior but do work
with maps.

On Mar 9, 8:43 am, Kyle Decot <[email protected]> wrote:
> I am trying to create a search by distance feature using the Geocoded
> behavior but I am having an odd problem. Whenever I search for
> something, no results are returned unless I change the radius to
> something incredibly high like 6000 miles. I looked at the query that
> it is creating and it is saying that all my locations are anywhere
> from 5000 miles to 9000 miles away! Here is the query I used to find
> how far away everything is from my location. It's just a simplified
> version of what the geocoded behavior is making.
>
> SELECT (3958 * 3.1415926 * SQRT((`Skatepark`.`lat` - -82.713132) *
> (`Skatepark`.`lat` - -82.713132) + COS(`Skatepark`.`lat` / 57.29578) *
> COS(-82.713132 / 57.29578) * (`Skatepark`.`lon` - 39.8141202) *
> (`Skatepark`.`lon` - 39.8141202)) / 180) AS distance,Skatepark.id FROM
> skateparks as Skatepark ORDER BY Distance ASC
>
> I'm not sure why this is happening. Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to