UNPKG

ol-proj-ch

Version:
119 lines (118 loc) 3.66 kB
/** * GCJ02 Projection on basis of WGS84(EGPS:4326) * <p> * GCJ02 is not a projection strictly. In fact, it is a * confidential algorithm to offset real coordinate in China * * @author Ke Wang (wkgreat@outlook.com) * * </p> * */ import Projection from 'ol/proj/Projection'; import { Extent } from 'ol/extent'; /** * radius of WGS84 ellipsoid * @const * @type {number} * */ export declare const RADIUS: number; /** * extent of gcj02 * @const * @type {ol/Extent} * */ export declare const EXTENT: Extent; /** * coefficient between degree and radian * @const * @type {number} * */ export declare const METERS_PER_UNIT: number; /** * @classdesc * Projection object definition of GCJ02 * */ declare class GCJ02Projection extends Projection { /** * @constructor * @param {string} code of gcj02 * @param {string} opt_axisOrientation Axis orientation. * */ constructor(code: string, opt_axisOrientation?: string); } /** * default code of gcj02, used as identifier of gcj02 * @const * @type {string} * */ export declare const CODE: string; /** * all code of GCJ02Projection, 'GCJ02', 'GCJ:02' and 'ZH:MARS' * @const * @type {GCJ02Projection[]} * */ export declare const PROJECTIONS: GCJ02Projection[]; /** * transform coordinate from GCJ02 to EPSG:3857 * @function * @param {number[]} input input coordinate * @param {number[]} opt_output output coordinate * @param {number} opt_dimension dimension of coordinate * @return {number[]} tranformed coordinate * */ export declare function toEPSG3857(input: number[], opt_output: number[], opt_dimension: number): number[]; /** * transform coordinate from EPSG:3857 to GCJ02 * @function * @param {number[]} input input coordinate * @param {number[]} opt_output output coordinate * @param {number} opt_dimension dimension of coordinate * @return {number[]} tranformed coordinate * */ export declare function fromEPSG3857(input: number[], opt_output: number[], opt_dimension: number): number[]; /** * transform coordinate from GCJ02 to EPSG:4326 * @function * @param {number[]} input input coordinate * @param {number[]} opt_output output coordinate * @param {number} opt_dimension dimension of coordinate * @return {number[]} tranformed coordinate * */ export declare function toEPSG4326(input: number[], opt_output: number[], opt_dimension: number): number[]; /** * transform coordinate from EPSG:4326 to GCJ02 * @function * @param {number[]} input input coordinate * @param {number[]} opt_output output coordinate * @param {number} opt_dimension dimension of coordinate * @return {number[]} tranformed coordinate * */ export declare function fromEPSG4326(input: number[], opt_output: number[], opt_dimension: number): number[]; /** * transform coordinate from GCJ02 to EPSG:4326, this algorithm is more precise. * @function * @param {number[]} coord coordinate * @return {number[]} tranformed coordinate * */ export declare function gcj02WGSExactly(coord: number[]): number[]; /** * transform coordinate from EPSG:4326 to GCJ02 * @function * @param {number[]} coord coordinate * @return {number[]} tranformed coordinate * */ export declare function wgs2GCJ(coord: number[]): number[]; /** * transform coordinate from GCJ02 to EPSG:4326 * @function * @param {number[]} coord coordinate * @return {number[]} tranformed coordinate * */ export declare function gcj2WGS(coord: number[]): number[]; /** * whether a coordinate is nout of area of china * @param {number[]} coord the coordinate * @return {boolean} whether is out of china * */ export declare function outOfChina(coord: number[]): boolean; export {};