@maptiler/client 1.7.0 → 1.8.1
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/.github/pull_request_template.md +11 -0
- package/.github/workflows/format-lint.yml +24 -0
- package/CHANGELOG.md +32 -0
- package/dist/maptiler-client.cjs +680 -306
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +270 -100
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +380 -294
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +10 -8
- package/readme.md +133 -1
- package/rollup.config.js +3 -3
- package/dist/maptiler-client.umd.js +0 -1541
- package/dist/maptiler-client.umd.js.map +0 -1
- package/dist/maptiler-client.umd.min.js +0 -1
- package/examples/test-browser-es.html +0 -103
- package/examples/test-browser-umd.html +0 -90
- package/examples/test-node.js +0 -52
- package/src/callFetch.ts +0 -18
- package/src/config.ts +0 -68
- package/src/defaults.ts +0 -11
- package/src/demProfiler/getElevation.ts +0 -46
- package/src/demProfiler/index.ts +0 -240
- package/src/demProfiler/tileCover.ts +0 -96
- package/src/geometry/area.ts +0 -96
- package/src/geometry/distance.ts +0 -45
- package/src/geometry/index.ts +0 -3
- package/src/geometry/util.ts +0 -34
- package/src/index.ts +0 -114
- package/src/language.ts +0 -87
- package/src/mapstyle.ts +0 -968
- package/src/services/ServiceError.ts +0 -13
- package/src/services/coordinates.ts +0 -263
- package/src/services/data.ts +0 -63
- package/src/services/geocoding.ts +0 -461
- package/src/services/geolocation.ts +0 -139
- package/src/services/simplify.ts +0 -87
- package/src/services/staticMaps.ts +0 -463
package/src/geometry/util.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const earthRadius = 6371008.8;
|
|
2
|
-
|
|
3
|
-
/** Convert meters to feet */
|
|
4
|
-
export function mToFt(m: number): number {
|
|
5
|
-
return m * 3.28084;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** Convert degrees to Radians */
|
|
9
|
-
export function degToRad(degrees: number): number {
|
|
10
|
-
return ((degrees % 360) * Math.PI) / 180;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Convert radians to degrees */
|
|
14
|
-
export function radToDeg(radians: number): number {
|
|
15
|
-
return (radians * 180) / Math.PI;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Given a latitude and zoom level, determine the max distance each segment can be in meters */
|
|
19
|
-
export function getZoomLevelResolution(
|
|
20
|
-
latitude: number,
|
|
21
|
-
zoom: number,
|
|
22
|
-
tileSize = 512,
|
|
23
|
-
): number {
|
|
24
|
-
return (
|
|
25
|
-
((Math.cos((latitude * Math.PI) / 180.0) * 2 * Math.PI * 6378137) /
|
|
26
|
-
(tileSize * 2 ** zoom)) *
|
|
27
|
-
3
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Convert a tile's zoom-x-y to a number hash */
|
|
32
|
-
export function xyzToTileID(x: number, y: number, zoom: number): number {
|
|
33
|
-
return ((1 << zoom) * y + x) * 32 + zoom;
|
|
34
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { BBox, Position } from "geojson";
|
|
2
|
-
import { ClientConfig, config } from "./config";
|
|
3
|
-
import type { FetchFunction } from "./config";
|
|
4
|
-
import { LanguageGeocoding, LanguageGeocodingString } from "./language";
|
|
5
|
-
|
|
6
|
-
// Importing services
|
|
7
|
-
import { geocoding } from "./services/geocoding";
|
|
8
|
-
import type {
|
|
9
|
-
GeocodingOptions,
|
|
10
|
-
ReverseGeocodingOptions,
|
|
11
|
-
LanguageGeocodingOptions,
|
|
12
|
-
CommonForwardAndReverseGeocodingOptions,
|
|
13
|
-
GeocodingSearchResult,
|
|
14
|
-
GeocodingFeature,
|
|
15
|
-
FeatureHierarchy,
|
|
16
|
-
Coordinates,
|
|
17
|
-
} from "./services/geocoding";
|
|
18
|
-
import { geolocation } from "./services/geolocation";
|
|
19
|
-
import type {
|
|
20
|
-
GeolocationInfoOptions,
|
|
21
|
-
GeolocationResult,
|
|
22
|
-
} from "./services/geolocation";
|
|
23
|
-
import { coordinates } from "./services/coordinates";
|
|
24
|
-
import type {
|
|
25
|
-
CoordinatesSearchOptions,
|
|
26
|
-
CoordinatesTransformOptions,
|
|
27
|
-
CoordinateTransformResult,
|
|
28
|
-
CoordinateSearchResult,
|
|
29
|
-
CoordinateSearch,
|
|
30
|
-
XYZ,
|
|
31
|
-
CoordinateTransformation,
|
|
32
|
-
CoordinateId,
|
|
33
|
-
CoordinateExport,
|
|
34
|
-
CoordinateGrid,
|
|
35
|
-
} from "./services/coordinates";
|
|
36
|
-
import { data } from "./services/data";
|
|
37
|
-
import type { GetDataOptions } from "./services/data";
|
|
38
|
-
import { staticMaps } from "./services/staticMaps";
|
|
39
|
-
import type {
|
|
40
|
-
StaticMapMarker,
|
|
41
|
-
StaticMapBaseOptions,
|
|
42
|
-
CenteredStaticMapOptions,
|
|
43
|
-
AutomaticStaticMapOptions,
|
|
44
|
-
BoundedStaticMapOptions,
|
|
45
|
-
} from "./services/staticMaps";
|
|
46
|
-
|
|
47
|
-
import { ServiceError } from "./services/ServiceError";
|
|
48
|
-
|
|
49
|
-
import type { MapStylePreset, MapStyleType } from "./mapstyle";
|
|
50
|
-
|
|
51
|
-
import {
|
|
52
|
-
MapStyleVariant,
|
|
53
|
-
ReferenceMapStyle,
|
|
54
|
-
mapStylePresetList,
|
|
55
|
-
MapStyle,
|
|
56
|
-
expandMapStyle,
|
|
57
|
-
} from "./mapstyle";
|
|
58
|
-
|
|
59
|
-
export * from "./demProfiler";
|
|
60
|
-
export * from "./geometry";
|
|
61
|
-
|
|
62
|
-
// Exporting types
|
|
63
|
-
export type {
|
|
64
|
-
Position,
|
|
65
|
-
BBox,
|
|
66
|
-
GeocodingOptions,
|
|
67
|
-
ReverseGeocodingOptions,
|
|
68
|
-
LanguageGeocodingOptions,
|
|
69
|
-
CommonForwardAndReverseGeocodingOptions,
|
|
70
|
-
GeocodingSearchResult,
|
|
71
|
-
GeocodingFeature,
|
|
72
|
-
CoordinateExport,
|
|
73
|
-
CoordinateGrid,
|
|
74
|
-
CoordinateTransformation,
|
|
75
|
-
CoordinateId,
|
|
76
|
-
FeatureHierarchy,
|
|
77
|
-
Coordinates,
|
|
78
|
-
CoordinatesTransformOptions,
|
|
79
|
-
CoordinateTransformResult,
|
|
80
|
-
CoordinateSearchResult,
|
|
81
|
-
XYZ,
|
|
82
|
-
CoordinateSearch,
|
|
83
|
-
CoordinatesSearchOptions,
|
|
84
|
-
StaticMapMarker,
|
|
85
|
-
StaticMapBaseOptions,
|
|
86
|
-
CenteredStaticMapOptions,
|
|
87
|
-
BoundedStaticMapOptions,
|
|
88
|
-
AutomaticStaticMapOptions,
|
|
89
|
-
FetchFunction,
|
|
90
|
-
LanguageGeocodingString,
|
|
91
|
-
GetDataOptions,
|
|
92
|
-
GeolocationInfoOptions,
|
|
93
|
-
GeolocationResult,
|
|
94
|
-
MapStylePreset,
|
|
95
|
-
MapStyleType,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Exporting classes, objects, functions, etc.
|
|
99
|
-
export {
|
|
100
|
-
config,
|
|
101
|
-
ClientConfig,
|
|
102
|
-
ServiceError,
|
|
103
|
-
geocoding,
|
|
104
|
-
geolocation,
|
|
105
|
-
coordinates,
|
|
106
|
-
data,
|
|
107
|
-
staticMaps,
|
|
108
|
-
LanguageGeocoding,
|
|
109
|
-
MapStyleVariant,
|
|
110
|
-
ReferenceMapStyle,
|
|
111
|
-
mapStylePresetList,
|
|
112
|
-
MapStyle,
|
|
113
|
-
expandMapStyle,
|
|
114
|
-
};
|
package/src/language.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
|
|
3
|
-
*/
|
|
4
|
-
const LanguageGeocoding = {
|
|
5
|
-
AUTO: "auto",
|
|
6
|
-
ALBANIAN: "sq",
|
|
7
|
-
ARABIC: "ar",
|
|
8
|
-
ARMENIAN: "hy",
|
|
9
|
-
AZERBAIJANI: "az",
|
|
10
|
-
BELORUSSIAN: "be",
|
|
11
|
-
BOSNIAN: "bs",
|
|
12
|
-
BRETON: "br",
|
|
13
|
-
BULGARIAN: "bg",
|
|
14
|
-
CATALAN: "ca",
|
|
15
|
-
CHINESE: "zh",
|
|
16
|
-
CROATIAN: "hr",
|
|
17
|
-
CZECH: "cs",
|
|
18
|
-
DANISH: "da",
|
|
19
|
-
DUTCH: "nl",
|
|
20
|
-
ENGLISH: "en",
|
|
21
|
-
ESPERANTO: "eo",
|
|
22
|
-
ESTONIAN: "et",
|
|
23
|
-
FINNISH: "fi",
|
|
24
|
-
FRENCH: "fr",
|
|
25
|
-
FRISIAN: "fy",
|
|
26
|
-
GEORGIAN: "ka",
|
|
27
|
-
GERMAN: "de",
|
|
28
|
-
GREEK: "el",
|
|
29
|
-
HEBREW: "he",
|
|
30
|
-
HUNGARIAN: "hu",
|
|
31
|
-
ICELANDIC: "is",
|
|
32
|
-
IRISH: "ga",
|
|
33
|
-
ITALIAN: "it",
|
|
34
|
-
JAPANESE: "ja",
|
|
35
|
-
KANNADA: "kn",
|
|
36
|
-
KAZAKH: "kk",
|
|
37
|
-
KOREAN: "ko",
|
|
38
|
-
ROMAN_LATIN: "la",
|
|
39
|
-
LATVIAN: "lv",
|
|
40
|
-
LITHUANIAN: "lt",
|
|
41
|
-
LUXEMBOURGISH: "lb",
|
|
42
|
-
MACEDONIAN: "mk",
|
|
43
|
-
MALTESE: "mt",
|
|
44
|
-
NORWEGIAN: "no",
|
|
45
|
-
POLISH: "pl",
|
|
46
|
-
PORTUGUESE: "pt",
|
|
47
|
-
ROMANIAN: "ro",
|
|
48
|
-
ROMANSH: "rm",
|
|
49
|
-
RUSSIAN: "ru",
|
|
50
|
-
SCOTTISH_GAELIC: "gd",
|
|
51
|
-
SERBIAN_CYRILLIC: "sr",
|
|
52
|
-
SLOVAK: "sk",
|
|
53
|
-
SLOVENE: "sl",
|
|
54
|
-
SPANISH: "es",
|
|
55
|
-
SWEDISH: "sv",
|
|
56
|
-
THAI: "th",
|
|
57
|
-
TURKISH: "tr",
|
|
58
|
-
UKRAINIAN: "uk",
|
|
59
|
-
WELSH: "cy",
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const languageCodeSet = new Set(Object.values(LanguageGeocoding));
|
|
63
|
-
|
|
64
|
-
type Values<T> = T[keyof T];
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Built-in languages values as strings
|
|
68
|
-
*/
|
|
69
|
-
type LanguageGeocodingString = Values<typeof LanguageGeocoding>;
|
|
70
|
-
|
|
71
|
-
function getAutoLanguageGeocoding(): LanguageGeocodingString {
|
|
72
|
-
if (typeof navigator === "undefined") {
|
|
73
|
-
return Intl.DateTimeFormat()
|
|
74
|
-
.resolvedOptions()
|
|
75
|
-
.locale.split("-")[0] as LanguageGeocodingString;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const canditatelangs = Array.from(
|
|
79
|
-
new Set(navigator.languages.map((l) => l.split("-")[0])),
|
|
80
|
-
).filter((l) => languageCodeSet.has(l as LanguageGeocodingString));
|
|
81
|
-
|
|
82
|
-
return canditatelangs.length
|
|
83
|
-
? (canditatelangs[0] as LanguageGeocodingString)
|
|
84
|
-
: LanguageGeocoding.ENGLISH;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { LanguageGeocoding, LanguageGeocodingString, getAutoLanguageGeocoding };
|