Merge pull request #4710 from Kern0/add-polyline

Create declaration file for Polyline
This commit is contained in:
Masahiro Wakame
2015-06-27 11:24:56 +09:00
2 changed files with 34 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="./polyline.d.ts" />
// returns an array of lat, lon pairs
polyline.decode('_p~iF~ps|U_ulLnnqC_mqNvxq`@');
// returns a string-encoded polyline
polyline.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]);
// returns a string-encoded polyline from a GeoJSON LineString
polyline.fromGeoJSON({ "type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[-120.2, 38.5], [-120.95, 40.7], [-126.453, 43.252]]
},
"properties": {}
});
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for Polyline 0.1.0
// Project: https://github.com/mapbox/polyline
// Definitions by: Arseniy Maximov <https://github.com/Kern0>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../geojson/geojson.d.ts" />
interface Polyline {
decode(string: string, precision?: number): number[][];
encode(coordinate: number[][], precision?: number): string;
fromGeoJSON(geojson: GeoJSON.GeoJsonObject, precision?: number): string;
}
declare var polyline: Polyline;
declare module "polyline" {
export = polyline;
}