@deepzua/nominatim-js
Version:
Unofficial JS SDK for the Nominatim Open Street Map service that allows geocoding and reverse geocoding
96 lines (95 loc) • 2.36 kB
TypeScript
interface ICommonParams {
'accept-language'?: string;
accept_language?: string;
addressdetails?: 0 | 1;
debug?: 0 | 1;
email?: string;
endpoint?: string;
extratags?: 0 | 1;
format?: 'html' | 'json' | 'xml' | 'jsonv2';
json_callback?: string;
lat?: number;
lon?: number;
namedetails?: 0 | 1;
}
export interface ISearchParams extends ICommonParams {
q: string;
street?: string;
city?: string;
state?: string;
country?: string;
viewbox?: string;
postalcode?: string;
countryCodesArray?: string[];
countrycodes?: string;
bounded?: 0 | 1;
polygon?: 0 | 1;
email?: string;
exclude_place_ids?: string;
limit?: number;
dedupe?: 0 | 1;
}
export interface IAddress {
attraction?: string;
bakery?: string;
city?: string;
city_district?: string;
construction?: string;
continent?: string;
country: string;
country_code: string;
county?: string;
electronics?: string;
house_number?: string;
neighbourhood?: string;
peak?: string;
pedestrian?: string;
postcode?: string;
public_building?: string;
road?: string;
state: string;
suburb?: string;
town?: string;
village?: string;
}
export interface ISearchResult {
place_id: string;
osm_id: string;
osm_type: PlaceTypeLabel;
boundingbox?: string[4];
lat: string;
lon: string;
display_name: string;
class: string;
type: string;
importance: number;
icon: string;
address: IAddress;
licence: string;
svg?: string;
}
export type INominatimResult = ISearchResult;
declare const PLACES_TYPES: {
node: "N";
way: "W";
relation: "R";
};
type Places = typeof PLACES_TYPES;
type PlaceTypeLabel = keyof Places;
export interface IOsmId {
type: PlaceTypeLabel;
id: number;
}
export interface ILookupParams extends ICommonParams {
}
export interface IReversParams extends ICommonParams {
}
export declare class NominatimJS {
private static NOMINATIM_ENDPOINT;
private static normalizeParams;
private static stringifyOsmId;
static search(rawParams: ISearchParams): Promise<ISearchResult[]>;
static lookup(osmIds: IOsmId[], rawParams: ILookupParams): Promise<ISearchResult[]>;
static reverse(rawParams: IReversParams): Promise<ISearchResult>;
}
export {};