@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.
- package/dist/maptiler-client.cjs +28 -0
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +81 -9
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +28 -0
- package/dist/maptiler-client.mjs.map +1 -1
- package/dist/maptiler-client.umd.js +28 -0
- package/dist/maptiler-client.umd.js.map +1 -1
- package/dist/maptiler-client.umd.min.js +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 +16 -10
- 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 +46 -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/readme.md +8 -4
- package/src/mapstyle.ts +49 -0
- 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.
|
|
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
|
-
|
|
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
|
|