From ca5e1e108fbc1a10b5fa935bfc599ddc307eabfb Mon Sep 17 00:00:00 2001
From: Glenn Vorhes <gavorhes@wisc.edu>
Date: Sat, 12 May 2018 07:06:43 -0500
Subject: [PATCH] move api functions to webmapsjs

---
 dist/api/_axios.d.ts              |   9 ++
 dist/api/_axios.js                |  48 ++++++++
 dist/api/_axios.js.map            |   1 +
 dist/api/_host.d.ts               |   2 +
 dist/api/_host.js                 |   8 ++
 dist/api/_host.js.map             |   1 +
 dist/api/_npmrdsEmpty.d.ts        |  45 ++++++++
 dist/api/_npmrdsEmpty.js          |  26 +++++
 dist/api/_npmrdsEmpty.js.map      |   1 +
 dist/api/_npmrdsInterfaces.d.ts   | 102 +++++++++++++++++
 dist/api/_npmrdsInterfaces.js     |  14 +++
 dist/api/_npmrdsInterfaces.js.map |   1 +
 dist/api/npmrds.d.ts              |  22 ++++
 dist/api/npmrds.js                | 155 +++++++++++++++++++++++++
 dist/api/npmrds.js.map            |   1 +
 dist/api/stn.d.ts                 |  11 ++
 dist/api/stn.js                   |  52 +++++++++
 dist/api/stn.js.map               |   1 +
 package.json                      |   1 +
 src/api/_axios.ts                 |  49 ++++++++
 src/api/_host.ts                  |   8 ++
 src/api/_npmrdsEmpty.ts           |  28 +++++
 src/api/_npmrdsInterfaces.ts      | 124 ++++++++++++++++++++
 src/api/npmrds.ts                 | 183 ++++++++++++++++++++++++++++++
 src/api/stn.ts                    |  80 +++++++++++++
 25 files changed, 973 insertions(+)
 create mode 100644 dist/api/_axios.d.ts
 create mode 100644 dist/api/_axios.js
 create mode 100644 dist/api/_axios.js.map
 create mode 100644 dist/api/_host.d.ts
 create mode 100644 dist/api/_host.js
 create mode 100644 dist/api/_host.js.map
 create mode 100644 dist/api/_npmrdsEmpty.d.ts
 create mode 100644 dist/api/_npmrdsEmpty.js
 create mode 100644 dist/api/_npmrdsEmpty.js.map
 create mode 100644 dist/api/_npmrdsInterfaces.d.ts
 create mode 100644 dist/api/_npmrdsInterfaces.js
 create mode 100644 dist/api/_npmrdsInterfaces.js.map
 create mode 100644 dist/api/npmrds.d.ts
 create mode 100644 dist/api/npmrds.js
 create mode 100644 dist/api/npmrds.js.map
 create mode 100644 dist/api/stn.d.ts
 create mode 100644 dist/api/stn.js
 create mode 100644 dist/api/stn.js.map
 create mode 100644 src/api/_axios.ts
 create mode 100644 src/api/_host.ts
 create mode 100644 src/api/_npmrdsEmpty.ts
 create mode 100644 src/api/_npmrdsInterfaces.ts
 create mode 100644 src/api/npmrds.ts
 create mode 100644 src/api/stn.ts

diff --git a/dist/api/_axios.d.ts b/dist/api/_axios.d.ts
new file mode 100644
index 0000000..d0242aa
--- /dev/null
+++ b/dist/api/_axios.d.ts
@@ -0,0 +1,9 @@
+/**
+ *
+ * @param {string} endpoint
+ * @param {(d: Object) => any} callback
+ * @param {Object} params
+ * @param {(d: Object) => any} error
+ * @returns {any}
+ */
+export declare const get: (endpoint: string, callback: (d: Object) => any, params?: Object, error?: (d?: Object) => any) => any;
diff --git a/dist/api/_axios.js b/dist/api/_axios.js
new file mode 100644
index 0000000..c78f2e2
--- /dev/null
+++ b/dist/api/_axios.js
@@ -0,0 +1,48 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * Created by glenn on 7/6/2017.
+ */
+var axios_1 = require("axios");
+// export const CancelToken = axios.CancelToken;
+/**
+ *
+ * @param obj
+ * @param keyArr
+ * @param defaultVal
+ * @returns
+ */
+function getValue(obj, keyArr, defaultVal) {
+    if (defaultVal === void 0) { defaultVal = null; }
+    var k = keyArr.splice(0, 1)[0];
+    if (keyArr.length == 0) {
+        return typeof obj[k] === 'undefined' ? defaultVal : obj[k];
+    }
+    else {
+        if (typeof obj[k] === 'undefined') {
+            throw "key error: " + k + " " + obj.toString();
+        }
+        else {
+            return getValue(obj[k], keyArr);
+        }
+    }
+}
+/**
+ *
+ * @param {string} endpoint
+ * @param {(d: Object) => any} callback
+ * @param {Object} params
+ * @param {(d: Object) => any} error
+ * @returns {any}
+ */
+exports.get = function (endpoint, callback, params, error) {
+    if (params === void 0) { params = {}; }
+    if (error === void 0) { error = function () { }; }
+    axios_1.default.get(endpoint, { params: params }).then(function (response) {
+        var data = getValue(response, ['data'], null);
+        callback(data);
+    }).catch(function (reason) {
+        error(reason);
+    });
+};
+//# sourceMappingURL=_axios.js.map
\ No newline at end of file
diff --git a/dist/api/_axios.js.map b/dist/api/_axios.js.map
new file mode 100644
index 0000000..559a5c5
--- /dev/null
+++ b/dist/api/_axios.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_axios.js","sourceRoot":"","sources":["../../src/api/_axios.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,+BAA0B;AAE1B,gDAAgD;AAEhD;;;;;;GAMG;AACH,kBAAkB,GAAyB,EAAE,MAAgB,EAAE,UAAsB;IAAtB,2BAAA,EAAA,iBAAsB;IACjF,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/B,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,EAAE,CAAC,CAAC,OAAQ,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC;YACjC,MAAM,gBAAc,CAAC,SAAI,GAAG,CAAC,QAAQ,EAAI,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;AACL,CAAC;AAGD;;;;;;;GAOG;AACU,QAAA,GAAG,GAAG,UAAC,QAAgB,EACV,QAA4B,EAC5B,MAAmB,EACnB,KAAqC;IADrC,uBAAA,EAAA,WAAmB;IACnB,sBAAA,EAAA,sBAAoC,CAAC;IAC3D,eAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa;QAErD,IAAI,IAAI,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9C,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAC,MAAW;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["/**\r\n * Created by glenn on 7/6/2017.\r\n */\r\nimport axios from 'axios';\r\n\r\n// export const CancelToken = axios.CancelToken;\r\n\r\n/**\r\n *\r\n * @param obj\r\n * @param keyArr\r\n * @param defaultVal\r\n * @returns\r\n */\r\nfunction getValue(obj: { [s: string]: any }, keyArr: string[], defaultVal: any = null): any {\r\n    let k = keyArr.splice(0, 1)[0];\r\n\r\n    if (keyArr.length == 0) {\r\n        return typeof obj[k] === 'undefined' ? defaultVal : obj[k];\r\n    } else {\r\n        if (typeof  obj[k] === 'undefined') {\r\n            throw `key error: ${k} ${obj.toString()}`;\r\n        } else {\r\n            return getValue(obj[k], keyArr);\r\n        }\r\n    }\r\n}\r\n\r\n\r\n/**\r\n *\r\n * @param {string} endpoint\r\n * @param {(d: Object) => any} callback\r\n * @param {Object} params\r\n * @param {(d: Object) => any} error\r\n * @returns {any}\r\n */\r\nexport const get = (endpoint: string,\r\n                          callback: (d: Object) => any,\r\n                          params: Object = {},\r\n                          error: (d?: Object) => any = () => {}): any => {\r\n    axios.get(endpoint, {params: params}).then((response: any) => {\r\n\r\n        let data = getValue(response, ['data'], null);\r\n        callback(data);\r\n    }).catch((reason: any) => {\r\n        error(reason);\r\n    });\r\n};\r\n"]}
\ No newline at end of file
diff --git a/dist/api/_host.d.ts b/dist/api/_host.d.ts
new file mode 100644
index 0000000..058b21f
--- /dev/null
+++ b/dist/api/_host.d.ts
@@ -0,0 +1,2 @@
+export declare const stnApi: string;
+export declare const npmrdsApi: string;
diff --git a/dist/api/_host.js b/dist/api/_host.js
new file mode 100644
index 0000000..54a197c
--- /dev/null
+++ b/dist/api/_host.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var isLocal = window.location.href.indexOf('localhost') > -1;
+var stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';
+var apiEndpoint = isLocal ? 'http://localhost:8081/api' : "https://transportal.cee.wisc.edu/gis/" + stage_prod + "/api";
+exports.stnApi = apiEndpoint + '/stn';
+exports.npmrdsApi = apiEndpoint + '/npmrds';
+//# sourceMappingURL=_host.js.map
\ No newline at end of file
diff --git a/dist/api/_host.js.map b/dist/api/_host.js.map
new file mode 100644
index 0000000..b61ce48
--- /dev/null
+++ b/dist/api/_host.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_host.js","sourceRoot":"","sources":["../../src/api/_host.ts"],"names":[],"mappings":";;AAAA,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7D,IAAI,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,GAAG,SAAS,CAAC;AAEpG,IAAM,WAAW,GAAG,OAAO,GAAG,2BAA2B,GAAG,0CAAwC,UAAU,SAAM,CAAC;AAExG,QAAA,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAC9B,QAAA,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC","sourcesContent":["let isLocal = window.location.href.indexOf('localhost') > -1;\r\n\r\nlet stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';\r\n\r\nconst apiEndpoint = isLocal ? 'http://localhost:8081/api' : `https://transportal.cee.wisc.edu/gis/${stage_prod}/api`;\r\n\r\nexport const stnApi = apiEndpoint + '/stn';\r\nexport const npmrdsApi = apiEndpoint + '/npmrds';\r\n"]}
\ No newline at end of file
diff --git a/dist/api/_npmrdsEmpty.d.ts b/dist/api/_npmrdsEmpty.d.ts
new file mode 100644
index 0000000..806a598
--- /dev/null
+++ b/dist/api/_npmrdsEmpty.d.ts
@@ -0,0 +1,45 @@
+export declare const emptyGeometry: {
+    geom: {
+        crs: {
+            properties: {
+                name: string;
+            };
+            type: string;
+        };
+        type: string;
+        features: any[];
+    };
+    roads: any[];
+};
+export declare const emptyRoute: {
+    roads: any[];
+    line: {
+        crs: {
+            properties: {
+                name: string;
+            };
+            type: string;
+        };
+        type: string;
+        features: any[];
+    };
+    points: {
+        crs: {
+            properties: {
+                name: string;
+            };
+            type: string;
+        };
+        type: string;
+        features: any[];
+    };
+    totalDistance: number;
+    lengths: {};
+    speed: {
+        count: number;
+        dates: any[];
+        free: {};
+        values: {};
+        std: {};
+    };
+};
diff --git a/dist/api/_npmrdsEmpty.js b/dist/api/_npmrdsEmpty.js
new file mode 100644
index 0000000..8019808
--- /dev/null
+++ b/dist/api/_npmrdsEmpty.js
@@ -0,0 +1,26 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var emptyGeojson = {
+    crs: {
+        properties: { name: "urn:ogc:def:crs:OGC:1.3:CRS84" },
+        type: 'name'
+    },
+    type: "FeatureCollection",
+    features: []
+};
+exports.emptyGeometry = {
+    geom: emptyGeojson,
+    roads: []
+};
+exports.emptyRoute = {
+    roads: [],
+    line: emptyGeojson,
+    points: emptyGeojson,
+    totalDistance: -1,
+    lengths: {},
+    speed: { count: 0, dates: [], free: {}, values: {}, std: {} }
+};
+//# sourceMappingURL=_npmrdsEmpty.js.map
\ No newline at end of file
diff --git a/dist/api/_npmrdsEmpty.js.map b/dist/api/_npmrdsEmpty.js.map
new file mode 100644
index 0000000..54bb9ac
--- /dev/null
+++ b/dist/api/_npmrdsEmpty.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_npmrdsEmpty.js","sourceRoot":"","sources":["../../src/api/_npmrdsEmpty.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAGH,IAAI,YAAY,GAAG;IACf,GAAG,EAAE;QACD,UAAU,EAAE,EAAC,IAAI,EAAE,+BAA+B,EAAC;QACnD,IAAI,EAAE,MAAM;KACf;IACD,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,EAAE;CACf,CAAC;AAGW,QAAA,aAAa,GAAG;IACzB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,EAAE;CACZ,CAAC;AAEW,QAAA,UAAU,GAAG;IACtB,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAC;CAC9D,CAAC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\n\r\nlet emptyGeojson = {\r\n    crs: {\r\n        properties: {name: \"urn:ogc:def:crs:OGC:1.3:CRS84\"},\r\n        type: 'name'\r\n    },\r\n    type: \"FeatureCollection\",\r\n    features: []\r\n};\r\n\r\n\r\nexport const emptyGeometry = {\r\n    geom: emptyGeojson,\r\n    roads: []\r\n};\r\n\r\nexport const emptyRoute = {\r\n    roads: [],\r\n    line: emptyGeojson,\r\n    points: emptyGeojson,\r\n    totalDistance: -1,\r\n    lengths: {},\r\n    speed: {count: 0, dates: [], free: {}, values: {}, std: {}}\r\n};\r\n"]}
\ No newline at end of file
diff --git a/dist/api/_npmrdsInterfaces.d.ts b/dist/api/_npmrdsInterfaces.d.ts
new file mode 100644
index 0000000..7f5275c
--- /dev/null
+++ b/dist/api/_npmrdsInterfaces.d.ts
@@ -0,0 +1,102 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+export interface iRoad {
+    number: string;
+    direction: string;
+    tmcs: string[];
+}
+export interface iGetRoads {
+    roads: iRoad[];
+}
+export interface iExtent {
+    coordinates?: Array<number[]>;
+    bottom?: number;
+    top?: number;
+    left?: number;
+    right?: number;
+}
+export interface iRoad {
+    number: string;
+    direction: string;
+    tmcs: string[];
+}
+export interface iGeoJsonFeaturePointBase {
+    type: string;
+    properties: {
+        [s: string]: string | number | boolean;
+    };
+}
+export interface iGeoJsonFeaturePoint extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: number[];
+    };
+}
+export interface iGeoJsonFeatureLine extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: Array<number[]>;
+    };
+}
+export interface iGeoJsonFeaturePolygon extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: Array<Array<number[]>>;
+    };
+}
+export interface iGeoJsonBase {
+    type: string;
+    crs: {
+        properties: {
+            name: string;
+        };
+        type: string;
+    };
+}
+export interface iGeoJsonPoint extends iGeoJsonBase {
+    features: iGeoJsonFeaturePoint[];
+}
+export interface iGeoJsonLine extends iGeoJsonBase {
+    features: iGeoJsonFeatureLine[];
+}
+export interface iGeoJsonPolygon extends iGeoJsonBase {
+    features: iGeoJsonFeaturePolygon[];
+}
+export interface iSpeedVal {
+    date: string;
+    all: number;
+    pas: number;
+    frgt: number;
+}
+export interface iSpeed {
+    count: number;
+    dates: string[];
+    free: {
+        [s: string]: number;
+    };
+    std: {
+        [s: string]: number;
+    };
+    values: {
+        [s: string]: iSpeedVal[];
+    };
+}
+export interface iError {
+    error: string;
+}
+export interface iGeometry {
+    roads: iRoad[];
+    geom: iGeoJsonLine;
+    speed?: iSpeed;
+}
+export interface iRoute {
+    roads: iRoad[];
+    line: iGeoJsonLine;
+    points: iGeoJsonPoint;
+    totalDistance: number;
+    speed?: iSpeed;
+    lengths: {
+        [s: string]: number;
+    };
+}
diff --git a/dist/api/_npmrdsInterfaces.js b/dist/api/_npmrdsInterfaces.js
new file mode 100644
index 0000000..14b80ae
--- /dev/null
+++ b/dist/api/_npmrdsInterfaces.js
@@ -0,0 +1,14 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var emptyGeojson = {
+    crs: {
+        properties: { name: "urn:ogc:def:crs:OGC:1.3:CRS84" },
+        type: 'name'
+    },
+    type: "FeatureCollection",
+    features: []
+};
+//# sourceMappingURL=_npmrdsInterfaces.js.map
\ No newline at end of file
diff --git a/dist/api/_npmrdsInterfaces.js.map b/dist/api/_npmrdsInterfaces.js.map
new file mode 100644
index 0000000..1495ce5
--- /dev/null
+++ b/dist/api/_npmrdsInterfaces.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_npmrdsInterfaces.js","sourceRoot":"","sources":["../../src/api/_npmrdsInterfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAgHH,IAAI,YAAY,GAAG;IACf,GAAG,EAAE;QACD,UAAU,EAAE,EAAC,IAAI,EAAE,+BAA+B,EAAC;QACnD,IAAI,EAAE,MAAM;KACf;IACD,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,EAAE;CACf,CAAC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\n\r\nexport interface iRoad {\r\n    number: string;\r\n    direction: string;\r\n    tmcs: string[];\r\n}\r\n\r\nexport interface iGetRoads {\r\n    roads: iRoad[];\r\n}\r\n\r\nexport interface iExtent {\r\n    coordinates?: Array<number[]>;\r\n    bottom?: number;\r\n    top?: number;\r\n    left?: number;\r\n    right?: number;\r\n}\r\n\r\nexport interface iRoad {\r\n    number: string;\r\n    direction: string;\r\n    tmcs: string[];\r\n}\r\n\r\nexport interface iGeoJsonFeaturePointBase {\r\n    type: string;\r\n    properties: { [s: string]: string | number | boolean };\r\n\r\n}\r\n\r\n\r\nexport interface iGeoJsonFeaturePoint extends iGeoJsonFeaturePointBase {\r\n    geometry: {\r\n        type: string;\r\n        coordinates: number[]\r\n    }\r\n}\r\n\r\nexport interface iGeoJsonFeatureLine extends iGeoJsonFeaturePointBase {\r\n    geometry: {\r\n        type: string;\r\n        coordinates: Array<number[]>\r\n    }\r\n}\r\n\r\nexport interface iGeoJsonFeaturePolygon extends iGeoJsonFeaturePointBase {\r\n    geometry: {\r\n        type: string;\r\n        coordinates: Array<Array<number[]>>\r\n    }\r\n}\r\n\r\nexport interface iGeoJsonBase {\r\n    type: string;\r\n    crs: {\r\n        properties: { name: string }\r\n        type: string;\r\n    };\r\n\r\n}\r\n\r\nexport interface iGeoJsonPoint extends iGeoJsonBase {\r\n    features: iGeoJsonFeaturePoint[]\r\n}\r\n\r\nexport interface iGeoJsonLine extends iGeoJsonBase {\r\n    features: iGeoJsonFeatureLine[]\r\n}\r\n\r\nexport interface iGeoJsonPolygon extends iGeoJsonBase {\r\n    features: iGeoJsonFeaturePolygon[]\r\n}\r\n\r\n\r\nexport interface iSpeedVal {\r\n    date: string;\r\n    all: number;\r\n    pas: number;\r\n    frgt: number;\r\n}\r\n\r\n\r\nexport interface iSpeed {\r\n    count: number;\r\n    dates: string[];\r\n    free: { [s: string]: number };\r\n    std: { [s: string]: number };\r\n    values: { [s: string]: iSpeedVal[] };\r\n}\r\n\r\nexport interface iError {\r\n    error: string;\r\n}\r\n\r\nexport interface iGeometry{\r\n    roads: iRoad[];\r\n    geom: iGeoJsonLine;\r\n    speed?: iSpeed;\r\n}\r\n\r\nexport interface iRoute{\r\n    roads: iRoad[];\r\n    line: iGeoJsonLine;\r\n    points: iGeoJsonPoint;\r\n    totalDistance: number;\r\n    speed?: iSpeed;\r\n    lengths: {[s: string]: number}\r\n}\r\n\r\nlet emptyGeojson = {\r\n    crs: {\r\n        properties: {name: \"urn:ogc:def:crs:OGC:1.3:CRS84\"},\r\n        type: 'name'\r\n    },\r\n    type: \"FeatureCollection\",\r\n    features: []\r\n};\r\n\r\n\r\n"]}
\ No newline at end of file
diff --git a/dist/api/npmrds.d.ts b/dist/api/npmrds.d.ts
new file mode 100644
index 0000000..81120a9
--- /dev/null
+++ b/dist/api/npmrds.d.ts
@@ -0,0 +1,22 @@
+import { iExtent, iGetRoads, iError, iGeometry, iRoute } from './_npmrdsInterfaces';
+export declare function getRoads(extent: iExtent, version: number, callback: (d: iGetRoads) => any, error?: (e: iError) => any): void;
+export declare function getGeometry(extent: iExtent, version: number, callback: (d: iGeometry) => any, options?: {
+    roadDirection?: {
+        road: string;
+        direction: string;
+    };
+    startEnd?: {
+        start: string;
+        end: string;
+    };
+}, error?: (e: iError) => any): void;
+export declare function getRoute(road: string, direction: string, version: number, callback: (d: iRoute) => any, options?: {
+    extent?: iExtent;
+    startEnd?: {
+        start: string;
+        end: string;
+    };
+    version?: number;
+}, error?: (e: iError) => any): void;
+export declare function getTmcs(lon: number, lat: number, version: number, searchDist: number, callback: (d) => any, error?: (e: iError) => any): void;
+export declare function getTmc(tmc: string, version: number, callback: (d) => any, error?: (e: iError) => any): void;
diff --git a/dist/api/npmrds.js b/dist/api/npmrds.js
new file mode 100644
index 0000000..f201b0b
--- /dev/null
+++ b/dist/api/npmrds.js
@@ -0,0 +1,155 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ajx = require("./_axios");
+var empty = require("./_npmrdsEmpty");
+var _host_1 = require("./_host");
+function _abortHelper(x) {
+    if (x && x['abort']) {
+        x.abort();
+    }
+}
+function makeExtent(ext) {
+    if (!ext) {
+        return null;
+    }
+    if (ext.coordinates) {
+        if (ext.coordinates.length < 4) {
+            throw "npmrds api: coordinate array must have at least 3 vertices, last one closing";
+        }
+        return JSON.stringify(ext.coordinates);
+    }
+    else if (ext.bottom && ext.top && ext.left && ext.right) {
+        var bottom_left = [ext.left, ext.bottom];
+        var ext_arr = [bottom_left];
+        ext_arr.push([ext.left, ext.top]);
+        ext_arr.push([ext.right, ext.top]);
+        ext_arr.push([ext.right, ext.bottom]);
+        ext_arr.push(bottom_left);
+        return JSON.stringify(ext_arr);
+    }
+    else {
+        return undefined;
+    }
+}
+function getRoads(extent, version, callback, error) {
+    if (error === void 0) { error = function () {
+    }; }
+    var ext = makeExtent(extent);
+    if (ext == null) {
+        callback({ roads: [] });
+    }
+    else if (ext) {
+        var params = { extent: makeExtent(extent), version: version };
+        ajx.get(_host_1.npmrdsApi + '/roads', function (d) {
+            if (d.error) {
+                error(d);
+            }
+            else {
+                callback(d);
+            }
+        }, params, error);
+    }
+    else {
+        error({ error: "invalid extent" });
+    }
+}
+exports.getRoads = getRoads;
+function getGeometry(extent, version, callback, options, error) {
+    if (options === void 0) { options = {}; }
+    if (error === void 0) { error = function () {
+    }; }
+    var ext = makeExtent(extent);
+    if (ext == null) {
+        callback(empty.emptyGeometry);
+    }
+    else if (typeof ext == 'undefined') {
+        error({ error: "Invalid Extent" });
+    }
+    else {
+        var params = { extent: ext, version: version };
+        if (options.roadDirection) {
+            params['road'] = options.roadDirection.road;
+            params['direction'] = options.roadDirection.direction;
+        }
+        if (options.startEnd) {
+            params['start'] = options.startEnd.start;
+            params['end'] = options.startEnd.end;
+        }
+        ajx.get(_host_1.npmrdsApi + '/geometry', function (d) {
+            if (d.error) {
+                error(d);
+            }
+            else {
+                callback(d);
+            }
+        }, params, error);
+    }
+}
+exports.getGeometry = getGeometry;
+function getRoute(road, direction, version, callback, options, error) {
+    if (options === void 0) { options = {}; }
+    if (error === void 0) { error = function () {
+    }; }
+    var params = { road: road, direction: direction, version: version };
+    var ext;
+    if (options.extent) {
+        ext = makeExtent(options.extent);
+        if (ext == null) {
+            callback(empty.emptyRoute);
+            return;
+        }
+        else if (typeof ext == 'undefined') {
+            error({ error: "Invalid Extent" });
+            return;
+        }
+    }
+    if (ext) {
+        params['extent'] = ext;
+    }
+    if (options.startEnd) {
+        params['start'] = options.startEnd.start;
+        params['end'] = options.startEnd.end;
+    }
+    ajx.get(_host_1.npmrdsApi + '/route', function (d) {
+        if (d.error) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, params, error);
+}
+exports.getRoute = getRoute;
+function getTmcs(lon, lat, version, searchDist, callback, error) {
+    if (searchDist === void 0) { searchDist = 2000; }
+    if (error === void 0) { error = function () {
+    }; }
+    var params = { lon: lon, lat: lat, version: version, search: searchDist };
+    ajx.get(_host_1.npmrdsApi + '/tmcs', function (d) {
+        if (d.error) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, params, error);
+}
+exports.getTmcs = getTmcs;
+function getTmc(tmc, version, callback, error) {
+    if (error === void 0) { error = function () {
+    }; }
+    var params = { tmc: tmc, version: version };
+    ajx.get(_host_1.npmrdsApi + '/tmc', function (d) {
+        if (d.error) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, params, error);
+}
+exports.getTmc = getTmc;
+//# sourceMappingURL=npmrds.js.map
\ No newline at end of file
diff --git a/dist/api/npmrds.js.map b/dist/api/npmrds.js.map
new file mode 100644
index 0000000..40f4c9a
--- /dev/null
+++ b/dist/api/npmrds.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"npmrds.js","sourceRoot":"","sources":["../../src/api/npmrds.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAIH,8BAAgC;AAEhC,sCAAuC;AACvC,iCAAkC;AAMlC,sBAAsB,CAAiB;IACnC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED,oBAAoB,GAAY;IAC5B,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACP,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IAED,EAAE,CAAC,CAAC,GAAG,CA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CAAC,CAAE,CAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YACtB,KAAK,CAAC,CAAW,CAAC,CAAA;QACtB,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACL,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtB,CAAC;AAdD,0BAcC;AAGD,gBAAuB,GAAW,EAAE,OAAe,EAC3B,QAAoB,EACpB,KACC;IADD,sBAAA,EAAA;IACA,CAAC;IACrB,IAAI,MAAM,GAAG,EAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAC,CAAC;IAE1C,GAAG,CAAC,GAAG,CAAC,iBAAS,GAAG,MAAM,EAAE,UAAC,CAAqB;QAC9C,EAAE,CAAC,CAAE,CAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YACtB,KAAK,CAAC,CAAW,CAAC,CAAA;QACtB,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACL,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtB,CAAC;AAbD,wBAaC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\nimport $ = require('jquery');\r\nimport axios from 'axios';\r\nimport * as ajx from './_axios';\r\nimport {iExtent, iGetRoads, iError, iGeometry, iRoute} from './_npmrdsInterfaces';\r\nimport * as empty from './_npmrdsEmpty'\r\nimport {npmrdsApi} from './_host';\r\n\r\n\r\n\r\n\r\n\r\nfunction _abortHelper(x: XMLHttpRequest) {\r\n    if (x && x['abort']) {\r\n        x.abort();\r\n    }\r\n}\r\n\r\nfunction makeExtent(ext: iExtent): string {\r\n    if (!ext) {\r\n        return null;\r\n    }\r\n\r\n    if (ext.coordinates) {\r\n        if (ext.coordinates.length < 4) {\r\n            throw \"npmrds api: coordinate array must have at least 3 vertices, last one closing\";\r\n        }\r\n        return JSON.stringify(ext.coordinates);\r\n    } else if (ext.bottom && ext.top && ext.left && ext.right) {\r\n        let bottom_left = [ext.left, ext.bottom];\r\n        let ext_arr = [bottom_left];\r\n        ext_arr.push([ext.left, ext.top]);\r\n        ext_arr.push([ext.right, ext.top]);\r\n        ext_arr.push([ext.right, ext.bottom]);\r\n        ext_arr.push(bottom_left);\r\n        return JSON.stringify(ext_arr);\r\n    } else {\r\n        return undefined;\r\n    }\r\n}\r\n\r\n\r\nexport function getRoads(extent: iExtent,\r\n                         version: number,\r\n                         callback: (d: iGetRoads) => any,\r\n                         error: (e: iError) => any = () => {\r\n                         }) {\r\n\r\n    let ext = makeExtent(extent);\r\n\r\n    if (ext == null) {\r\n        callback({roads: []})\r\n    } else if (ext) {\r\n        let params = {extent: makeExtent(extent), version: version};\r\n        ajx.get(npmrdsApi + '/roads', (d: iGetRoads | iError) => {\r\n            if ((d as iError).error) {\r\n                error(d as iError)\r\n            } else {\r\n                callback(d as iGetRoads)\r\n            }\r\n\r\n        }, params, error);\r\n    } else {\r\n        error({error: \"invalid extent\"})\r\n    }\r\n}\r\n\r\n\r\nexport function getGeometry(extent: iExtent, version: number,\r\n                            callback: (d: iGeometry) => any,\r\n                            options: {\r\n                                roadDirection?: { road: string, direction: string },\r\n                                startEnd?: { start: string, end: string }\r\n                            } = {},\r\n                            error: (e: iError) => any = () => {\r\n                            }) {\r\n\r\n    let ext = makeExtent(extent);\r\n\r\n    if (ext == null) {\r\n        callback(empty.emptyGeometry);\r\n    } else if (typeof ext == 'undefined') {\r\n        error({error: \"Invalid Extent\"});\r\n    } else {\r\n        let params = {extent: ext, version: version};\r\n        if (options.roadDirection) {\r\n            params['road'] = options.roadDirection.road;\r\n            params['direction'] = options.roadDirection.direction;\r\n        }\r\n\r\n        if (options.startEnd) {\r\n            params['start'] = options.startEnd.start;\r\n            params['end'] = options.startEnd.end;\r\n        }\r\n\r\n        ajx.get(npmrdsApi + '/geometry', (d: iGeometry | iError) => {\r\n            if ((d as iError).error) {\r\n                error(d as iError)\r\n            } else {\r\n                callback(d as iGeometry)\r\n            }\r\n        }, params, error);\r\n    }\r\n}\r\n\r\nexport function getRoute(road: string, direction: string, version: number,\r\n                         callback: (d: iRoute) => any,\r\n                         options: {\r\n                             extent?: iExtent,\r\n                             startEnd?: { start: string, end: string },\r\n                             version?: number\r\n                         } = {},\r\n                         error: (e: iError) => any = () => {\r\n                         }) {\r\n\r\n    let params = {road: road, direction: direction, version: version};\r\n\r\n    let ext;\r\n\r\n    if (options.extent) {\r\n        ext = makeExtent(options.extent);\r\n\r\n        if (ext == null) {\r\n            callback(empty.emptyRoute);\r\n            return;\r\n        } else if (typeof ext == 'undefined') {\r\n            error({error: \"Invalid Extent\"});\r\n            return;\r\n        }\r\n    }\r\n\r\n    if (ext) {\r\n        params['extent'] = ext;\r\n    }\r\n\r\n    if (options.startEnd) {\r\n        params['start'] = options.startEnd.start;\r\n        params['end'] = options.startEnd.end;\r\n    }\r\n\r\n    ajx.get(npmrdsApi + '/route', (d: iRoute | iError) => {\r\n        if ((d as iError).error) {\r\n            error(d as iError)\r\n        } else {\r\n            callback(d as iRoute)\r\n        }\r\n    }, params, error);\r\n}\r\n\r\nexport function getTmcs(lon: number, lat: number, version: number, searchDist: number = 2000,\r\n                        callback: (d) => any,\r\n                        error: (e: iError) => any = () => {\r\n                        }) {\r\n\r\n    let params = {lon: lon, lat: lat, version: version, search: searchDist};\r\n\r\n    ajx.get(npmrdsApi + '/tmcs', (d: iGeometry | iError) => {\r\n        if ((d as iError).error) {\r\n            error(d as iError)\r\n        } else {\r\n            callback(d)\r\n        }\r\n    }, params, error);\r\n}\r\n\r\n\r\nexport function getTmc(tmc: string, version: number,\r\n                        callback: (d) => any,\r\n                        error: (e: iError) => any = () => {\r\n                        }) {\r\n    let params = {tmc: tmc, version: version};\r\n\r\n    ajx.get(npmrdsApi + '/tmc', (d: iGeometry | iError) => {\r\n        if ((d as iError).error) {\r\n            error(d as iError)\r\n        } else {\r\n            callback(d)\r\n        }\r\n    }, params, error);\r\n}\r\n"]}
\ No newline at end of file
diff --git a/dist/api/stn.d.ts b/dist/api/stn.d.ts
new file mode 100644
index 0000000..4e2f12d
--- /dev/null
+++ b/dist/api/stn.d.ts
@@ -0,0 +1,11 @@
+export interface iError {
+    error?: string;
+}
+export interface iRoutes extends iError {
+    routes: {
+        [s: string]: number;
+    };
+}
+export declare function getRoutes(yr: number, lon: number, lat: number, callback: (d: iRoutes) => any, error?: (e: iError) => any): void;
+export declare function getSnappedPoint(yr: number, routeId: number, lon: number, lat: number, callback: (d) => any, error?: (e: iError) => any): void;
+export declare function getStnSegment(yr: number, routeId: number, lonStart: number, latStart: number, lonEnd: number, latEnd: number, callback: (d) => any, error?: (e: iError) => any): void;
diff --git a/dist/api/stn.js b/dist/api/stn.js
new file mode 100644
index 0000000..ad95ce1
--- /dev/null
+++ b/dist/api/stn.js
@@ -0,0 +1,52 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ajx = require("./_axios");
+var _host_1 = require("./_host");
+function _abortHelper(x) {
+    if (x && x['abort']) {
+        x.abort();
+    }
+}
+function getRoutes(yr, lon, lat, callback, error) {
+    if (error === void 0) { error = function () {
+    }; }
+    ajx.get(_host_1.stnApi + '/routes', function (d) {
+        if (d.error) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, { year: yr, lon: lon, lat: lat }, error);
+}
+exports.getRoutes = getRoutes;
+function getSnappedPoint(yr, routeId, lon, lat, callback, error) {
+    if (error === void 0) { error = function () {
+    }; }
+    ajx.get(_host_1.stnApi + '/snapped', function (d) {
+        if (d['error']) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, { year: yr, route: routeId, lon: lon, lat: lat }, error);
+}
+exports.getSnappedPoint = getSnappedPoint;
+function getStnSegment(yr, routeId, lonStart, latStart, lonEnd, latEnd, callback, error) {
+    if (error === void 0) { error = function () {
+    }; }
+    ajx.get(_host_1.stnApi + '/segment', function (d) {
+        if (d['error']) {
+            error(d);
+        }
+        else {
+            callback(d);
+        }
+    }, { year: yr, route: routeId, lonStart: lonStart, latStart: latStart, lonEnd: lonEnd, latEnd: latEnd }, error);
+}
+exports.getStnSegment = getStnSegment;
+//# sourceMappingURL=stn.js.map
\ No newline at end of file
diff --git a/dist/api/stn.js.map b/dist/api/stn.js.map
new file mode 100644
index 0000000..f636744
--- /dev/null
+++ b/dist/api/stn.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"stn.js","sourceRoot":"","sources":["../../src/api/stn.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAGH,8BAAgC;AAChC,iCAA+B;AAG/B,sBAAsB,CAAiB;IACnC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAWD,mBAA0B,EAAU,EACX,GAAW,EACX,GAAW,EACX,QAA6B,EAC7B,KACC;IADD,sBAAA,EAAA;IACA,CAAC;IAEtB,GAAG,CAAC,GAAG,CAAC,cAAM,GAAG,SAAS,EAAE,UAAC,CAAU;QAC/B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACV,KAAK,CAAC,CAAC,CAAC,CAAA;QACZ,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IAEL,CAAC,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAC,EAAE,KAAK,CAAC,CAAC;AAElD,CAAC;AAhBD,8BAgBC;AAED,yBAAgC,EAAU,EACjB,OAAe,EACf,GAAW,EACX,GAAW,EACX,QAAoB,EACpB,KACC;IADD,sBAAA,EAAA;IACA,CAAC;IAEtB,GAAG,CAAC,GAAG,CAAC,cAAM,GAAG,UAAU,EAAE,UAAC,CAAC;QACvB,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,KAAK,CAAC,CAAC,CAAC,CAAA;QACZ,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IAEL,CAAC,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAC,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC;AAhBD,0CAgBC;AAED,uBAA8B,EAAU,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,MAAc,EACd,MAAc,EACd,QAAoB,EACpB,KACC;IADD,sBAAA,EAAA;IACA,CAAC;IAEtB,GAAG,CAAC,GAAG,CAAC,cAAM,GAAG,UAAU,EAAE,UAAC,CAAC;QACvB,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,KAAK,CAAC,CAAC,CAAC,CAAA;QACZ,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IAEL,CAAC,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,EAAE,KAAK,CAAC,CAAC;AAEtH,CAAC;AAnBD,sCAmBC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\nimport $ = require('jquery');\r\nimport * as ajx from './_axios';\r\nimport {stnApi} from './_host';\r\n\r\n\r\nfunction _abortHelper(x: XMLHttpRequest) {\r\n    if (x && x['abort']) {\r\n        x.abort();\r\n    }\r\n}\r\n\r\n\r\nexport interface iError {\r\n    error?: string;\r\n}\r\n\r\nexport interface iRoutes extends iError{\r\n    routes: {[s: string]: number}\r\n}\r\n\r\nexport function getRoutes(yr: number,\r\n                         lon: number,\r\n                         lat: number,\r\n                         callback: (d: iRoutes) => any,\r\n                         error: (e: iError) => any = () => {\r\n                         }) {\r\n\r\n    ajx.get(stnApi + '/routes', (d: iRoutes) => {\r\n            if (d.error) {\r\n                error(d)\r\n            } else {\r\n                callback(d)\r\n            }\r\n\r\n        }, {year: yr, lon: lon, lat: lat}, error);\r\n\r\n}\r\n\r\nexport function getSnappedPoint(yr: number,\r\n                         routeId: number,\r\n                         lon: number,\r\n                         lat: number,\r\n                         callback: (d) => any,\r\n                         error: (e: iError) => any = () => {\r\n                         }) {\r\n\r\n    ajx.get(stnApi + '/snapped', (d) => {\r\n            if (d['error']) {\r\n                error(d)\r\n            } else {\r\n                callback(d)\r\n            }\r\n\r\n        }, {year: yr, route: routeId, lon: lon, lat: lat}, error);\r\n}\r\n\r\nexport function getStnSegment(yr: number,\r\n                         routeId: number,\r\n                         lonStart: number,\r\n                         latStart: number,\r\n                         lonEnd: number,\r\n                         latEnd: number,\r\n                         callback: (d) => any,\r\n                         error: (e: iError) => any = () => {\r\n                         }) {\r\n\r\n    ajx.get(stnApi + '/segment', (d) => {\r\n            if (d['error']) {\r\n                error(d)\r\n            } else {\r\n                callback(d)\r\n            }\r\n\r\n        }, {year: yr, route: routeId, lonStart: lonStart, latStart: latStart, lonEnd: lonEnd, latEnd: latEnd}, error);\r\n\r\n}\r\n"]}
\ No newline at end of file
diff --git a/package.json b/package.json
index f1810de..8a22ce8 100644
--- a/package.json
+++ b/package.json
@@ -56,6 +56,7 @@
   },
   "dependencies": {
     "@types/es6-promise": "0.0.32",
+    "axios": "^0.15.3",
     "es6-promise": "^4.1.1",
     "react": "^15.6.1",
     "react-dom": "^15.6.1",
diff --git a/src/api/_axios.ts b/src/api/_axios.ts
new file mode 100644
index 0000000..731d82f
--- /dev/null
+++ b/src/api/_axios.ts
@@ -0,0 +1,49 @@
+/**
+ * Created by glenn on 7/6/2017.
+ */
+import axios from 'axios';
+
+// export const CancelToken = axios.CancelToken;
+
+/**
+ *
+ * @param obj
+ * @param keyArr
+ * @param defaultVal
+ * @returns
+ */
+function getValue(obj: { [s: string]: any }, keyArr: string[], defaultVal: any = null): any {
+    let k = keyArr.splice(0, 1)[0];
+
+    if (keyArr.length == 0) {
+        return typeof obj[k] === 'undefined' ? defaultVal : obj[k];
+    } else {
+        if (typeof  obj[k] === 'undefined') {
+            throw `key error: ${k} ${obj.toString()}`;
+        } else {
+            return getValue(obj[k], keyArr);
+        }
+    }
+}
+
+
+/**
+ *
+ * @param {string} endpoint
+ * @param {(d: Object) => any} callback
+ * @param {Object} params
+ * @param {(d: Object) => any} error
+ * @returns {any}
+ */
+export const get = (endpoint: string,
+                          callback: (d: Object) => any,
+                          params: Object = {},
+                          error: (d?: Object) => any = () => {}): any => {
+    axios.get(endpoint, {params: params}).then((response: any) => {
+
+        let data = getValue(response, ['data'], null);
+        callback(data);
+    }).catch((reason: any) => {
+        error(reason);
+    });
+};
diff --git a/src/api/_host.ts b/src/api/_host.ts
new file mode 100644
index 0000000..7e3e6ad
--- /dev/null
+++ b/src/api/_host.ts
@@ -0,0 +1,8 @@
+let isLocal = window.location.href.indexOf('localhost') > -1;
+
+let stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';
+
+const apiEndpoint = isLocal ? 'http://localhost:8081/api' : `https://transportal.cee.wisc.edu/gis/${stage_prod}/api`;
+
+export const stnApi = apiEndpoint + '/stn';
+export const npmrdsApi = apiEndpoint + '/npmrds';
diff --git a/src/api/_npmrdsEmpty.ts b/src/api/_npmrdsEmpty.ts
new file mode 100644
index 0000000..7e4c5a6
--- /dev/null
+++ b/src/api/_npmrdsEmpty.ts
@@ -0,0 +1,28 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+
+
+let emptyGeojson = {
+    crs: {
+        properties: {name: "urn:ogc:def:crs:OGC:1.3:CRS84"},
+        type: 'name'
+    },
+    type: "FeatureCollection",
+    features: []
+};
+
+
+export const emptyGeometry = {
+    geom: emptyGeojson,
+    roads: []
+};
+
+export const emptyRoute = {
+    roads: [],
+    line: emptyGeojson,
+    points: emptyGeojson,
+    totalDistance: -1,
+    lengths: {},
+    speed: {count: 0, dates: [], free: {}, values: {}, std: {}}
+};
diff --git a/src/api/_npmrdsInterfaces.ts b/src/api/_npmrdsInterfaces.ts
new file mode 100644
index 0000000..5b436d5
--- /dev/null
+++ b/src/api/_npmrdsInterfaces.ts
@@ -0,0 +1,124 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+
+
+export interface iRoad {
+    number: string;
+    direction: string;
+    tmcs: string[];
+}
+
+export interface iGetRoads {
+    roads: iRoad[];
+}
+
+export interface iExtent {
+    coordinates?: Array<number[]>;
+    bottom?: number;
+    top?: number;
+    left?: number;
+    right?: number;
+}
+
+export interface iRoad {
+    number: string;
+    direction: string;
+    tmcs: string[];
+}
+
+export interface iGeoJsonFeaturePointBase {
+    type: string;
+    properties: { [s: string]: string | number | boolean };
+
+}
+
+
+export interface iGeoJsonFeaturePoint extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: number[]
+    }
+}
+
+export interface iGeoJsonFeatureLine extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: Array<number[]>
+    }
+}
+
+export interface iGeoJsonFeaturePolygon extends iGeoJsonFeaturePointBase {
+    geometry: {
+        type: string;
+        coordinates: Array<Array<number[]>>
+    }
+}
+
+export interface iGeoJsonBase {
+    type: string;
+    crs: {
+        properties: { name: string }
+        type: string;
+    };
+
+}
+
+export interface iGeoJsonPoint extends iGeoJsonBase {
+    features: iGeoJsonFeaturePoint[]
+}
+
+export interface iGeoJsonLine extends iGeoJsonBase {
+    features: iGeoJsonFeatureLine[]
+}
+
+export interface iGeoJsonPolygon extends iGeoJsonBase {
+    features: iGeoJsonFeaturePolygon[]
+}
+
+
+export interface iSpeedVal {
+    date: string;
+    all: number;
+    pas: number;
+    frgt: number;
+}
+
+
+export interface iSpeed {
+    count: number;
+    dates: string[];
+    free: { [s: string]: number };
+    std: { [s: string]: number };
+    values: { [s: string]: iSpeedVal[] };
+}
+
+export interface iError {
+    error: string;
+}
+
+export interface iGeometry{
+    roads: iRoad[];
+    geom: iGeoJsonLine;
+    speed?: iSpeed;
+}
+
+export interface iRoute{
+    roads: iRoad[];
+    line: iGeoJsonLine;
+    points: iGeoJsonPoint;
+    totalDistance: number;
+    speed?: iSpeed;
+    lengths: {[s: string]: number}
+}
+
+let emptyGeojson = {
+    crs: {
+        properties: {name: "urn:ogc:def:crs:OGC:1.3:CRS84"},
+        type: 'name'
+    },
+    type: "FeatureCollection",
+    features: []
+};
+
+
diff --git a/src/api/npmrds.ts b/src/api/npmrds.ts
new file mode 100644
index 0000000..816399c
--- /dev/null
+++ b/src/api/npmrds.ts
@@ -0,0 +1,183 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+
+import $ = require('jquery');
+import axios from 'axios';
+import * as ajx from './_axios';
+import {iExtent, iGetRoads, iError, iGeometry, iRoute} from './_npmrdsInterfaces';
+import * as empty from './_npmrdsEmpty'
+import {npmrdsApi} from './_host';
+
+
+
+
+
+function _abortHelper(x: XMLHttpRequest) {
+    if (x && x['abort']) {
+        x.abort();
+    }
+}
+
+function makeExtent(ext: iExtent): string {
+    if (!ext) {
+        return null;
+    }
+
+    if (ext.coordinates) {
+        if (ext.coordinates.length < 4) {
+            throw "npmrds api: coordinate array must have at least 3 vertices, last one closing";
+        }
+        return JSON.stringify(ext.coordinates);
+    } else if (ext.bottom && ext.top && ext.left && ext.right) {
+        let bottom_left = [ext.left, ext.bottom];
+        let ext_arr = [bottom_left];
+        ext_arr.push([ext.left, ext.top]);
+        ext_arr.push([ext.right, ext.top]);
+        ext_arr.push([ext.right, ext.bottom]);
+        ext_arr.push(bottom_left);
+        return JSON.stringify(ext_arr);
+    } else {
+        return undefined;
+    }
+}
+
+
+export function getRoads(extent: iExtent,
+                         version: number,
+                         callback: (d: iGetRoads) => any,
+                         error: (e: iError) => any = () => {
+                         }) {
+
+    let ext = makeExtent(extent);
+
+    if (ext == null) {
+        callback({roads: []})
+    } else if (ext) {
+        let params = {extent: makeExtent(extent), version: version};
+        ajx.get(npmrdsApi + '/roads', (d: iGetRoads | iError) => {
+            if ((d as iError).error) {
+                error(d as iError)
+            } else {
+                callback(d as iGetRoads)
+            }
+
+        }, params, error);
+    } else {
+        error({error: "invalid extent"})
+    }
+}
+
+
+export function getGeometry(extent: iExtent, version: number,
+                            callback: (d: iGeometry) => any,
+                            options: {
+                                roadDirection?: { road: string, direction: string },
+                                startEnd?: { start: string, end: string }
+                            } = {},
+                            error: (e: iError) => any = () => {
+                            }) {
+
+    let ext = makeExtent(extent);
+
+    if (ext == null) {
+        callback(empty.emptyGeometry);
+    } else if (typeof ext == 'undefined') {
+        error({error: "Invalid Extent"});
+    } else {
+        let params = {extent: ext, version: version};
+        if (options.roadDirection) {
+            params['road'] = options.roadDirection.road;
+            params['direction'] = options.roadDirection.direction;
+        }
+
+        if (options.startEnd) {
+            params['start'] = options.startEnd.start;
+            params['end'] = options.startEnd.end;
+        }
+
+        ajx.get(npmrdsApi + '/geometry', (d: iGeometry | iError) => {
+            if ((d as iError).error) {
+                error(d as iError)
+            } else {
+                callback(d as iGeometry)
+            }
+        }, params, error);
+    }
+}
+
+export function getRoute(road: string, direction: string, version: number,
+                         callback: (d: iRoute) => any,
+                         options: {
+                             extent?: iExtent,
+                             startEnd?: { start: string, end: string },
+                             version?: number
+                         } = {},
+                         error: (e: iError) => any = () => {
+                         }) {
+
+    let params = {road: road, direction: direction, version: version};
+
+    let ext;
+
+    if (options.extent) {
+        ext = makeExtent(options.extent);
+
+        if (ext == null) {
+            callback(empty.emptyRoute);
+            return;
+        } else if (typeof ext == 'undefined') {
+            error({error: "Invalid Extent"});
+            return;
+        }
+    }
+
+    if (ext) {
+        params['extent'] = ext;
+    }
+
+    if (options.startEnd) {
+        params['start'] = options.startEnd.start;
+        params['end'] = options.startEnd.end;
+    }
+
+    ajx.get(npmrdsApi + '/route', (d: iRoute | iError) => {
+        if ((d as iError).error) {
+            error(d as iError)
+        } else {
+            callback(d as iRoute)
+        }
+    }, params, error);
+}
+
+export function getTmcs(lon: number, lat: number, version: number, searchDist: number = 2000,
+                        callback: (d) => any,
+                        error: (e: iError) => any = () => {
+                        }) {
+
+    let params = {lon: lon, lat: lat, version: version, search: searchDist};
+
+    ajx.get(npmrdsApi + '/tmcs', (d: iGeometry | iError) => {
+        if ((d as iError).error) {
+            error(d as iError)
+        } else {
+            callback(d)
+        }
+    }, params, error);
+}
+
+
+export function getTmc(tmc: string, version: number,
+                        callback: (d) => any,
+                        error: (e: iError) => any = () => {
+                        }) {
+    let params = {tmc: tmc, version: version};
+
+    ajx.get(npmrdsApi + '/tmc', (d: iGeometry | iError) => {
+        if ((d as iError).error) {
+            error(d as iError)
+        } else {
+            callback(d)
+        }
+    }, params, error);
+}
diff --git a/src/api/stn.ts b/src/api/stn.ts
new file mode 100644
index 0000000..979a540
--- /dev/null
+++ b/src/api/stn.ts
@@ -0,0 +1,80 @@
+/**
+ * Created by glenn on 6/13/2017.
+ */
+
+import $ = require('jquery');
+import * as ajx from './_axios';
+import {stnApi} from './_host';
+
+
+function _abortHelper(x: XMLHttpRequest) {
+    if (x && x['abort']) {
+        x.abort();
+    }
+}
+
+
+export interface iError {
+    error?: string;
+}
+
+export interface iRoutes extends iError{
+    routes: {[s: string]: number}
+}
+
+export function getRoutes(yr: number,
+                         lon: number,
+                         lat: number,
+                         callback: (d: iRoutes) => any,
+                         error: (e: iError) => any = () => {
+                         }) {
+
+    ajx.get(stnApi + '/routes', (d: iRoutes) => {
+            if (d.error) {
+                error(d)
+            } else {
+                callback(d)
+            }
+
+        }, {year: yr, lon: lon, lat: lat}, error);
+
+}
+
+export function getSnappedPoint(yr: number,
+                         routeId: number,
+                         lon: number,
+                         lat: number,
+                         callback: (d) => any,
+                         error: (e: iError) => any = () => {
+                         }) {
+
+    ajx.get(stnApi + '/snapped', (d) => {
+            if (d['error']) {
+                error(d)
+            } else {
+                callback(d)
+            }
+
+        }, {year: yr, route: routeId, lon: lon, lat: lat}, error);
+}
+
+export function getStnSegment(yr: number,
+                         routeId: number,
+                         lonStart: number,
+                         latStart: number,
+                         lonEnd: number,
+                         latEnd: number,
+                         callback: (d) => any,
+                         error: (e: iError) => any = () => {
+                         }) {
+
+    ajx.get(stnApi + '/segment', (d) => {
+            if (d['error']) {
+                error(d)
+            } else {
+                callback(d)
+            }
+
+        }, {year: yr, route: routeId, lonStart: lonStart, latStart: latStart, lonEnd: lonEnd, latEnd: latEnd}, error);
+
+}
-- 
GitLab