1.1.0 • Published 12 months ago

@geosdi/ngx-geocoding v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

NgxGeocoding

This library was generated with Angular CLI version 13.0.0.

General information

Component to get a list of place with a geocoding service using nominatim of openstreet map

Installation

npm i @geosdi/ngx-geocoding --save

It depends on :

"@angular/common": ">=13.0.0",
"@angular/core": ">=13.0.0",
"typescript": ">=4.4.4",
"rxjs": ">=7.0.0"

Usage

import { Injectable } from '@angular/core'; 
import {NgxGeocodingService} from "./ngx-geocoding.service"; import {GeocodingLocation} from "./geocoding-location.model"; 

@Injectable({
 providedIn: 'root'
})
export class Service {


   constructor(private geocodingService: NgxGeocodingService,) {
   }

  public addPlugin() {
    this.geocodingService.geocode(addressToSearch).subscribe((res: GeocodingLocation[]) => {
       alert(JSON.stringify(res));
     });
   }

}

Methods

Methodaction
geocode(address: string): Observable<GeocodingLocation[]>list of GeocodingLocation

Events

Methodaction
subjectNoResultssubscribe to notify if research is empty
subjectLocationsubject to notify location
subjectRemovesubject to notify remove location