PHP Class Google\Cloud\Datastore\GeoPoint

Example: $point = new GeoPoint(37.423147, -122.085015);
See also: https://cloud.google.com/datastore/reference/rest/Shared.Types/LatLng LatLng
Mostrar archivo Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Public Methods

Method Description
__construct ( float | integer $latitude, float | integer $longitude ) Create a GeoPoint.
latitude ( ) : float Get the latitude
longitude ( ) : float Get the longitude
point ( ) : array Return a GeoPoint
setLatitude ( integer | float $latitude ) : GeoPoint Set the latitude
setLongitude ( float | integer $longitude ) : GeoPoint Set the longitude

Private Methods

Method Description
checkContext ( string $method, array $args ) : void Let people know if they accidentally use the getter in setter context.

Method Details

__construct() public method

Ints will be converted to floats. Values not passing the is_numeric() check will result in an exception.
public __construct ( float | integer $latitude, float | integer $longitude )
$latitude float | integer
$longitude float | integer

latitude() public method

Example: $latitude = $point->latitude();
public latitude ( ) : float
return float

longitude() public method

Example: $longitude = $point->longitude();
public longitude ( ) : float
return float

point() public method

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

setLatitude() public method

Non-numeric values will result in an exception Example: $point->setLatitude(42.279594);
public setLatitude ( integer | float $latitude ) : GeoPoint
$latitude integer | float The new latitude
return GeoPoint

setLongitude() public method

Non-numeric values will result in an exception. Example: $point->setLongitude(-83.732124);
public setLongitude ( float | integer $longitude ) : GeoPoint
$longitude float | integer The new longitude value
return GeoPoint