Kronolith_Geo_Sql
extends Kronolith_Geo_Base
in package
General SQL implementation for storing/searching geo location data for events.
Copyright 2009-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Tags
Table of Contents
- $_db : Horde_Db_Adapter
- __construct() : Kronolith_Geo_Base
- deleteLocation() : mixed
- Deletes an entry from storage
- getLocation() : array<string|int, mixed>
- Get the location of the provided event_id.
- search() : array<string|int, mixed>
- Search for events "close to" a given point.
- setLocation() : mixed
- Set the location of the specified event _id
Properties
$_db
protected
Horde_Db_Adapter
$_db
Methods
__construct()
public
__construct(Horde_Db_Adapter $adapter) : Kronolith_Geo_Base
Parameters
- $adapter : Horde_Db_Adapter
-
The Horde_Db adapter
Return values
Kronolith_Geo_Base —deleteLocation()
Deletes an entry from storage
public
deleteLocation(string $event_id) : mixed
Parameters
- $event_id : string
Tags
Return values
mixed —getLocation()
Get the location of the provided event_id.
public
getLocation(mixed $event_id) : array<string|int, mixed>
Parameters
- $event_id : mixed
-
The event id
Tags
Return values
array<string|int, mixed> —A hash containing 'lat' and 'lon'
search()
Search for events "close to" a given point.
public
search(mixed $criteria) : array<string|int, mixed>
TODO: If all we really use the geodata for is distance, it really doesn't make sense to use the GIS extensions since the distance calculations are done with Euclidian geometry ONLY ... and therefore will give incorrect results when done on a geocentric coordinate system. They might be useful if we eventually want to do searches on MBRs
Parameters
- $criteria : mixed
-
An array of:
point - lat/lon hash radius - the radius to search in limit - limit the number of hits factor - Conversion factor for miles per distance unit [default is 69].
Tags
Return values
array<string|int, mixed> —of event ids with locations near the specified criteria.
setLocation()
Set the location of the specified event _id
public
setLocation(mixed $event_id, mixed $point) : mixed
Parameters
- $event_id : mixed
-
The event id
- $point : mixed
-
Hash containing 'lat' and 'lon' coordinates