ng2-haversine
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "ng2-haversine", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "An Angular 2 library to calculate the distance between a pair of coordinates using the Haversine formula.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -14,3 +14,3 @@ # ng2-haversine | ||
```bash | ||
$ npm instal ng2-haversine --save | ||
$ npm install ng2-haversine --save | ||
``` | ||
@@ -46,6 +46,7 @@ | ||
Then, use some of the provided functions in `HaversineService` to calcule the distance between two points: | ||
Then, use one of the provided functions in `HaversineService` to calcule the distance between two points: | ||
```typescript | ||
tryHaversine(): void { | ||
let madrid: GeoCoord = { | ||
@@ -55,2 +56,3 @@ latitude: 40.416775, | ||
}; | ||
let bilbao: GeoCoord = { | ||
@@ -60,5 +62,7 @@ latitude: 43.262985, | ||
}; | ||
let meters = this._haversineService.getDistanceInMeters(madrid, bilbao); | ||
let kilometers = this._haversineService.getDistanceInKilometers(madrid, bilbao); | ||
let miles = this._haversineService.getDistanceInMiles(madrid, bilbao); | ||
console.log(` | ||
@@ -73,5 +77,12 @@ The distance between Madrid and Bilbao is: | ||
As you have guessed: | ||
- `getDistanceInMeters(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in meters. | ||
- `getDistanceInKilometers(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in kilometers. | ||
- `getDistanceInMiles(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in miles. | ||
- `GeoCoord` is an interface with `latitude: number` and `longitude: number`. | ||
## Using SystemJS | ||
To load `ng2-haversine` using [SystemJS](https://github.com/systemjs/systemjs) is as simple as this. Open your `systemjs.config.js` file and set `map` and `packages` properties this way: | ||
To load `ng2-haversine` using [SystemJS](https://github.com/systemjs/systemjs) is as simple as this. Open your `systemjs.config.js` file and set `paths`, `map` and `packages` properties this way: | ||
@@ -81,2 +92,5 @@ ```javascript | ||
System.config({ | ||
paths: { | ||
"npm:": "node_modules/" | ||
}, | ||
map: { | ||
@@ -83,0 +97,0 @@ ... |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37958
110