Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yagajs/leaflet-ng2-gps

GPS Module including service and directive for leaflet-ng2
https://github.com/yagajs/leaflet-ng2-gps

angular2 geolocation gps leaflet spatial typescript yaga

Last synced: 5 days ago
JSON representation

GPS Module including service and directive for leaflet-ng2

Awesome Lists containing this project

README

        

# GPS Plugin for leaflet-ng2

This is a GPS service and directive for [YAGA's](https://yagajs.org) [leaflet-ng2](https://leaflet-ng2.yagajs.org).

## How to use

First install this module into your project with npm:

```bash
npm install --save @yaga/leaflet-ng2-gps
```

*Keep in mind that you have to add `@yaga/leaflet-ng2` as peer dependency*

Insert this module into your app module

```typescript
import { YagaModule } from '@yaga/leaflet-ng2';
import { GpsService, YagaGpsModule } from '@yaga/leaflet-ng2-gps';

// ...

@Component({
selector: 'app',
templateUrl: 'app.html',
})
export class AppComponent {
// ...
}

@NgModule({
bootstrap: [ AppComponent ],
declarations: [ AppComponent ],
imports: [ YagaGpsModule, YagaModule ],
})
export class AppModule {}

```

Use the `yaga-gps` directive in your template and use the Circle, CircleMarker or Marker directives within.
You can style the sub-directives like you with directly in the template. The `yaga-gps` directive take care about their
display state and position. In addition the radius of Circle directives gets set according to the GPS accuracy.

```html





This is your current position...




```

*Note: The radius of the CircleMarker directive will not be set by this directive (it makes no sense!)*