GeoPoint class

An immutable object representing a geographic location in Firestore. The location is represented as latitude/longitude pair.

Latitude values are in the range of [-90, 90]. Longitude values are in the range of [-180, 180].

Signature:

exportdeclareclassGeoPoint

Constructors

ConstructorModifiersDescription
(constructor)(latitude, longitude)Creates a new immutableGeoPoint object with the provided latitude and longitude values.

Properties

PropertyModifiersTypeDescription
latitudenumberThe latitude of thisGeoPoint instance.
longitudenumberThe longitude of thisGeoPoint instance.

Methods

MethodModifiersDescription
fromJSON(json)staticBuilds aGeoPoint instance from a JSON object created byGeoPoint.toJSON().
isEqual(other)Returns true if thisGeoPoint is equal to the provided one.
toJSON()Returns a JSON-serializable representation of thisGeoPoint instance.

GeoPoint.(constructor)

Creates a new immutableGeoPoint object with the provided latitude and longitude values.

Signature:

constructor(latitude:number,longitude:number);

Parameters

ParameterTypeDescription
latitudenumberThe latitude as number between -90 and 90.
longitudenumberThe longitude as number between -180 and 180.

GeoPoint.latitude

The latitude of thisGeoPoint instance.

Signature:

getlatitude():number;

GeoPoint.longitude

The longitude of thisGeoPoint instance.

Signature:

getlongitude():number;

GeoPoint.fromJSON()

Builds aGeoPoint instance from a JSON object created byGeoPoint.toJSON().

Signature:

staticfromJSON(json:object):GeoPoint;

Parameters

ParameterTypeDescription
jsonobjecta JSON object represention of aGeoPoint instance

Returns:

GeoPoint

an instance ofGeoPoint if the JSON object could be parsed. Throws aFirestoreError if an error occurs.

GeoPoint.isEqual()

Returns true if thisGeoPoint is equal to the provided one.

Signature:

isEqual(other:GeoPoint):boolean;

Parameters

ParameterTypeDescription
otherGeoPointTheGeoPoint to compare against.

Returns:

boolean

true if thisGeoPoint is equal to the provided one.

GeoPoint.toJSON()

Returns a JSON-serializable representation of thisGeoPoint instance.

Signature:

toJSON():{latitude:number;longitude:number;type:string;};

Returns:

{ latitude: number; longitude: number; type: string; }

a JSON representation of this object.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-15 UTC.