\Kronolith_Geo_Sql

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.

Summary

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

Properties

$_db

$_db : \Horde_Db_Adapter

Type

\Horde_Db_Adapter

Methods

__construct()

__construct(\Horde_Db_Adapter  $adapter) : \Kronolith_Geo_Base

Parameters

\Horde_Db_Adapter $adapter

The Horde_Db adapter

Returns

\Kronolith_Geo_Base

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) 

Deletes an entry from storage

Parameters

string $event_id

The event it.

Throws

\Kronolith_Exception

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.