GeoPoint class

表示 Firestore 中地理位置的不可变对象。该位置以纬度/经度对表示。

纬度值的范围为 [-90, 90]。经度值的范围为 [-180, 180]。

签名:

export declare class GeoPoint 

构造函数

构造函数修饰符描述
(构造函数)(纬度、经度)使用提供的纬度和经度值创建一个新的不可变GeoPoint对象。

特性

财产修饰符类型描述
纬度数字GeoPoint实例的纬度。
经度数字GeoPoint实例的经度。

方法

方法修饰符描述
是否等于(其他)如果此GeoPoint等于提供的 GeoPoint,则返回 true。
toJSON()返回此 GeoPoint 的 JSON 可序列化表示形式。

GeoPoint.(构造函数)

使用提供的纬度和经度值创建一个新的不可变GeoPoint对象。

签名:

constructor(latitude: number, longitude: number);

参数

范围类型描述
纬度数字纬度为 -90 到 90 之间的数字。
经度数字经度为 -180 到 180 之间的数字。

GeoPoint.纬度

GeoPoint实例的纬度。

签名:

get latitude(): number;

GeoPoint.经度

GeoPoint实例的经度。

签名:

get longitude(): number;

GeoPoint.isEqual()

如果此GeoPoint等于提供的 GeoPoint,则返回 true。

签名:

isEqual(other: GeoPoint): boolean;

参数

范围类型描述
其他地理点要比较的GeoPoint

返回:

布尔值

如果此GeoPoint等于提供的 GeoPoint,则为 true。

GeoPoint.toJSON()

返回此 GeoPoint 的 JSON 可序列化表示形式。

签名:

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

返回:

{ 纬度:数字;经度:数字; }