\Kronolith_Geo_Mysql

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.

Summary

Methods
Properties
Constants
setLocation()
getLocation()
deleteLocation()
search()
__construct()
No public properties found
No constants found
No protected methods found
$_db
N/A
No private methods found
$_conversionFactor
N/A

Properties

$_db

$_db : \Horde_Db_Adapter

Type

\Horde_Db_Adapter

$_conversionFactor

$_conversionFactor : integer

Conversion factor needed by search functions Roughly 69 miles per distance unit

Type

integer

Methods

setLocation()

setLocation(string  $event_id, array  $point) 

Set the location of the specified event _id

Parameters

string $event_id

The event id

array $point

Hash containing 'lat' and 'lon' coordinates

Throws

\Kronolith_Exception

getLocation()

getLocation(string  $event_id) : array

Get the location of the provided event_id.

Parameters

string $event_id

The event id

Throws

\Kronolith_Exception

Returns

array —

A hash containing 'lat' and 'lon'

deleteLocation()

deleteLocation(string  $event_id) 

Removes the event's location from storage.

Parameters

string $event_id

The event it.

search()

search(array  $criteria) : array

Search for events "close to" a given point.

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

array $criteria

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].

Throws

\Kronolith_Exception

Returns

array —

of event ids with locations near the specified criteria.

__construct()

__construct(\Horde_Db_Adapter  $adapter) : \Kronolith_Geo_Base

Parameters

\Horde_Db_Adapter $adapter

The Horde_Db adapter

Returns

\Kronolith_Geo_Base