Places Class
Static methods for the Places models.
Item Index
Methods
- autocomplete static
- closest static
- distance static
- distanceLabel static
- getRemoteContents static
- heading static
Methods
autocomplete
-
$input
-
[$throwIfBadValue=false]
-
[$types=array("establishment")]
-
[$latitude=userLocation]
-
[$longitude=userLocation]
-
[$meters=40234]
Get autocomplete results
Parameters:
-
$input
StringThe text (typically typed by a user) to find completions for
-
[$throwIfBadValue=false]
Boolean optionalWhether to throw Q_Exception if the result contains a bad value
-
[$types=array("establishment")]
Array optionalCan include "establishment", "locality", "sublocality", "postal_code", "country", "administrative_area_level_1", "administrative_area_level_2". Set to true to include all types.
-
[$latitude=userLocation]
Double optionalOverride the latitude of the coordinates to search around
-
[$longitude=userLocation]
Double optionalOverride the longitude of the coordinates to search around
-
[$meters=40234]
Double optionalOverride the radius, in meters, to search around
Returns:
An array of prediction objects from Google Places predictions API
closest
-
point
-
polyline
Use this method to calculate the closest point on a polyline.
Parameters:
-
point
Array-
x
Double -
y
Double
-
-
polyline
Arrayan array of associative arrays with "x" and "y" keys
Returns:
contains properties "index", "x", "y", "fraction", "distance" (in same units as x, y)
distance
-
$lat_1
-
$long_1
-
$lat_2
-
$long_2
Use this to calculate the haversine distance between two sets of lat/long coordinates on the Earth
Parameters:
-
$lat_1
Double -
$long_1
Double -
$lat_2
Double -
$long_2
Double
Returns:
The result, in meters, of applying the haversine formula. Returns null if any of the inputs are null.
distanceLabel
-
$meters
-
[$units]
Use this method to generate a label for a radius based on a distance in meters
Parameters:
-
$meters
Double -
[$units]
String optionaloptionally specify 'km', 'kilometers' or 'miles', or null for auto
Returns:
Returns a label that looks like "x.y km", "x miles" or "x meters"
getRemoteContents
-
$url
Create valid request to remote server to get contents
Parameters:
-
$url
String
Returns:
request result
heading
-
$lat1
-
$long1
-
$lat2
-
$long2
Use this method to calculate the heading from pairs of coordinates
Parameters:
-
$lat1
Doublelatitude in degrees
-
$long1
Doublelongitude in degrees
-
$lat2
Doublelatitude in degrees
-
$long2
Doublelongitude in degrees
Returns:
The heading, in degrees