-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
geojson.js
39 lines (31 loc) · 1.3 KB
/
geojson.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
type GeoJSONPosition = [number, number] | [number, number, number];
type Geometry<T, C> = { type: T, coordinates: C }
declare type GeoJSONPoint = Geometry< 'Point', GeoJSONPosition>;
declare type GeoJSONMultiPoint = Geometry<'MultiPoint', Array<GeoJSONPosition>>;
declare type GeoJSONLineString = Geometry< 'LineString', Array<GeoJSONPosition>>;
declare type GeoJSONMultiLineString = Geometry<'MultiLineString', Array<Array<GeoJSONPosition>>>;
declare type GeoJSONPolygon = Geometry< 'Polygon', Array<Array<GeoJSONPosition>>>;
declare type GeoJSONMultiPolygon = Geometry<'MultiPolygon', Array<Array<Array<GeoJSONPosition>>>>;
declare type GeoJSONGeometry =
| GeoJSONPoint
| GeoJSONMultiPoint
| GeoJSONLineString
| GeoJSONMultiLineString
| GeoJSONPolygon
| GeoJSONMultiPolygon
| GeoJSONGeometryCollection;
declare type GeoJSONGeometryCollection = {
type: 'GeometryCollection',
geometries: Array<GeoJSONGeometry>
};
declare type GeoJSONFeature = {
type: 'Feature',
geometry: ?GeoJSONGeometry,
properties: {},
id?: number | string
};
declare type GeoJSONFeatureCollection = {
type: 'FeatureCollection',
features: Array<GeoJSONFeature>
};
declare type GeoJSON = GeoJSONGeometry | GeoJSONFeature | GeoJSONFeatureCollection;