Class: SpatialReference

SpatialReference

new SpatialReference(options)

base/geometry/SpatialReference.js, line 5

空间参考系对象,用于描述几何对象采用的坐标系与单位信息。

Name Type Default Description
options Object | String {} 可选

构造参数。支持 EPSG 字符串(如 EPSG:4326)或包含 wkid / wkt 的对象。

Name Type Description
wkid Number | undefined 可选

空间参考系的wkid

wkt String | undefined 可选

空间参考系Well Known Text 或 proj4js字符串,仅支持proj4js能够支持的字符串。OGC WKT标准https://www.ogc.org/standard/wkt-crs/, EPSG坐标系查询https://epsg.io/

unit String | undefined 可选

空间参考系单位

Example

创建空间参考系对象

// ES5引入方式
const { SpatialReference } = zondy

// ES6引入方式
import { SpatialReference } from "@mapgis/webclient-common"

const sr = new SpatialReference('EPSG:4326')

Members

一个便捷的WGS84对象,只有当类型为WGS84时才有

WebMercatorSpatialReference

一个便捷的Web墨卡托对象,只有当类型为Web墨卡托时才有

isCustmomWKTBoolean

是否是自定义WKT坐标系

isGeographicBoolean

是否是地理坐标系

isWGS84Boolean

是否是WGS84相关坐标系

isWebMercatorBoolean

是否是Web墨卡托坐标系

isWrappableBoolean

坐标系否支持环绕国际日期线,当参考系是Web Mercator或WGS84

unitString undefined

投影坐标系的描述

wkidNumber

投影坐标系的id

wktString undefined

投影坐标系的描述

Methods

clone(){Geometry}

base/geometry/SpatialReference.js, line 176

克隆几何对象

Returns:
Type Description
Geometry 克隆后的几何对象

equals(spatialReference){Boolean}

base/geometry/SpatialReference.js, line 219

判断坐标系对象的wkid和wkt的值是否相等

Name Type Description
spatialReference SpatialReference | Object

坐标系对象

Returns:
Type Description
Boolean wkid和wkt的值是否相等

toJSON(){Object}

base/geometry/SpatialReference.js, line 193

导出为 JSON 对象

Returns:
Type Description
Object JSON对象

SpatialReference.fromJSON(json)

base/geometry/SpatialReference.js, line 184

将JSON里的数据导入到几何中

Name Type Description
json Object

JSON对象