Position handling utils, use static methods

package org.routamc.positioning

 Methods

coordinate_to_decimal ($deg, $min, $sec)

Converts DMS ( Degrees / minutes / seconds ) to decimal format longitude / latitude

Code from http://www.web-max.ca/PHP/misc_6.php

Parameters

$deg

$min

$sec

decimal_to_coordinate ($dec)

Converts decimal longitude / latitude to DMS ( Degrees / minutes / seconds )

Code from http://www.web-max.ca/PHP/misc_6.php

Parameters

$dec

get_bearing ($from, $to)

Get bearing from position to another

Code from http://www.corecoding.com/getfile.php?file=25

Parameters

$from

$to

get_closest (string $class, array $center, integer $limit, integer $max_distance, float $modifier)

Get closest items

Note: If you set a max distance you may not always get the number of items specified in the limit.

Parameters

$class

stringMidCOM DBA class to query

$center

arrayCenter position

$limit

integerHow many results to return

$max_distance

integerMaximum distance of returned objects in kilometers, or null if any

$modifier

float

Returns

arrayarray of MidCOM DBA objects sorted by proximity

get_distance ($from, $to, $unit, $round)

Get distance between to positions in kilometers

Code from http://www.corecoding.com/getfile.php?file=25

Parameters

$from

$to

$unit

$round

get_positioning_class (string $class)

Figure out which class to use for positioning

Parameters

$class

stringMidCOM class name

microformat_location ($latitude, $longitude)

Pretty print a position mapping Microformatted city name or other label

Parameters

$latitude

$longitude

Returns

string

pretty_print_coordinate ($coordinate)

Pretty-print a coordinate value (latitude or longitude)

Code from http://en.wikipedia.org/wiki/Geographic_coordinate_conversion

Parameters

$coordinate

Returns

string

pretty_print_coordinates ($latitude, $longitude)

Pretty-print a full coordinate (longitude and latitude)

Code from http://en.wikipedia.org/wiki/Geographic_coordinate_conversion

Parameters

$latitude

$longitude

Returns

string

pretty_print_location ($latitude, $longitude)

Pretty print a position mapping either to a city or cleaned coordinates

Parameters

$latitude

$longitude

Returns

string