CakePHP 2.x tools for searching and geotagging data.
-
Create your table with latitude and longitude fields.
-
Place GeoLocationBehavior into app/Model/Behavior
-
Add the Behavior to your Model:
class Item extends AppModel {
public $actsAs = array('GeoLocation');
}
Perform search on your Controller:
public function search() {
$results = $this->Item->search('all', array (
'center' => array (
'latitude' => 40.708,
'longitude' => -74.002,
'radius' => 5.0 // Kmts
)
));
pr( $results );
}