Represents a geographical point.

Unless specified otherwise, this must conform to the
WGS84 standard.
Values must be within normalized ranges.

Example:

use Google\Cloud\Core\GeoPoint;

$point = new GeoPoint(37.423147, -122.085015);
CloneableInstantiable
Methods
public __construct( $latitude, $longitude, $allowNull = false)
 

Create a GeoPoint.

Ints will be converted to floats. Values not passing the is_numeric()
check will result in an exception.

  • throws InvalidArgumentException
public latitude()
 

Get the latitude

Example:

$latitude = $point->latitude();
  • return float|null
public longitude()
 

Get the longitude

Example:

$longitude = $point->longitude();
  • return float|null
public point()
 

Return a GeoPoint

Example:

$point = $point->point();
  • return array [LatLng](https://cloud.google.com/datastore/reference/rest/Shared.Types/LatLng)
public setLatitude( $latitude)
 

Set the latitude

Non-numeric values will result in an exception

Example:

$point->setLatitude(42.279594);
public setLongitude( $longitude)
 

Set the longitude

Non-numeric values will result in an exception.

Example:

$point->setLongitude(-83.732124);
Properties
private $latitude
 
  • var float
private $longitude
 
  • var float
Methods
private checkContext( $method, array $args)
 

Let people know if they accidentally use the getter in setter context.

  • throws InvalidArgumentException
  • return void
private validateValue( $value, $type, $allowNull = false)
 

Check a given value's validity as a coordinate.

Numeric values will be cast to type float. All other values will raise
an exception with the exception of null, if $allowNull is set to true.

  • return float|null
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only