diff --git a/src/control.ts b/src/control.ts index ce2f0fd8..3565f40d 100644 --- a/src/control.ts +++ b/src/control.ts @@ -1,6 +1,6 @@ import * as L from 'leaflet'; import { Nominatim } from './geocoders/index'; -import { GeocoderAPI, GeocodingResult } from './geocoders/api'; +import { IGeocoder, GeocodingResult } from './geocoders/api'; export interface GeocoderControlOptions extends L.ControlOptions { collapsed: boolean; @@ -8,7 +8,7 @@ export interface GeocoderControlOptions extends L.ControlOptions { placeholder: string; errorMessage: string; iconLabel: string; - geocoder?: GeocoderAPI; + geocoder?: IGeocoder; showUniqueResult: boolean; showResultIcons: boolean; suggestMinLength: number; diff --git a/src/geocoders/api.ts b/src/geocoders/api.ts index c96d2532..5413ea1e 100644 --- a/src/geocoders/api.ts +++ b/src/geocoders/api.ts @@ -18,7 +18,7 @@ export interface ReverseGeocodingResult extends GeocodingResult { export type GeocodingCallback = (result: GeocodingResult[]) => void; -export interface GeocoderAPI { +export interface IGeocoder { geocode(query: string, cb: GeocodingCallback, context?: any): void; suggest?(query: string, cb: GeocodingCallback, context?: any): void; reverse?( diff --git a/src/geocoders/arcgis.ts b/src/geocoders/arcgis.ts index 8b9fa962..ebee8b45 100644 --- a/src/geocoders/arcgis.ts +++ b/src/geocoders/arcgis.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -12,7 +12,7 @@ import { export interface ArcGisOptions extends GeocoderOptions {} -export class ArcGis implements GeocoderAPI { +export class ArcGis implements IGeocoder { options: ArcGisOptions = { serviceUrl: 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer', apiKey: '' diff --git a/src/geocoders/bing.ts b/src/geocoders/bing.ts index 7d69e713..dc981f61 100644 --- a/src/geocoders/bing.ts +++ b/src/geocoders/bing.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { jsonp } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface BingOptions extends GeocoderOptions {} -export class Bing implements GeocoderAPI { +export class Bing implements IGeocoder { options: BingOptions = { serviceUrl: 'https://dev.virtualearth.net/REST/v1/Locations' }; diff --git a/src/geocoders/google.ts b/src/geocoders/google.ts index ba39a981..13730a5e 100644 --- a/src/geocoders/google.ts +++ b/src/geocoders/google.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface GoogleOptions extends GeocoderOptions {} -export class Google implements GeocoderAPI { +export class Google implements IGeocoder { options: GoogleOptions = { serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json' }; diff --git a/src/geocoders/here.ts b/src/geocoders/here.ts index fdc78f6d..986ad448 100755 --- a/src/geocoders/here.ts +++ b/src/geocoders/here.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -15,7 +15,7 @@ export interface HereOptions extends GeocoderOptions { reverseGeocodeProxRadius: null; } -export class HERE implements GeocoderAPI { +export class HERE implements IGeocoder { options: HereOptions = { serviceUrl: 'https://geocoder.api.here.com/6.2/', app_id: '', diff --git a/src/geocoders/latlng.ts b/src/geocoders/latlng.ts index c345f459..8192b730 100644 --- a/src/geocoders/latlng.ts +++ b/src/geocoders/latlng.ts @@ -1,11 +1,11 @@ import * as L from 'leaflet'; -import { GeocoderAPI, GeocodingCallback, GeocodingResult } from './api'; +import { IGeocoder, GeocodingCallback, GeocodingResult } from './api'; export interface LatLngOptions { /** * The next geocoder to use */ - next?: GeocoderAPI; + next?: IGeocoder; sizeInMeters: number; } @@ -75,7 +75,7 @@ export function parseLatLng(query: string): L.LatLng | undefined { } } -export class LatLng implements GeocoderAPI { +export class LatLng implements IGeocoder { options: LatLngOptions = { next: undefined, sizeInMeters: 10000 diff --git a/src/geocoders/mapbox.ts b/src/geocoders/mapbox.ts index 978cfc29..64da06eb 100644 --- a/src/geocoders/mapbox.ts +++ b/src/geocoders/mapbox.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface MapboxOptions extends GeocoderOptions {} -export class Mapbox implements GeocoderAPI { +export class Mapbox implements IGeocoder { options: MapboxOptions = { serviceUrl: 'https://api.mapbox.com/geocoding/v5/mapbox.places/' }; diff --git a/src/geocoders/mapquest.ts b/src/geocoders/mapquest.ts index 9e9f5abc..f56aeb2e 100644 --- a/src/geocoders/mapquest.ts +++ b/src/geocoders/mapquest.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface MapQuestOptions extends GeocoderOptions {} -export class MapQuest implements GeocoderAPI { +export class MapQuest implements IGeocoder { options: MapQuestOptions = { serviceUrl: 'https://www.mapquestapi.com/geocoding/v1' }; diff --git a/src/geocoders/neutrino.ts b/src/geocoders/neutrino.ts index 7dee4ef7..3ffcc6fe 100644 --- a/src/geocoders/neutrino.ts +++ b/src/geocoders/neutrino.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -13,7 +13,7 @@ export interface NeutrinoOptions extends GeocoderOptions { userId: string; } -export class Neutrino implements GeocoderAPI { +export class Neutrino implements IGeocoder { options: NeutrinoOptions = { userId: undefined, apiKey: undefined, diff --git a/src/geocoders/nominatim.ts b/src/geocoders/nominatim.ts index 51d8d0e3..6db0f9fc 100644 --- a/src/geocoders/nominatim.ts +++ b/src/geocoders/nominatim.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { template, getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -48,7 +48,7 @@ export interface NominatimOptions extends GeocoderOptions { htmlTemplate: (r: NominatimResult) => string; } -export class Nominatim implements GeocoderAPI { +export class Nominatim implements IGeocoder { options: NominatimOptions = { serviceUrl: 'https://nominatim.openstreetmap.org/', htmlTemplate: function(r: NominatimResult) { diff --git a/src/geocoders/open-location-code.ts b/src/geocoders/open-location-code.ts index 54d173e7..6fb0a382 100644 --- a/src/geocoders/open-location-code.ts +++ b/src/geocoders/open-location-code.ts @@ -1,5 +1,5 @@ import * as L from 'leaflet'; -import { GeocoderAPI, GeocodingCallback, GeocodingResult } from './api'; +import { IGeocoder, GeocodingCallback, GeocodingResult } from './api'; export interface OpenLocationCodeOptions { OpenLocationCode: OpenLocationCodeApi; @@ -21,7 +21,7 @@ export interface CodeArea { codeLength: number; } -export class OpenLocationCode implements GeocoderAPI { +export class OpenLocationCode implements IGeocoder { options: OpenLocationCodeOptions; constructor(options?: Partial) { L.Util.setOptions(this, options); diff --git a/src/geocoders/opencage.ts b/src/geocoders/opencage.ts index a9224ee4..28d25fa7 100644 --- a/src/geocoders/opencage.ts +++ b/src/geocoders/opencage.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface OpenCageOptions extends GeocoderOptions {} -export class OpenCage implements GeocoderAPI { +export class OpenCage implements IGeocoder { options: OpenCageOptions = { serviceUrl: 'https://api.opencagedata.com/geocode/v1/json' }; diff --git a/src/geocoders/pelias.ts b/src/geocoders/pelias.ts index 3febead2..8a93d4e9 100644 --- a/src/geocoders/pelias.ts +++ b/src/geocoders/pelias.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface PeliasOptions extends GeocoderOptions {} -export class Pelias implements GeocoderAPI { +export class Pelias implements IGeocoder { options: PeliasOptions = { serviceUrl: 'https://api.geocode.earth/v1' }; diff --git a/src/geocoders/photon.ts b/src/geocoders/photon.ts index 7734b936..a2cb6ea0 100644 --- a/src/geocoders/photon.ts +++ b/src/geocoders/photon.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -15,7 +15,7 @@ export interface PhotonOptions extends GeocoderOptions { htmlTemplate?: (r: any) => string; } -export class Photon implements GeocoderAPI { +export class Photon implements IGeocoder { options: PhotonOptions = { serviceUrl: 'https://photon.komoot.io/api/', reverseUrl: 'https://photon.komoot.io/reverse/', diff --git a/src/geocoders/what3words.ts b/src/geocoders/what3words.ts index 33cfe328..fa8d7701 100644 --- a/src/geocoders/what3words.ts +++ b/src/geocoders/what3words.ts @@ -1,7 +1,7 @@ import * as L from 'leaflet'; import { getJSON } from '../util'; import { - GeocoderAPI, + IGeocoder, GeocoderOptions, GeocodingCallback, geocodingParams, @@ -11,7 +11,7 @@ import { export interface What3WordsOptions extends GeocoderOptions {} -export class What3Words implements GeocoderAPI { +export class What3Words implements IGeocoder { options: What3WordsOptions = { serviceUrl: 'https://api.what3words.com/v2/' };