forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osmtogeojson.d.ts
96 lines (79 loc) · 2.63 KB
/
osmtogeojson.d.ts
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Type definitions for osmtogeojson 2.2.5
// Project: https://github.com/tyrasd/osmtogeojson.git
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "osmtogeojson" {
export interface OsmToGeoJSON {
(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject;
toGeojson(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject;
}
export interface Options {
verbose?: boolean;
/**
* If true, the resulting GeoJSON feature's properties will be a simple key-value list instead of a structured json object (with separate tags and metadata). default: false
*/
flatProperties?: boolean;
/**
* Either a blacklist of tag keys or a callback function. Will be used to decide if a feature is interesting enough for its own GeoJSON feature.
*/
uninterestingTags?: { [tag: string]: boolean; }|Function; //TODO: type function
/**
* Either a json object or callback function that is used to determine if a closed way should be treated as a Polygon or LineString.
*/
polygonFeatures?: any|Function; //TODO: type this
}
export namespace GeoJSON {
export interface GeoJSONObject {
type: string;
}
export interface Feature extends GeoJSONObject {
id?: string;
geometry: Geometry;
properties: any; //TODO: type this
}
export interface FeatureCollection extends GeoJSONObject {
features: Feature[];
}
export interface Geometry extends GeoJSONObject {
coordinates: Coordinate|Coordinate[]|Coordinate[][];
}
export interface GeometryCollection extends GeoJSONObject {
geometries: Geometry[];
}
export type Coordinate2d = [number, number];
export type Coordinate3d = [number, number, number];
export type Coordinate = Coordinate2d|Coordinate3d;
}
export namespace OsmJSON {
export interface OsmJSONObject {
elements: (Node|Way|Relationship)[];
}
export interface Element {
type: string;
id: number;
tags?: { [name: string]: string; }
timestamp?: string;
version?: number;
changeset?: number;
user?: string;
uid?: number;
}
export interface Node extends Element {
lat: number;
lon: number;
}
export interface Way extends Element {
nodes: number[];
}
export interface Relationship extends Element {
members: Member[];
}
export interface Member {
type: string;
ref: number;
role: string;
}
}
var osmtogeojson: OsmToGeoJSON;
export default osmtogeojson;
}