Thursday, October 1, 2009

Re: Geocoding, Distance, & Paginate...

Hello,

This works for me ( not paginating )

$points = $this->find('all', array(
'order' => '
distance ASC,
'fields' => "
Table.*,
(3958 * 3.1415926 * SQRT(({$y2} - {$y}) * ({$y2} - {$y}) + COS
({$y2} / 57.29578) * COS({$y} / 57.29578) * ({$x2} - {$x}) * ({$x2} -
{$x})) / 180)
AS distance",
'conditions' => "
1=1
HAVING distance <= {$distance}
"
));

Andras

On Oct 1, 2009, at 2:54 PM, Kyle Decot wrote:

>
> I am paginating some results and if the user provides a address, then
> I am geocoding the address and doing a radius search. I would like to
> order those results by distance though. How do I add a dynamically
> created field (distance) to my paginated results?
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: