leaflet-geosearch
Version:
Adds support for address lookup (a.k.a. geocoding / geosearching) to Leaflet.
64 lines (63 loc) • 1.7 kB
TypeScript
import AbstractProvider, { EndpointArgument, ParseArgument, ProviderOptions, SearchResult, SearchArgument } from './provider';
interface Doc {
weergavenaam: string;
id: string;
centroide_ll: string;
}
export interface RequestResult {
response: {
numFound: number;
start: number;
maxScore: number;
numFoundExact: boolean;
docs: Doc[];
};
highlighting: {
[key: string]: {
suggest: string[];
};
};
spellcheck: {
suggestions: [
string,
{
numFound: number;
startOffset: number;
endOffset: number;
suggestion: string[];
}
];
collations: [
'collation',
{
collationQuery: string;
hits: number;
misspellingsAndCorrections: string[];
}
];
};
}
export interface RawResult extends Doc {
highlight: string;
}
export declare type PdokNlProviderOptions = ProviderOptions;
export default class PdokNlProvider extends AbstractProvider<RequestResult, RawResult> {
searchUrl: string;
reverseUrl: string;
constructor(options?: PdokNlProviderOptions);
endpoint({ query, type }: EndpointArgument): string;
parse({ data }: ParseArgument<RequestResult>): {
x: number;
y: number;
label: string;
bounds: null;
raw: {
highlight: string;
weergavenaam: string;
id: string;
centroide_ll: string;
};
}[];
search(options: SearchArgument): Promise<SearchResult<RawResult>[]>;
}
export {};