geojson.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // Type definitions for GeoJSON Format Specification
  2. // Project: http://geojson.org/
  3. // Definitions by: Jacob Bruun <https://github.com/cobster/>
  4. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
  5. declare namespace GeoJSON {
  6. /***
  7. * http://geojson.org/geojson-spec.html#geojson-objects
  8. */
  9. export interface GeoJsonObject
  10. {
  11. type: string;
  12. bbox?: number[];
  13. crs?: CoordinateReferenceSystem;
  14. }
  15. /***
  16. * http://geojson.org/geojson-spec.html#positions
  17. */
  18. export type Position = number[]
  19. /***
  20. * http://geojson.org/geojson-spec.html#geometry-objects
  21. */
  22. export interface GeometryObject extends GeoJsonObject
  23. {
  24. coordinates: any
  25. }
  26. /***
  27. * http://geojson.org/geojson-spec.html#point
  28. */
  29. export interface Point extends GeometryObject
  30. {
  31. type: 'Point'
  32. coordinates: Position
  33. }
  34. /***
  35. * http://geojson.org/geojson-spec.html#multipoint
  36. */
  37. export interface MultiPoint extends GeometryObject
  38. {
  39. type: 'MultiPoint'
  40. coordinates: Position[]
  41. }
  42. /***
  43. * http://geojson.org/geojson-spec.html#linestring
  44. */
  45. export interface LineString extends GeometryObject
  46. {
  47. type: 'LineString'
  48. coordinates: Position[]
  49. }
  50. /***
  51. * http://geojson.org/geojson-spec.html#multilinestring
  52. */
  53. export interface MultiLineString extends GeometryObject
  54. {
  55. type: 'MultiLineString'
  56. coordinates: Position[][]
  57. }
  58. /***
  59. * http://geojson.org/geojson-spec.html#polygon
  60. */
  61. export interface Polygon extends GeometryObject
  62. {
  63. type: 'Polygon'
  64. coordinates: Position[][]
  65. }
  66. /***
  67. * http://geojson.org/geojson-spec.html#multipolygon
  68. */
  69. export interface MultiPolygon extends GeometryObject
  70. {
  71. type: 'MultiPolygon'
  72. coordinates: Position[][][]
  73. }
  74. /***
  75. * http://geojson.org/geojson-spec.html#geometry-collection
  76. */
  77. export interface GeometryCollection extends GeoJsonObject
  78. {
  79. type: 'GeometryCollection'
  80. geometries: GeometryObject[];
  81. }
  82. /***
  83. * http://geojson.org/geojson-spec.html#feature-objects
  84. */
  85. export interface Feature<T extends GeometryObject> extends GeoJsonObject
  86. {
  87. type: 'Feature'
  88. geometry: T;
  89. properties: any;
  90. id?: string;
  91. }
  92. /***
  93. * http://geojson.org/geojson-spec.html#feature-collection-objects
  94. */
  95. export interface FeatureCollection<T extends GeometryObject> extends GeoJsonObject
  96. {
  97. type: 'FeatureCollection'
  98. features: Feature<T>[];
  99. }
  100. /***
  101. * http://geojson.org/geojson-spec.html#coordinate-reference-system-objects
  102. */
  103. export interface CoordinateReferenceSystem
  104. {
  105. type: string;
  106. properties: any;
  107. }
  108. export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem
  109. {
  110. properties: { name: string }
  111. }
  112. export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem
  113. {
  114. properties: { href: string; type: string }
  115. }
  116. }