Last active
April 16, 2018 21:11
-
-
Save icholy/2b589a53c7b8c11544a57487e1e66bdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Type definitions for GeoJSON Format Specification | |
// Project: http://geojson.org/ | |
// Definitions by: Jacob Bruun <https://github.com/cobster/> | |
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | |
export as namespace GeoJSON; | |
/** | |
* http://geojson.org/geojson-spec.html#geojson-objects | |
*/ | |
export type Object = Feature | FeatureCollection | Geometry; | |
/** | |
* http://geojson.org/geojson-spec.html#positions | |
*/ | |
export type Position = number[]; | |
/** | |
* http://geojson.org/geojson-spec.html#geometry-objects | |
*/ | |
export type Geometry = Point | MultiPoint | LineString | MultiLineString | MultiPolygon | GeometryCollection; | |
/** | |
* http://geojson.org/geojson-spec.html#point | |
*/ | |
export interface Point { | |
type: 'Point'; | |
coordinates: Position; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#multipoint | |
*/ | |
export interface MultiPoint { | |
type: 'MultiPoint'; | |
coordinates: Position[]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#linestring | |
*/ | |
export interface LineString { | |
type: 'LineString'; | |
coordinates: Position[]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#multilinestring | |
*/ | |
export interface MultiLineString { | |
type: 'MultiLineString'; | |
coordinates: Position[][]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#polygon | |
*/ | |
export interface Polygon { | |
type: 'Polygon'; | |
coordinates: Position[][]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#multipolygon | |
*/ | |
export interface MultiPolygon { | |
type: 'MultiPolygon'; | |
coordinates: Position[][][]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#geometry-collection | |
*/ | |
export interface GeometryCollection { | |
type: 'GeometryCollection'; | |
geometries: Geometry[]; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#feature-objects | |
*/ | |
export interface Feature<T extends Geometry = Geometry> { | |
type: 'Feature'; | |
geometry: T; | |
properties: any; | |
id?: string; | |
bbox?: number[]; | |
} | |
/** | |
* http://geojson.org/geojson-spec.html#feature-collection-objects | |
*/ | |
export interface FeatureCollection<T extends Geometry = Geometry> { | |
type: 'FeatureCollection'; | |
features: Feature<T>[]; | |
bbox?: number[]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment