Show:

Places Class

Extends Base_Places
Module: Places

Static methods for the Places models.

Item Index

Methods

Methods

autocomplete

(
  • $input
  • [$throwIfBadValue=false]
  • [$types=array("establishment")]
  • [$latitude=userLocation]
  • [$longitude=userLocation]
  • [$meters=40234]
)
Array static

Get autocomplete results

Parameters:

  • $input String

    The text (typically typed by a user) to find completions for

  • [$throwIfBadValue=false] Boolean optional

    Whether to throw Q_Exception if the result contains a bad value

  • [$types=array("establishment")] Array optional

    Can 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 optional

    Override the latitude of the coordinates to search around

  • [$longitude=userLocation] Double optional

    Override the longitude of the coordinates to search around

  • [$meters=40234] Double optional

    Override the radius, in meters, to search around

Returns:

Array:

An array of prediction objects from Google Places predictions API

closest

(
  • point
  • polyline
)
Array static

Use this method to calculate the closest point on a polyline.

Parameters:

  • point Array
    • x Double
    • y Double
  • polyline Array

    an array of associative arrays with "x" and "y" keys

Returns:

Array:

contains properties "index", "x", "y", "fraction", "distance" (in same units as x, y)

distance

(
  • $lat_1
  • $long_1
  • $lat_2
  • $long_2
)
Double | Null static

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:

Double | Null:

The result, in meters, of applying the haversine formula. Returns null if any of the inputs are null.

distanceLabel

(
  • $meters
  • [$units]
)
String static

Use this method to generate a label for a radius based on a distance in meters

Parameters:

  • $meters Double
  • [$units] String optional

    optionally specify 'km', 'kilometers' or 'miles', or null for auto

Returns:

String:

Returns a label that looks like "x.y km", "x miles" or "x meters"

getRemoteContents

(
  • $url
)
String static

Create valid request to remote server to get contents

Parameters:

  • $url String

Returns:

String:

request result

heading

(
  • $lat1
  • $long1
  • $lat2
  • $long2
)
Double static

Use this method to calculate the heading from pairs of coordinates

Parameters:

  • $lat1 Double

    latitude in degrees

  • $long1 Double

    longitude in degrees

  • $lat2 Double

    latitude in degrees

  • $long2 Double

    longitude in degrees

Returns:

Double:

The heading, in degrees