UNPKG

universal-geocoder

Version:

Universal geocoding abstraction server-side and client-side with multiple built-in providers

71 lines 3.31 kB
import { ExternalLoaderBody, ExternalLoaderHeaders, ExternalLoaderInterface, ExternalLoaderParams } from "../../ExternalLoader"; import { ErrorCallback, GeocodedResultsCallback, MapQuestGeocoded, MapQuestGeocodeQuery, MapQuestGeocodeQueryObject, ProviderInterface, ProviderOptionsInterface } from "./.."; import { ReverseQuery, ReverseQueryObject } from "../../query"; export interface MapQuestCoordinates { lat: number; lng: number; } export interface MapQuestResult { latLng: MapQuestCoordinates; displayLatLng: MapQuestCoordinates; street: string; sideOfStreet: string; adminArea1?: string; adminArea1Type?: string; adminArea3?: string; adminArea3Type?: string; adminArea4?: string; adminArea4Type?: string; adminArea5?: string; adminArea5Type?: string; adminArea6?: string; adminArea6Type?: string; postalCode: string; type: "s" | "v"; linkId: string; dragPoint: boolean; geocodeQuality: "POINT" | "ADDRESS" | "INTERSECTION" | "STREET" | "COUNTRY" | "STATE" | "COUNTY" | "CITY" | "NEIGHBORHOOD" | "ZIP" | "ZIP_EXTENDED"; geocodeQualityCode: string; mapUrl: string; } export interface MapQuestResponse { info: { statuscode: 0 | 400 | 403 | 500; copyright: { text: string; imageUrl: string; imageAltText: string; }; messages: string[]; }; results: { providedLocation: { location?: string; latLng?: MapQuestCoordinates; }; locations: MapQuestResult[]; }[]; } export interface MapQuestProviderOptionsInterface extends ProviderOptionsInterface { readonly apiKey: string; readonly method?: "GET" | "POST"; readonly source?: "nominatim" | "mapquest"; } export declare const defaultMapQuestProviderOptions: MapQuestProviderOptionsInterface; declare type MapQuestGeocodedResultsCallback = GeocodedResultsCallback<MapQuestGeocoded>; export default class MapQuestProvider implements ProviderInterface<MapQuestGeocoded> { private externalLoader; private options; constructor(_externalLoader: ExternalLoaderInterface, options?: MapQuestProviderOptionsInterface); geocode(query: string | MapQuestGeocodeQuery | MapQuestGeocodeQueryObject): Promise<MapQuestGeocoded[]>; geocode(query: string | MapQuestGeocodeQuery | MapQuestGeocodeQueryObject, callback: MapQuestGeocodedResultsCallback, errorCallback?: ErrorCallback): void; geodecode(query: ReverseQuery | ReverseQueryObject): Promise<MapQuestGeocoded[]>; geodecode(query: ReverseQuery | ReverseQueryObject, callback: MapQuestGeocodedResultsCallback, errorCallback?: ErrorCallback): void; geodecode(latitude: number | string, longitude: number | string): Promise<MapQuestGeocoded[]>; geodecode(latitude: number | string, longitude: number | string, callback: MapQuestGeocodedResultsCallback, errorCallback?: ErrorCallback): void; private withCommonParams; executeRequest(params: ExternalLoaderParams, callback: MapQuestGeocodedResultsCallback, headers?: ExternalLoaderHeaders, body?: ExternalLoaderBody, errorCallback?: ErrorCallback): void; static mapToGeocoded(result: MapQuestResult, attribution?: string): MapQuestGeocoded; } export {}; //# sourceMappingURL=MapQuestProvider.d.ts.map