Kronolith_Geo_Mysql
extends Kronolith_Geo_Sql
in package
Mysql implementation for storing/searching geo location data for events.
Makes use of the GIS extensions available in mySQL 4.1 and later.
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
- $_conversionFactor : int
- Conversion factor needed by search functions Roughly 69 miles per distance unit
- __construct() : Kronolith_Geo_Base
- deleteLocation() : mixed
- Removes the event's location 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
$_conversionFactor
Conversion factor needed by search functions Roughly 69 miles per distance unit
private
int
$_conversionFactor
= 69
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()
Removes the event's location from storage.
public
abstract deleteLocation(string $event_id) : mixed
Parameters
- $event_id : string
-
The event it.
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