Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class GeoPoint.
Represents a geographical point.
Unless specified otherwise, this must conform to theWGS84standard.
Values must be within normalized ranges.
Example:
use Google\Cloud\Core\GeoPoint;
$point = new GeoPoint(37.423147, -122.085015);
Namespace
Google \ Cloud \ Core
Methods
__construct
Create a GeoPoint.
Ints will be converted to floats. Values not passing theis_numeric()check will result in an exception.
Parameters
Name
Description
latitude
float|int|null
The GeoPoint Latitude.Notethatnullis not a generally valid value, and will throw anInvalidArgumentExceptionunless$allowNullis set totrue.
longitude
float|int|null
The GeoPoint Longitude.Notethatnullis not a generally valid value, and will throw anInvalidArgumentExceptionunless$allowNullis set totrue.
allowNull
bool
[optional] If true, null values will be allowed
in the constructor only. This switch exists to handle a rare case
wherein a geopoint may be empty and is not intended for use from
outside the client.Defaults tofalse.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud PHP shared dependency, providing functionality useful to all components. Client - Class GeoPoint (1.64.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.64.2 (latest)](/php/docs/reference/cloud-core/latest/GeoPoint)\n- [1.64.1](/php/docs/reference/cloud-core/1.64.1/GeoPoint)\n- [1.63.0](/php/docs/reference/cloud-core/1.63.0/GeoPoint)\n- [1.62.3](/php/docs/reference/cloud-core/1.62.3/GeoPoint)\n- [1.61.0](/php/docs/reference/cloud-core/1.61.0/GeoPoint)\n- [1.60.1](/php/docs/reference/cloud-core/1.60.1/GeoPoint)\n- [1.59.1](/php/docs/reference/cloud-core/1.59.1/GeoPoint)\n- [1.58.2](/php/docs/reference/cloud-core/1.58.2/GeoPoint)\n- [1.53.0](/php/docs/reference/cloud-core/1.53.0/GeoPoint)\n- [1.52.11](/php/docs/reference/cloud-core/1.52.11/GeoPoint)\n- [1.51.2](/php/docs/reference/cloud-core/1.51.2/GeoPoint)\n- [1.50.0](/php/docs/reference/cloud-core/1.50.0/GeoPoint)\n- [1.49.3](/php/docs/reference/cloud-core/1.49.3/GeoPoint)\n- [1.48.1](/php/docs/reference/cloud-core/1.48.1/GeoPoint) \nReference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class GeoPoint.\n\nRepresents a geographical point.\n\nUnless specified otherwise, this must conform to the\n[WGS84](http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf) standard.\nValues must be within normalized ranges.\n\nExample: \n\n use Google\\Cloud\\Core\\GeoPoint;\n\n $point = new GeoPoint(37.423147, -122.085015);\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Core\n\nMethods\n-------\n\n### __construct\n\nCreate a GeoPoint.\n\nInts will be converted to floats. Values not passing the `is_numeric()`\ncheck will result in an exception.\n\n### latitude\n\nGet the latitude\n\nExample: \n\n $latitude = $point-\u003elatitude();\n\n### setLatitude\n\nSet the latitude\n\nNon-numeric values will result in an exception\n\nExample: \n\n $point-\u003esetLatitude(42.279594);\n\n### longitude\n\nGet the longitude\n\nExample: \n\n $longitude = $point-\u003elongitude();\n\n### setLongitude\n\nSet the longitude\n\nNon-numeric values will result in an exception.\n\nExample: \n\n $point-\u003esetLongitude(-83.732124);\n\n### point\n\nReturn a GeoPoint\n\nExample: \n\n $point = $point-\u003epoint();\n\n### jsonSerialize\n\nImplement JsonSerializable by representing GeoPoint as a JSON-object: \n\n {\n latitude: 31.778333\n longitude: 35.229722\n }"]]