@maptiler/client 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +64 -9
- package/dist/maptiler-client.mjs.map +1 -1
- package/dist/maptiler-client.umd.js.map +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/config.ClientConfig.html +9 -9
- package/docs/classes/services_ServiceError.ServiceError.html +7 -7
- package/docs/functions/language.getAutoLanguageGeocoding.html +5 -5
- package/docs/functions/services_simplify.default.html +5 -5
- package/docs/index.html +4 -4
- package/docs/modules/config.html +5 -5
- package/docs/modules/language.html +5 -5
- package/docs/modules/services_ServiceError.html +5 -5
- package/docs/modules/services_coordinates.html +5 -5
- package/docs/modules/services_data.html +5 -5
- package/docs/modules/services_geocoding.html +5 -5
- package/docs/modules/services_geolocation.html +5 -5
- package/docs/modules/services_simplify.html +5 -5
- package/docs/modules/services_staticMaps.html +5 -5
- package/docs/modules.html +4 -4
- package/docs/types/config.FetchFunction.html +5 -5
- package/docs/types/language.LanguageGeocodingString.html +5 -5
- package/docs/types/services_coordinates.CoordinateExport.html +5 -5
- package/docs/types/services_coordinates.CoordinateGrid.html +5 -5
- package/docs/types/services_coordinates.CoordinateId.html +5 -5
- package/docs/types/services_coordinates.CoordinateSearch.html +5 -5
- package/docs/types/services_coordinates.CoordinateSearchResult.html +5 -5
- package/docs/types/services_coordinates.CoordinateTransformResult.html +5 -5
- package/docs/types/services_coordinates.CoordinateTransformation.html +5 -5
- package/docs/types/services_coordinates.CoordinatesSearchOptions.html +5 -5
- package/docs/types/services_coordinates.CoordinatesTransformOptions.html +5 -5
- package/docs/types/services_coordinates.XYZ.html +5 -5
- package/docs/types/services_data.GetDataOptions.html +5 -5
- package/docs/types/services_geocoding.ByIdGeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.CommonForwardAndReverseGeocodingOptions.html +6 -6
- package/docs/types/services_geocoding.Coordinates.html +5 -5
- package/docs/types/services_geocoding.FeatureHierarchy.html +6 -17
- package/docs/types/services_geocoding.GeocodingFeature.html +6 -6
- package/docs/types/services_geocoding.GeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.GeocodingSearchResult.html +5 -5
- package/docs/types/services_geocoding.LanguageGeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.ReverseGeocodingOptions.html +5 -5
- package/docs/types/services_geolocation.GeolocationInfoOptions.html +5 -5
- package/docs/types/services_geolocation.GeolocationResult.html +5 -5
- package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.StaticMapBaseOptions.html +5 -5
- package/docs/types/services_staticMaps.StaticMapMarker.html +5 -5
- package/docs/variables/config.config.html +5 -5
- package/docs/variables/language.LanguageGeocoding.html +5 -5
- package/docs/variables/services_coordinates.coordinates.html +5 -5
- package/docs/variables/services_data.data.html +5 -5
- package/docs/variables/services_geocoding.geocoding.html +5 -5
- package/docs/variables/services_geolocation.geolocation.html +5 -5
- package/docs/variables/services_staticMaps.staticMaps.html +5 -5
- package/docsmd/README.md +45 -52
- package/docsmd/classes/ClientConfig.md +5 -5
- package/docsmd/classes/MapStyleVariant.md +13 -13
- package/docsmd/classes/ReferenceMapStyle.md +9 -9
- package/docsmd/classes/ServiceError.md +3 -3
- package/examples/test-node.js +9 -9
- package/package.json +1 -1
- package/src/services/geocoding.ts +96 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BBox, Feature, Position } from "geojson";
|
|
1
|
+
import { BBox, Feature, Geometry, Position } from "geojson";
|
|
2
2
|
import { callFetch } from "../callFetch";
|
|
3
3
|
import { config } from "../config";
|
|
4
4
|
import { defaults } from "../defaults";
|
|
@@ -51,6 +51,7 @@ export type CommonForwardAndReverseGeocodingOptions =
|
|
|
51
51
|
| "place"
|
|
52
52
|
| "postal_code"
|
|
53
53
|
| "address"
|
|
54
|
+
| "poi"
|
|
54
55
|
)[];
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -88,33 +89,49 @@ export type ByIdGeocodingOptions = LanguageGeocodingOptions;
|
|
|
88
89
|
|
|
89
90
|
export type Coordinates = Position;
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
type FeatureProperties = {
|
|
92
93
|
/**
|
|
93
|
-
*
|
|
94
|
+
* External reference of the feature used for debugging purposes
|
|
94
95
|
*/
|
|
95
|
-
|
|
96
|
+
ref: string;
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
|
-
*
|
|
99
|
+
* ISO 3166-1 alpha-2 country code of the feature
|
|
99
100
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
country_code: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* (experimental) Kind of the feature
|
|
105
|
+
*/
|
|
106
|
+
kind?:
|
|
107
|
+
| "road"
|
|
108
|
+
| "road_relation"
|
|
109
|
+
| "admin_area"
|
|
110
|
+
| "place"
|
|
111
|
+
| "street"
|
|
112
|
+
| "virtual_street";
|
|
102
113
|
|
|
103
|
-
export type GeocodingFeature = Feature & {
|
|
104
114
|
/**
|
|
105
|
-
*
|
|
115
|
+
* (experimental) Value of place=* tag from OpenStreetMap feature if kind=place
|
|
106
116
|
*/
|
|
107
|
-
|
|
117
|
+
"osm:place_type"?: string;
|
|
108
118
|
|
|
109
119
|
/**
|
|
110
|
-
*
|
|
120
|
+
* (experimental) Feature tags from OpenStreetMap. Only available for `poi` type.
|
|
111
121
|
*/
|
|
112
|
-
|
|
122
|
+
"osm:tags"?: Record<string, string>;
|
|
113
123
|
|
|
114
124
|
/**
|
|
115
|
-
*
|
|
125
|
+
* Array of POI categories. Only available for `poi` type.
|
|
116
126
|
*/
|
|
117
|
-
|
|
127
|
+
categories?: string[];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type FeatureBase = {
|
|
131
|
+
/**
|
|
132
|
+
* Unique feature ID
|
|
133
|
+
*/
|
|
134
|
+
id: string;
|
|
118
135
|
|
|
119
136
|
/**
|
|
120
137
|
* Localized feature name
|
|
@@ -122,16 +139,77 @@ export type GeocodingFeature = Feature & {
|
|
|
122
139
|
text: string;
|
|
123
140
|
|
|
124
141
|
/**
|
|
125
|
-
*
|
|
142
|
+
* Query's primary ISO 639-1 language code
|
|
143
|
+
*/
|
|
144
|
+
language?: string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A string analogous to the `text` field that matches the query in the requested language.
|
|
148
|
+
* This field is only returned when multiple languages are requested using the `language` parameter, and will be present for each requested language.
|
|
126
149
|
*/
|
|
127
|
-
|
|
150
|
+
[text: `text_${string}`]: string;
|
|
128
151
|
|
|
129
152
|
/**
|
|
130
|
-
*
|
|
153
|
+
* A ISO 639-1 query's fallback language code.
|
|
154
|
+
* This field is only returned when multiple languages are requested using the `language` parameter, and will be present for each requested language.
|
|
131
155
|
*/
|
|
132
|
-
|
|
156
|
+
[language: `language_${string}`]: string;
|
|
133
157
|
};
|
|
134
158
|
|
|
159
|
+
export type FeatureHierarchy = FeatureProperties & FeatureBase;
|
|
160
|
+
|
|
161
|
+
export type GeocodingFeature = Feature<Geometry, FeatureProperties> &
|
|
162
|
+
FeatureBase & {
|
|
163
|
+
/**
|
|
164
|
+
* Bounding box of the original feature as [w, s, e, n] array
|
|
165
|
+
*/
|
|
166
|
+
bbox: BBox;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A [lon, lat] array of the original feature centeroid
|
|
170
|
+
*/
|
|
171
|
+
center: Coordinates;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Formatted (including the hierarchy) and localized feature full name
|
|
175
|
+
*/
|
|
176
|
+
place_name: string;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* A string analogous to the `place_name` field that matches the query in the requested language.
|
|
180
|
+
* This field is only returned when multiple languages are requested using the `language` parameter, and will be present for each requested language.
|
|
181
|
+
*/
|
|
182
|
+
[key: `place_name_${string}`]: string;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* An array of feature types describing the feature.
|
|
186
|
+
* Currently each feature has only single type but this may change in the future.
|
|
187
|
+
*/
|
|
188
|
+
place_type: string[];
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Localized type of the place name, matches `place_type` property
|
|
192
|
+
*/
|
|
193
|
+
place_type_name: string[];
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Feature hierarchy
|
|
197
|
+
*/
|
|
198
|
+
context?: Array<FeatureHierarchy>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Address number, if applicable
|
|
202
|
+
*/
|
|
203
|
+
address?: string;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Indicates how well the returned feature matches the user's query on a scale from 0 to 1.
|
|
207
|
+
* 0 means the result does not match the query text at all, while 1 means the result fully matches the query text.
|
|
208
|
+
* You can use the relevance property to remove results that don't fully match the query.
|
|
209
|
+
*/
|
|
210
|
+
relevance: number;
|
|
211
|
+
};
|
|
212
|
+
|
|
135
213
|
export type GeocodingSearchResult = {
|
|
136
214
|
type: "FeatureCollection";
|
|
137
215
|
|