UNPKG

1.77 kBTypeScriptView Raw
1declare namespace google.maps {
2 /***** Services *****/
3 class Geocoder {
4 geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void): void;
5 }
6
7 interface GeocoderRequest {
8 address?: string;
9 bounds?: LatLngBounds | LatLngBoundsLiteral;
10 componentRestrictions?: GeocoderComponentRestrictions;
11 location?: LatLng | LatLngLiteral;
12 placeId?: string;
13 region?: string;
14 }
15
16 interface GeocoderComponentRestrictions {
17 administrativeArea?: string;
18 country?: string | string[];
19 locality?: string;
20 postalCode?: string;
21 route?: string;
22 }
23
24 enum GeocoderStatus {
25 ERROR = 'ERROR',
26 INVALID_REQUEST = 'INVALID_REQUEST',
27 OK = 'OK',
28 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
29 REQUEST_DENIED = 'REQUEST_DENIED',
30 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
31 ZERO_RESULTS = 'ZERO_RESULTS',
32 }
33
34 interface GeocoderResult {
35 address_components: GeocoderAddressComponent[];
36 formatted_address: string;
37 geometry: GeocoderGeometry;
38 partial_match: boolean;
39 place_id: string;
40 postcode_localities: string[];
41 types: string[];
42 }
43
44 interface GeocoderAddressComponent {
45 long_name: string;
46 short_name: string;
47 types: string[];
48 }
49
50 interface GeocoderGeometry {
51 bounds: LatLngBounds;
52 location: LatLng;
53 location_type: GeocoderLocationType;
54 viewport: LatLngBounds;
55 }
56
57 enum GeocoderLocationType {
58 APPROXIMATE = 'APPROXIMATE',
59 GEOMETRIC_CENTER = 'GEOMETRIC_CENTER',
60 RANGE_INTERPOLATED = 'RANGE_INTERPOLATED',
61 ROOFTOP = 'ROOFTOP',
62 }
63}