wkx.d.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /// <reference types="node" />
  2. declare module "wkx" {
  3. export class Geometry {
  4. srid: number;
  5. hasZ: boolean;
  6. hasM: boolean;
  7. static parse(value: string | Buffer): Geometry;
  8. static parseTwkb(value: Buffer): Geometry;
  9. static parseGeoJSON(value: {}): Geometry;
  10. toWkt(): string;
  11. toEwkt(): string;
  12. toWkb(): Buffer;
  13. toEwkb(): Buffer;
  14. toTwkb(): Buffer;
  15. toGeoJSON(options?: GeoJSONOptions): {};
  16. }
  17. export interface GeoJSONOptions {
  18. shortCrs?: boolean;
  19. longCrs?: boolean;
  20. }
  21. export class Point extends Geometry {
  22. x: number;
  23. y: number;
  24. z: number;
  25. m: number;
  26. constructor(x?: number, y?: number, z?: number, m?: number, srid?: number);
  27. static Z(x: number, y: number, z: number, srid?: number): Point;
  28. static M(x: number, y: number, m: number, srid?: number): Point;
  29. static ZM(x: number, y: number, z: number, m: number, srid?: number): Point;
  30. }
  31. export class LineString extends Geometry {
  32. points: Point[];
  33. constructor(points?: Point[], srid?: number);
  34. static Z(points?: Point[], srid?: number): LineString;
  35. static M(points?: Point[], srid?: number): LineString;
  36. static ZM(points?: Point[], srid?: number): LineString;
  37. }
  38. export class Polygon extends Geometry {
  39. exteriorRing: Point[];
  40. interiorRings: Point[][];
  41. constructor(exteriorRing?: Point[], interiorRings?: Point[][], srid?: number);
  42. static Z(exteriorRing?: Point[], interiorRings?: Point[][], srid?: number): Polygon;
  43. static M(exteriorRing?: Point[], interiorRings?: Point[][], srid?: number): Polygon;
  44. static ZM(exteriorRing?: Point[], interiorRings?: Point[][], srid?: number): Polygon;
  45. }
  46. export class MultiPoint extends Geometry {
  47. points: Point[];
  48. constructor(points?: Point[], srid?: number);
  49. static Z(points?: Point[], srid?: number): MultiPoint;
  50. static M(points?: Point[], srid?: number): MultiPoint;
  51. static ZM(points?: Point[], srid?: number): MultiPoint;
  52. }
  53. export class MultiLineString extends Geometry {
  54. lineStrings: LineString[];
  55. constructor(lineStrings?: LineString[], srid?: number);
  56. static Z(lineStrings?: LineString[], srid?: number): MultiLineString;
  57. static M(lineStrings?: LineString[], srid?: number): MultiLineString;
  58. static ZM(lineStrings?: LineString[], srid?: number): MultiLineString;
  59. }
  60. export class MultiPolygon extends Geometry {
  61. polygons: Polygon[];
  62. constructor(polygons?: Polygon[], srid?: number);
  63. static Z(polygons?: Polygon[], srid?: number): MultiPolygon;
  64. static M(polygons?: Polygon[], srid?: number): MultiPolygon;
  65. static ZM(polygons?: Polygon[], srid?: number): MultiPolygon;
  66. }
  67. export class GeometryCollection extends Geometry {
  68. geometries: Geometry[];
  69. constructor(geometries?: Geometry[], srid?: number);
  70. static Z(geometries?: Geometry[], srid?: number): GeometryCollection;
  71. static M(geometries?: Geometry[], srid?: number): GeometryCollection;
  72. static ZM(geometries?: Geometry[], srid?: number): GeometryCollection;
  73. }
  74. }