docs-devsite/firestore_lite_pipelines.geopoint.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
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].
<b>Signature:</b>
export declare class GeoPoint
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(latitude, longitude) | Creates a new immutable <code>GeoPoint</code> object with the provided latitude and longitude values. |
| Property | Modifiers | Type | Description |
|---|---|---|---|
| latitude | number | The latitude of this <code>GeoPoint</code> instance. | |
| longitude | number | The longitude of this <code>GeoPoint</code> instance. |
| Method | Modifiers | Description |
|---|---|---|
| fromJSON(json) | <code>static</code> | Builds a <code>GeoPoint</code> instance from a JSON object created by GeoPoint.toJSON()<!-- -->. |
| isEqual(other) | Returns true if this <code>GeoPoint</code> is equal to the provided one. | |
| toJSON() | Returns a JSON-serializable representation of this <code>GeoPoint</code> instance. |
Creates a new immutable GeoPoint object with the provided latitude and longitude values.
<b>Signature:</b>
constructor(latitude: number, longitude: number);
| Parameter | Type | Description |
|---|---|---|
| latitude | number | The latitude as number between -90 and 90. |
| longitude | number | The longitude as number between -180 and 180. |
The latitude of this GeoPoint instance.
<b>Signature:</b>
get latitude(): number;
The longitude of this GeoPoint instance.
<b>Signature:</b>
get longitude(): number;
Builds a GeoPoint instance from a JSON object created by GeoPoint.toJSON()<!-- -->.
<b>Signature:</b>
static fromJSON(json: object): GeoPoint;
| Parameter | Type | Description |
|---|---|---|
| json | object | a JSON object represention of a <code>GeoPoint</code> instance |
<b>Returns:</b>
an instance of GeoPoint if the JSON object could be parsed. Throws a FirestoreError if an error occurs.
Returns true if this GeoPoint is equal to the provided one.
<b>Signature:</b>
isEqual(other: GeoPoint): boolean;
| Parameter | Type | Description |
|---|---|---|
| other | GeoPoint | The <code>GeoPoint</code> to compare against. |
<b>Returns:</b>
boolean
true if this GeoPoint is equal to the provided one.
Returns a JSON-serializable representation of this GeoPoint instance.
<b>Signature:</b>
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
<b>Returns:</b>
{ latitude: number; longitude: number; type: string; }
a JSON representation of this object.