@maptiler/client 1.4.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.
Files changed (71) hide show
  1. package/dist/maptiler-client.cjs +28 -0
  2. package/dist/maptiler-client.cjs.map +1 -1
  3. package/dist/maptiler-client.d.ts +81 -9
  4. package/dist/maptiler-client.min.mjs +1 -1
  5. package/dist/maptiler-client.mjs +28 -0
  6. package/dist/maptiler-client.mjs.map +1 -1
  7. package/dist/maptiler-client.umd.js +28 -0
  8. package/dist/maptiler-client.umd.js.map +1 -1
  9. package/dist/maptiler-client.umd.min.js +1 -1
  10. package/docs/assets/search.js +1 -1
  11. package/docs/classes/config.ClientConfig.html +9 -9
  12. package/docs/classes/services_ServiceError.ServiceError.html +7 -7
  13. package/docs/functions/language.getAutoLanguageGeocoding.html +5 -5
  14. package/docs/functions/services_simplify.default.html +5 -5
  15. package/docs/index.html +16 -10
  16. package/docs/modules/config.html +5 -5
  17. package/docs/modules/language.html +5 -5
  18. package/docs/modules/services_ServiceError.html +5 -5
  19. package/docs/modules/services_coordinates.html +5 -5
  20. package/docs/modules/services_data.html +5 -5
  21. package/docs/modules/services_geocoding.html +5 -5
  22. package/docs/modules/services_geolocation.html +5 -5
  23. package/docs/modules/services_simplify.html +5 -5
  24. package/docs/modules/services_staticMaps.html +5 -5
  25. package/docs/modules.html +4 -4
  26. package/docs/types/config.FetchFunction.html +5 -5
  27. package/docs/types/language.LanguageGeocodingString.html +5 -5
  28. package/docs/types/services_coordinates.CoordinateExport.html +5 -5
  29. package/docs/types/services_coordinates.CoordinateGrid.html +5 -5
  30. package/docs/types/services_coordinates.CoordinateId.html +5 -5
  31. package/docs/types/services_coordinates.CoordinateSearch.html +5 -5
  32. package/docs/types/services_coordinates.CoordinateSearchResult.html +5 -5
  33. package/docs/types/services_coordinates.CoordinateTransformResult.html +5 -5
  34. package/docs/types/services_coordinates.CoordinateTransformation.html +5 -5
  35. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +5 -5
  36. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +5 -5
  37. package/docs/types/services_coordinates.XYZ.html +5 -5
  38. package/docs/types/services_data.GetDataOptions.html +5 -5
  39. package/docs/types/services_geocoding.ByIdGeocodingOptions.html +5 -5
  40. package/docs/types/services_geocoding.CommonForwardAndReverseGeocodingOptions.html +6 -6
  41. package/docs/types/services_geocoding.Coordinates.html +5 -5
  42. package/docs/types/services_geocoding.FeatureHierarchy.html +6 -17
  43. package/docs/types/services_geocoding.GeocodingFeature.html +6 -6
  44. package/docs/types/services_geocoding.GeocodingOptions.html +5 -5
  45. package/docs/types/services_geocoding.GeocodingSearchResult.html +5 -5
  46. package/docs/types/services_geocoding.LanguageGeocodingOptions.html +5 -5
  47. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +5 -5
  48. package/docs/types/services_geolocation.GeolocationInfoOptions.html +5 -5
  49. package/docs/types/services_geolocation.GeolocationResult.html +5 -5
  50. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +5 -5
  51. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +5 -5
  52. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +5 -5
  53. package/docs/types/services_staticMaps.StaticMapBaseOptions.html +5 -5
  54. package/docs/types/services_staticMaps.StaticMapMarker.html +5 -5
  55. package/docs/variables/config.config.html +5 -5
  56. package/docs/variables/language.LanguageGeocoding.html +5 -5
  57. package/docs/variables/services_coordinates.coordinates.html +5 -5
  58. package/docs/variables/services_data.data.html +5 -5
  59. package/docs/variables/services_geocoding.geocoding.html +5 -5
  60. package/docs/variables/services_geolocation.geolocation.html +5 -5
  61. package/docs/variables/services_staticMaps.staticMaps.html +5 -5
  62. package/docsmd/README.md +46 -52
  63. package/docsmd/classes/ClientConfig.md +5 -5
  64. package/docsmd/classes/MapStyleVariant.md +13 -13
  65. package/docsmd/classes/ReferenceMapStyle.md +9 -9
  66. package/docsmd/classes/ServiceError.md +3 -3
  67. package/examples/test-node.js +9 -9
  68. package/package.json +1 -1
  69. package/readme.md +8 -4
  70. package/src/mapstyle.ts +49 -0
  71. package/src/services/geocoding.ts +96 -18
package/readme.md CHANGED
@@ -80,7 +80,7 @@ You can provide some options such as:
80
80
  - one of more languages to get the results into
81
81
  - a bounding geo box, to restrict the search to a given window
82
82
 
83
- Read more about forward geocoding on our [official documentation](https://docs.maptiler.com/client-js/geocoding/#forward).
83
+ Read more about forward geocoding as well as feature ID query and batch forward geocoding on our [official documentation](https://docs.maptiler.com/client-js/geocoding/#forward).
84
84
 
85
85
  ### Reverse
86
86
  You wan to tknow the name of a place, given a longitude-latitude? Use the reverse geocoding:
@@ -182,6 +182,12 @@ In the following static map functions, the `option` object features a `style` pr
182
182
  - `MapStyle.STREETS.LIGHT` (variant)
183
183
  - `MapStyle.STREETS.PASTEL` (variant)
184
184
  - `MapStyle.OUTDOOR` reference style for adventure
185
+ - `MapStyle.DATAVIZ`, the perfect style for data visualization, with very little noise
186
+ - `MapStyle.DATAVIZ.DARK` (variant)
187
+ - `MapStyle.DATAVIZ.LIGHT` (variant)
188
+ - `MapStyle.BACKDROP`, the perfect style for data visualization, with very little noise
189
+ - `MapStyle.BACKDROP.DARK` (variant)
190
+ - `MapStyle.BACKDROP.LIGHT` (variant)
185
191
  - `MapStyle.WINTER` reference style for winter adventure
186
192
  - `MapStyle.SATELLITE` reference style satellite and airborne imagery (no variants)
187
193
  - `MapStyle.HYBRID` reference style satellite and airborne imagery with labels (no variants)
@@ -205,9 +211,7 @@ In the following static map functions, the `option` object features a `style` pr
205
211
  - `MapStyle.TONER.LITE` (variant)
206
212
  - `MapStyle.TONER.LINES` (variant)
207
213
  - `MapStyle.OPENSTREETMAP` (reference style, this one does not have any variants)
208
- - `MapStyle.DATAVIZ`, the perfect style for data visualization, with very little noise
209
- - `MapStyle.DATAVIZ.DARK` (variant)
210
- - `MapStyle.DATAVIZ.LIGHT` (variant)
214
+ - `MapStyle.OCEAN` (reference style, this one does not have any variants)
211
215
 
212
216
  ### Centered static maps
213
217
  This type of map is centered on a longitude-latitude coordinate and the zoom level must also be provided (from `0`: very zoomed out, to `22`: very zoomed in).
package/src/mapstyle.ts CHANGED
@@ -478,6 +478,26 @@ export type MapStyleType = {
478
478
  */
479
479
  DEFAULT: MapStyleVariant;
480
480
  };
481
+
482
+ /**
483
+ * Neutral greyscale style with hillshading suitable for colorful terrain-aware visualization
484
+ */
485
+ BACKDROP: ReferenceMapStyle & {
486
+ /**
487
+ * Neutral greyscale style with hillshading suitable for colorful terrain-aware visualization
488
+ */
489
+ DEFAULT: MapStyleVariant;
490
+
491
+ /**
492
+ * Dark greyscale style with hillshading suitable for colorful terrain-aware visualization
493
+ */
494
+ DARK: MapStyleVariant;
495
+
496
+ /**
497
+ * Light greyscale style with hillshading suitable for colorful terrain-aware visualization
498
+ */
499
+ LIGHT: MapStyleVariant;
500
+ };
481
501
  };
482
502
 
483
503
  export const mapStylePresetList: Array<MapStylePreset> = [
@@ -822,6 +842,35 @@ export const mapStylePresetList: Array<MapStylePreset> = [
822
842
  ],
823
843
  },
824
844
 
845
+ {
846
+ referenceStyleID: "BACKDROP",
847
+ name: "Backdrop",
848
+ description: "",
849
+ variants: [
850
+ {
851
+ id: "backdrop",
852
+ name: "Default",
853
+ variantType: "DEFAULT",
854
+ description: "",
855
+ imageURL: "",
856
+ },
857
+ {
858
+ id: "backdrop-dark",
859
+ name: "Dark",
860
+ variantType: "DARK",
861
+ description: "",
862
+ imageURL: "",
863
+ },
864
+ {
865
+ id: "backdrop-light",
866
+ name: "Light",
867
+ variantType: "LIGHT",
868
+ description: "",
869
+ imageURL: "",
870
+ },
871
+ ],
872
+ },
873
+
825
874
  {
826
875
  referenceStyleID: "OCEAN",
827
876
  name: "Ocean",
@@ -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
- export type FeatureHierarchy = {
92
+ type FeatureProperties = {
92
93
  /**
93
- * Unique feature ID
94
+ * External reference of the feature used for debugging purposes
94
95
  */
95
- id: string;
96
+ ref: string;
96
97
 
97
98
  /**
98
- * Localized feature name
99
+ * ISO 3166-1 alpha-2 country code of the feature
99
100
  */
100
- text: string;
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
- * Bounding box of the original feature as [w, s, e, n] array
115
+ * (experimental) Value of place=* tag from OpenStreetMap feature if kind=place
106
116
  */
107
- bbox: BBox;
117
+ "osm:place_type"?: string;
108
118
 
109
119
  /**
110
- * A [lon, lat] array of the original feature centeroid
120
+ * (experimental) Feature tags from OpenStreetMap. Only available for `poi` type.
111
121
  */
112
- center: Coordinates;
122
+ "osm:tags"?: Record<string, string>;
113
123
 
114
124
  /**
115
- * Formatted (including the hierarchy) and localized feature full name
125
+ * Array of POI categories. Only available for `poi` type.
116
126
  */
117
- place_name: string;
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
- * Feature hierarchy
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
- context?: Array<FeatureHierarchy>;
150
+ [text: `text_${string}`]: string;
128
151
 
129
152
  /**
130
- * Address number, if applicable
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
- address?: string;
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