osm2geojson-lite 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ import { FeatureCollection, GeometryObject } from 'geojson';
2
+ interface IOptions {
3
+ completeFeature?: boolean;
4
+ allFeatures?: boolean;
5
+ renderTagged?: boolean;
6
+ excludeWay?: boolean;
7
+ suppressWay?: boolean;
8
+ }
9
+ declare function osm2geojson(osm: string | {
10
+ [k: string]: any;
11
+ }, opts?: IOptions): FeatureCollection<GeometryObject>;
12
+ export = osm2geojson;
@@ -0,0 +1,73 @@
1
+ import { Feature } from 'geojson';
2
+ import { RefElements } from './utils';
3
+ declare class OsmObject {
4
+ refCount: number;
5
+ protected refElems: RefElements;
6
+ private type;
7
+ private id;
8
+ private tags;
9
+ private props;
10
+ private hasTag;
11
+ constructor(type: string, id: string, refElems: RefElements);
12
+ addTags(tags: {
13
+ [k: string]: string;
14
+ }): void;
15
+ addTag(k: string, v: string): void;
16
+ addProp(k: string, v: any): void;
17
+ addProps(props: {
18
+ [k: string]: string;
19
+ }): void;
20
+ getCompositeId(): string;
21
+ getProps(): {
22
+ [k: string]: string;
23
+ };
24
+ toFeatureArray(): Array<Feature<any, any>>;
25
+ }
26
+ export declare class Node extends OsmObject {
27
+ private latLng;
28
+ constructor(id: string, refElems: RefElements);
29
+ setLatLng(latLng: {
30
+ lat: string;
31
+ lon: string;
32
+ }): void;
33
+ toFeatureArray(): Array<Feature<any, any>>;
34
+ getLatLng(): {
35
+ lat: string;
36
+ lon: string;
37
+ } | null;
38
+ }
39
+ export declare class Way extends OsmObject {
40
+ private latLngArray;
41
+ private isPolygon;
42
+ constructor(id: string, refElems: RefElements);
43
+ addLatLng(latLng: {
44
+ lat: string;
45
+ lon: string;
46
+ }): void;
47
+ setLatLngArray(latLngArray: Array<{
48
+ lat: string;
49
+ lon: string;
50
+ [k: string]: any;
51
+ }>): void;
52
+ addNodeRef(ref: string): void;
53
+ addTags(tags: {
54
+ [k: string]: string;
55
+ }): void;
56
+ addTag(k: string, v: string): void;
57
+ toCoordsArray(): string[][];
58
+ toFeatureArray(): Array<Feature<any, any>>;
59
+ private analyzeTag;
60
+ }
61
+ export declare class Relation extends OsmObject {
62
+ private relations;
63
+ private nodes;
64
+ private bounds;
65
+ [k: string]: any;
66
+ constructor(id: string, refElems: RefElements);
67
+ setBounds(bounds: any[]): void;
68
+ addMember(member: {
69
+ [k: string]: any;
70
+ }): void;
71
+ toFeatureArray(): Array<Feature<any, any>>;
72
+ }
73
+ export {};
@@ -0,0 +1,60 @@
1
+ import { Way } from './osmobjs';
2
+ export declare function purgeProps(obj: {
3
+ [k: string]: any;
4
+ }, blacklist: string[]): {
5
+ [k: string]: any;
6
+ };
7
+ export declare function mergeProps(obj1: {
8
+ [k: string]: any;
9
+ }, obj2: {
10
+ [k: string]: any;
11
+ }): {
12
+ [k: string]: any;
13
+ };
14
+ export declare function addPropToFeature(f: {
15
+ [k: string]: any;
16
+ }, k: string, v: any): void;
17
+ export declare function addPropToFeatures(fs: Array<{
18
+ [k: string]: any;
19
+ }>, k: string, v: any): void;
20
+ export declare const first: <T>(a: T[]) => T;
21
+ export declare const last: <T>(a: T[]) => T;
22
+ export declare const coordsToKey: <T>(a: T[]) => string;
23
+ export declare function addToMap<T>(m: {
24
+ [k: string]: T[];
25
+ }, k: string, v: T): void;
26
+ export declare function removeFromMap<T>(m: {
27
+ [k: string]: T[];
28
+ }, k: string, v: T): void;
29
+ export declare function getFirstFromMap<T>(m: {
30
+ [k: string]: T[];
31
+ }, k: string): T | null;
32
+ export declare const isRing: (a: number[][]) => boolean;
33
+ export declare const ringDirection: (a: number[][], xIdx?: number, yIdx?: number) => string;
34
+ export declare const ptInsidePolygon: (pt: number[], polygon: number[][], xIdx?: number, yIdx?: number) => boolean;
35
+ export declare const strToFloat: (el: any[] | string) => any;
36
+ export declare class LateBinder {
37
+ private container;
38
+ private valueFunc;
39
+ private ctx;
40
+ private args;
41
+ constructor(container: any[] | {
42
+ [k: string]: any;
43
+ }, valueFunc: (...args: any[]) => any, ctx: any, args: any[]);
44
+ bind(): void;
45
+ }
46
+ export declare class RefElements extends Map {
47
+ private binders;
48
+ constructor();
49
+ add(k: string, v: any): void;
50
+ addBinder(binder: LateBinder): void;
51
+ bindAll(): void;
52
+ }
53
+ export declare class WayCollection extends Array {
54
+ private firstMap;
55
+ private lastMap;
56
+ constructor();
57
+ addWay(way: Way): void;
58
+ toStrings(): number[][][];
59
+ toRings(direction: string): number[][][];
60
+ }
@@ -0,0 +1,32 @@
1
+ export default class {
2
+ private queryParent;
3
+ private progressive;
4
+ private parentMap;
5
+ private evtListeners;
6
+ constructor(opts: any);
7
+ parse(xml: string, parent?: any, dir?: string): any[];
8
+ getParent(node: any): any;
9
+ addListener(evt: string, func: (node: {
10
+ [k: string]: any;
11
+ }, parent?: {
12
+ [k: string]: any;
13
+ }) => void): void;
14
+ removeListener(evt: string, func: (node: {
15
+ [k: string]: any;
16
+ }, parent?: {
17
+ [k: string]: any;
18
+ }) => void): void;
19
+ on(evt: string, func: (node: {
20
+ [k: string]: any;
21
+ }, parent?: {
22
+ [k: string]: any;
23
+ }) => void): void;
24
+ off(evt: string, func: (node: {
25
+ [k: string]: any;
26
+ }, parent?: {
27
+ [k: string]: any;
28
+ }) => void): void;
29
+ private $addListener;
30
+ private $removeListener;
31
+ private emit;
32
+ }
package/package.json CHANGED
@@ -59,7 +59,7 @@
59
59
  "optionalDependencies": {
60
60
  "@types/geojson": "^7946.0.16"
61
61
  },
62
- "version": "1.0.2",
62
+ "version": "1.0.3",
63
63
  "directories": {
64
64
  "lib": "lib",
65
65
  "test": "test"
@@ -70,6 +70,7 @@
70
70
  },
71
71
  "files": [
72
72
  "dist/**/*.js",
73
+ "dist/**/*.ts",
73
74
  "dist/**/*.json"
74
75
  ]
75
76
  }