空间位置相关方法集
- Description:
空间位置相关方法集
- Source:
- Description:
空间位置相关方法集
- Source:
Methods
(static) PosFromDegreeArray(positions) → {Array.<Cartesian3>}
- Description:
经纬度坐标数组转笛卡尔坐标数组
- Source:
Parameters:
Name | Type | Description |
---|---|---|
positions |
Array.<Array.<Number>> | 经纬度坐标数组,如:[[120,34],[121,35]] |
Returns:
笛卡尔坐标数组
- Type
- Array.<Cartesian3>
(static) PosOnTerrainFromDegree(terrain, position) → {Promise.<Cartesian3>}
- Description:
根据经纬度获取地表位置点
- Source:
Parameters:
Name | Type | Description |
---|---|---|
terrain |
Object | 当前场景地形对象 |
position |
Array.<Number> | 经纬度坐标,如[120,35] |
Returns:
异步返回:地表坐标点,笛卡尔坐标
- Type
- Promise.<Cartesian3>
(static) PosOnTerrainFromDegreeArray(terrain, points) → {Promise.<Array.<Cartesian3>>}
- Description:
根据经纬度数组获取地表位置点数组
- Source:
Parameters:
Name | Type | Description |
---|---|---|
terrain |
Object | 当前场景地形对象 |
points |
Array.<Array.<Number>> | 经纬度数组,如:[[120,34],[121,35]] |
Returns:
异步返回,地表点集合,笛卡尔坐标数组
- Type
- Promise.<Array.<Cartesian3>>
(static) calculateAngle(start, end) → {Number}
- Description:
二维状态下计算两点对于正北方向的朝向角度,范围[0,360]
- Source:
Parameters:
Name | Type | Description |
---|---|---|
start |
DegreePos | 起始点,经纬度点 |
end |
DegreePos | 目标点,经纬度点 |
Returns:
角度值
- Type
- Number
(static) changeHeight(pos, height) → {Cartesian3}
- Description:
调整点高度为指定高度,并返回更新后的笛卡尔坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pos |
Cartesian3 | 笛卡尔坐标 |
height |
Number | 高度值 |
Returns:
更新后的笛卡尔坐标
- Type
- Cartesian3
(static) convertBdLL2MC(lnglat) → {LngLat}
- Description:
百度BD09经纬度坐标转百度墨卡托坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 百度BD09经纬度坐标值 |
Returns:
转换后百度墨卡托坐标值
- Type
- LngLat
(static) convertBdMC2LL(lnglat) → {Lnglat}
- Description:
百度墨卡托坐标转百度经纬度坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 百度墨卡托坐标值 |
Returns:
- 转换后百度BD09经纬度坐标值
- Type
- Lnglat
(static) degreesToRadians(degrees) → {Number}
- Description:
角度转弧度
- Source:
Parameters:
Name | Type | Description |
---|---|---|
degrees |
Number | 角度值 |
Returns:
弧度值
- Type
- Number
(static) extentToDegrees(extent) → {Array.<Number>}
- Description:
弧度四至转经纬度四至
- Source:
Parameters:
Name | Type | Description |
---|---|---|
extent |
Array.<Number> | 弧度四至 |
Returns:
转换后的经纬度四至
- Type
- Array.<Number>
(static) extentToRadians(extent) → {Array.<Number>}
- Description:
经纬度四至转弧度四至
- Source:
Parameters:
Name | Type | Description |
---|---|---|
extent |
Array.<Number> | 经纬度四至,如:[112,23,120,30] |
Returns:
转换后的弧度四至
- Type
- Array.<Number>
(static) getCatesian3FromPX(viewer, px) → {Cartesian3|null}
- Description:
根据像素px值拾取位置点
- Source:
Parameters:
Name | Type | Description |
---|---|---|
viewer |
Object | 地图场景 |
px |
Cartesian2 | 屏幕坐标 |
Returns:
位置点笛卡尔坐标
- Type
- Cartesian3 | null
(static) getHeight(terrain, position) → {Promise.<Number>}
- Description:
获取指定经纬度点地表高度
- Source:
Parameters:
Name | Type | Description |
---|---|---|
terrain |
Object | 当前场景地形对象 |
position |
Array.<Number> | 经纬度坐标,如[120,35] |
Returns:
异步返回:当前点的地表高度值
- Type
- Promise.<Number>
(static) getHeightArray(terrain, points) → {Promise.<Array.<Number>>}
- Description:
获取经纬度点集高度
- Source:
Parameters:
Name | Type | Description |
---|---|---|
terrain |
Object | 当前场景地形对象 |
points |
Array.<Array.<Number>> | 经纬度坐标数组,如[[120,35],[121,36]] |
Returns:
异步返回:高度值数组
- Type
- Promise.<Array.<Number>>
(static) getPointByAngleDistance(lng, lat, angle, distance) → {DegreePos}
- Description:
已知点根据角度和距离求取另一点坐标(二维),注:WGS84坐标系
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lng |
Number | 经度X |
lat |
Number | 纬度Y |
angle |
Number | 角度 (0~360度) |
distance |
Number | 距离 (米) |
Returns:
目标点坐标
- Type
- DegreePos
(static) getPolygonCentroid(positions) → {Array.<Number>}
- Description:
计算多边形质点
- Source:
Parameters:
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 多边形节点,笛卡尔坐标集合 |
Returns:
多边形质点坐标值 => [x,y]
- Type
- Array.<Number>
(static) getRegionExtreme(vieweropt, positionsopt, numopt) → {Object}
- Description:
自动进行插值并计算获取区域内的极值点(最高点和最低点)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
viewer |
Object |
<optional> |
地图场景 |
|
positions |
Array.<Cartesian3> |
<optional> |
坐标点集合,笛卡尔坐标 |
|
num |
Number |
<optional> |
25
|
精度按照经纬度1°大约100公里,默认按25等分来计算 |
Returns:
最高和最低点的高度值和位置 => {minH:0,maxH:0,minPos:{x,y}, maxPos:{x,y}}
- Type
- Object
(static) interPoints(vieweropt, typeopt, positionsopt, objectsToExcludeopt) → {Array.<DegreePosZ>}
- Description:
线段插值点(地表)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
viewer |
Object |
<optional> |
地图场景 |
|
type |
String |
<optional> |
插值类型,project-投影点,高度为0;onground-地表点 |
|
positions |
Array.<Cartesian3> |
<optional> |
待插值点集合,笛卡尔坐标数组 |
|
objectsToExclude |
Array.<Object> |
<optional> |
null
|
高度采集时排除的对象集合 |
Returns:
经纬度点集合
- Type
- Array.<DegreePosZ>
(static) isVisible(position, cameraPosition)
- Description:
判断点在地球的正面还是反面
- Source:
Parameters:
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 点位,笛卡尔坐标 |
cameraPosition |
Cartesian3 | 相机位置,笛卡尔坐标 |
Returns:
true-正面,false-反面
(static) outOfChina(lng, lat) → {Boolean}
- Description:
判断点是否在国内
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lng |
Number | 经度值,WGS84坐标 |
lat |
Number | 纬度值,WGS84坐标 |
Returns:
判断结果,true-在国内,false-不在国内
- Type
- Boolean
(static) radiansToDegrees(radians) → {Number}
- Description:
弧度转换为角度
- Source:
Parameters:
Name | Type | Description |
---|---|---|
radians |
Number | 弧度值 |
Returns:
角度值
- Type
- Number
(static) scaleHeight(posopt, scaleopt, minopt) → {Cartesian3}
- Description:
按倍数调整笛卡尔坐标点的高度,并返回更新后的笛卡尔坐标
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos |
Cartesian3 |
<optional> |
笛卡尔坐标 |
|
scale |
Number |
<optional> |
高度放大倍数 |
|
min |
Number |
<optional> |
0
|
限定最小高度值,默认值为0,设置后,如果计算后的高度值小于min值,则高度直接取min值 |
Returns:
更新后的笛卡尔坐标
- Type
- Cartesian3
(static) subTriangle(positions, s) → {Array.<Array.<DegreePosZ>>}
- Description:
区域内生成三角网
- Source:
Parameters:
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 三角网生成的范围点集合,笛卡尔坐标 |
s |
Number | 精度,一般为 4/经度or纬度差 |
Returns:
三角网集合,WGS84坐标
- Type
- Array.<Array.<DegreePosZ>>
(static) transformBD2GCJ(lnglat) → {LngLat}
- Description:
百度BD09坐标转火星GCJ坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 百度BD09坐标 |
Returns:
转换后火星坐标系GCJ坐标值
- Type
- LngLat
(static) transformBD2WGS(lnglat) → {LngLat}
- Description:
百度经纬度坐标转WGS84
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 百度经纬度坐标值 |
Returns:
转换后WGS84坐标值
- Type
- LngLat
(static) transformCartesianArrayToWGS84Array(cartesianArr) → {Array.<DegreePosZ>}
- Description:
笛卡尔坐标点集合转WGS84点集合
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cartesianArr |
Array.<Cartesian3> | 笛卡尔坐标点集合 |
Returns:
WGS84坐标点集合
- Type
- Array.<DegreePosZ>
(static) transformCartesianToWGS84(cartesian3) → {DegreePosZ}
- Description:
笛卡尔坐标转WGS84
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cartesian3 |
Cartesian3 | 笛卡尔坐标 |
Returns:
WGS84坐标
- Type
- DegreePosZ
(static) transformGCJ2BD(lnglat) → {LngLat}
- Description:
火星坐标系GCJ坐标转百度BD09坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 火星坐标系GCJ坐标值 |
Returns:
转换后百度BD09坐标值
- Type
- LngLat
(static) transformGCJ2WGS(lnglat) → {LngLat}
- Description:
火星坐标系GCJ02转地球坐标系WGS84
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | 火星坐标系GCJ02坐标值 |
Returns:
转换后WGS84坐标值
- Type
- LngLat
(static) transformWGS2BD(lnglat) → {LngLat}
- Description:
地球坐标系(WGS-84)转百度经纬度坐标系(BDLL)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | WGS84坐标值 |
Returns:
百度经纬度坐标系坐标值
- Type
- LngLat
(static) transformWGS2GCJ(lnglat) → {LngLat}
- Description:
地球坐标系(WGS-84)转火星坐标系(GCJ)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lnglat |
LngLat | WGS84坐标值 |
Returns:
火星坐标系(GCJ)坐标值
- Type
- LngLat
(static) transformWGS84ToCartesian(position) → {Cartesian3}
- Description:
WGS84坐标转笛卡尔坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
position |
DegreePosZ | WGS84坐标 |
Returns:
笛卡尔坐标
- Type
- Cartesian3
(static) transformWGS84ToCartographic(position) → {Cartographic}
- Description:
WGS84坐标转弧度坐标
- Source:
Parameters:
Name | Type | Description |
---|---|---|
position |
DegreePosZ | WGS84坐标点 |
Returns:
弧度坐标点
- Type
- Cartographic