1. CoordTransform
1.1.1. 初始化 new CoordTransform()
坐标转换类。常用坐标系的转换,包括WGS84(地理坐标,EPSG:4326,经纬度)与WebMercator(投影坐标,EPSG:3857)、百度坐标系(BD-09)、火星坐标系(GCJ-02)的相互转换。 WebMercator投影坐标系(EPSG:3857):Google Maps、Bing Maps、OSM和大部分的ArcGIS Online使用的地图投影,WebMercator使用的是球形(而不是椭球)参数方程。 WGS84:国际标准,Google、Bing、OSM、GPS坐标系; GCJ-02:国测局坐标系,高德地图、腾讯地图坐标系; BD-09:百度地图坐标系,在GCJ-02的基础上进行了二次加密。
Example
var transform = new BOSGeo.CoordTransform();
1.2. 方法
1.2.1. CoordTransform.wgs84TowebMercator(lon, lat) ⇒ Array.<Number>
WGS84地理坐标转WebMercator投影坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回WebMercator投影坐标数组(单位为米)
Param | Type | Description |
---|---|---|
lon | Number |
经度(单位为度) |
lat | Number |
纬度(单位为度) |
Example
BOSGeo.CoordTransform.wgs84TowebMercator(114.397433, 22.909235)
1.2.2. CoordTransform.wgs84TowebMercatorBB(bb) ⇒ Object
WGS84地理坐标包围盒转WebMercator投影坐标包围盒
Kind : static method of CoordTransform
Returns : Object
-
返回WebMercator包围盒对象,形如 {north, east, south, west}(单位为米)
Param | Type | Description |
---|---|---|
bb | Object |
WGS84包围盒对象,形如 {north, east, south, west}(单位为度) |
Example
BOSGeo.CoordTransform.wgs84TowebMercatorBB({north: 22.909235, east: 113.397433, south: 21.909235, west: 114.397433})
1.2.3. CoordTransform.webMercatorToWgs84(x, y) ⇒ Array.<Number>
WebMercator投影坐标转WGS84地理坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回WGS84坐标数组(单位为度)
Param | Type | Description |
---|---|---|
x | Number |
经度(单位为米) |
y | Number |
纬度(单位为米) |
Example
BOSGeo.CoordTransform.webMercatorToWgs84(12734663.99, 2621045.83)
1.2.4. CoordTransform.webMercatorToWgs84BB(bb) ⇒ Object
WebMercator投影坐标包围盒转WGS84地理坐标包围盒
Kind : static method of CoordTransform
Returns : Object
-
返回WGS84包围盒对象,形如 {north, east, south, west}(单位为度)
Param | Type | Description |
---|---|---|
bb | Object |
WebMercator包围盒对象,形如 {north, east, south, west}(单位为米) |
Example
BOSGeo.CoordTransform.webMercatorToWgs84BB({north: 2621045, east: 12623344, south: 2500631, west: 12734663})
1.2.5. CoordTransform.wgs84togcj02(lng, lat) ⇒ Array.<Number>
WGS84坐标转GCj02坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回GCJ02坐标数组
Param | Type | Description |
---|---|---|
lng | Number |
经度 |
lat | Number |
纬度 |
Example
BOSGeo.CoordTransform.wgs84togcj02(114.397433, 22.909235)
1.2.6. CoordTransform.gcj02towgs84(lng, lat) ⇒ Array.<Number>
GCJ02坐标转WGS84坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回WGS84坐标数组
Param | Type | Description |
---|---|---|
lng | Number |
经度 |
lat | Number |
纬度 |
Example
BOSGeo.CoordTransform.gcj02towgs84(114.397433, 22.909235)
1.2.7. CoordTransform.gcj02tobd09(lng, lat) ⇒ Array.<Number>
火星坐标转百度坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回百度坐标数组
Param | Type | Description |
---|---|---|
lng | Number |
火星坐标经度 |
lat | Number |
火星坐标纬度 |
Example
BOSGeo.CoordTransform.gcj02tobd09(114.397433, 22.909235)
1.2.8. CoordTransform.bd09togcj02(bd_lon, bd_lat) ⇒ Array.<Number>
百度坐标转火星坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回火星坐标数组
Param | Type | Description |
---|---|---|
bd_lon | Number |
百度经度 |
bd_lat | Number |
百度纬度 |
Example
BOSGeo.CoordTransform.bd09togcj02(114.397433, 22.909235)
1.2.9. CoordTransform.wgs84tobd09(lng, lat) ⇒ Array.<Number>
WGS84坐标转百度坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回百度坐标数组
Param | Type | Description |
---|---|---|
lng | Number |
经度 |
lat | Number |
纬度 |
Example
BOSGeo.CoordTransform.wgs84tobd09(114.397433, 22.909235)
1.2.10. CoordTransform.bd09towgs84(lng, lat) ⇒ Array.<Number>
百度坐标转WGS84坐标
Kind : static method of CoordTransform
Returns : Array.<Number>
-
返回WGS84坐标数组
Param | Type | Description |
---|---|---|
lng | Number |
经度 |
lat | Number |
纬度 |
Example
BOSGeo.CoordTransform.bd09towgs84(114.397433, 22.909235)