@maptrip/map-tiles 1.3.0 → 1.3.2
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/README.md +2 -0
- package/dist/api-extensions/google/MapTripGoogleMapType.d.ts +1 -2
- package/dist/api-extensions/leaflet/MapTripLeafletGridLayer.d.ts +3 -4
- package/dist/api-extensions/openlayers/MapTripOpenLayersSource.d.ts +3 -4
- package/dist/core/CollisionDetector.d.ts +0 -1
- package/dist/core/VectorTileFactory.d.ts +0 -1
- package/dist/core/VectorTileLoader.d.ts +0 -1
- package/dist/core/VectorTileRenderer.d.ts +2 -3
- package/dist/map-tiles.d.ts +7 -8
- package/dist/map-tiles.js +15548 -15585
- package/dist/map-tiles.js.map +1 -1
- package/dist/util/MapReleaseFetcher.d.ts +2 -4
- package/lib/api-extensions/leaflet/MapTripLeafletGridLayer.ts +2 -3
- package/lib/core/constants.ts +3 -2
- package/lib/util/MapReleaseFetcher.ts +17 -33
- package/package.json +6 -8
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export declare class MapReleaseFetcher {
|
|
2
|
-
private _baseUrl;
|
|
3
2
|
private _token;
|
|
4
3
|
private _tomtom;
|
|
5
4
|
private _osm;
|
|
6
5
|
private _here;
|
|
7
6
|
constructor(token: string);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fetchAndExtractRelease(provider: string): Promise<string | null>;
|
|
7
|
+
getRelease(provider: string): Promise<string | null | undefined>;
|
|
8
|
+
fetchAndExtractRelease(url: string): Promise<string | null>;
|
|
11
9
|
private extractTargetString;
|
|
12
10
|
}
|
|
@@ -101,9 +101,8 @@ class MapTripLeafletGridLayer extends L.GridLayer {
|
|
|
101
101
|
// remove the attribution with release date from map for instances where different layers have different preferences for setting release date
|
|
102
102
|
const map = this._map;
|
|
103
103
|
this._map.addEventListener("baselayerchange", () => {
|
|
104
|
-
map.attributionControl.removeAttribution(this.attribution)
|
|
105
|
-
})
|
|
106
|
-
|
|
104
|
+
map.attributionControl.removeAttribution(this.attribution);
|
|
105
|
+
});
|
|
107
106
|
} catch (error) {
|
|
108
107
|
console.error("Error fetching release version: ", error);
|
|
109
108
|
}
|
package/lib/core/constants.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export const URL_TEMPLATE =
|
|
2
2
|
"https://v${index}.maptrip.de/?tilex=${x}&tiley=${y}&acao=true&context=tomtom${z}&project=${project}&projection=wgs84";
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
export const PROVIDER_PROJECTS: { [key: string]: string } = {
|
|
5
6
|
tomtom: "TomTom_latest",
|
|
6
|
-
here: "
|
|
7
|
-
openstreetmap: "
|
|
7
|
+
here: "HERE_latest",
|
|
8
|
+
openstreetmap: "OSM_latest",
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export const PROVIDER_TRAFFIC: { [key: string]: string | null } = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export class MapReleaseFetcher {
|
|
2
|
-
private _baseUrl: string;
|
|
3
2
|
private _token: string;
|
|
4
3
|
|
|
5
4
|
private _tomtom: Promise<string | null> | null = null;
|
|
@@ -7,43 +6,35 @@ export class MapReleaseFetcher {
|
|
|
7
6
|
private _here: Promise<string | null> | null = null;
|
|
8
7
|
|
|
9
8
|
constructor(token: string) {
|
|
10
|
-
this._baseUrl =
|
|
11
|
-
"https://v1.maptrip.de/?CMD=GETFILE&PROJECT=${project}&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
12
9
|
this._token = token;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
updateUrl(provider: string) {
|
|
16
|
-
if (provider === "tomtom") {
|
|
17
|
-
this._baseUrl = this._baseUrl.replace("${project}", "TomTom_latest");
|
|
18
|
-
} else if (provider === "openstreetmap") {
|
|
19
|
-
this._baseUrl = this._baseUrl.replace("${project}", "OSM_latest");
|
|
20
|
-
} else {
|
|
21
|
-
this._baseUrl = this._baseUrl.replace("${project}", "HERE_latest");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
12
|
async getRelease(provider: string) {
|
|
26
|
-
|
|
27
|
-
if (providerLowercase === "tomtom") {
|
|
13
|
+
if (provider === "tomtom") {
|
|
28
14
|
if (!this._tomtom) {
|
|
29
|
-
|
|
15
|
+
const url =
|
|
16
|
+
"https://v1.maptrip.de/?CMD=GETFILE&PROJECT=TomTom_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
17
|
+
this._tomtom = this.fetchAndExtractRelease(url);
|
|
30
18
|
}
|
|
31
|
-
return this._tomtom;
|
|
32
|
-
} else if (
|
|
19
|
+
return this._tomtom;
|
|
20
|
+
} else if (provider === "here") {
|
|
33
21
|
if (!this._here) {
|
|
34
|
-
|
|
22
|
+
const url =
|
|
23
|
+
"https://v1.maptrip.de/?CMD=GETFILE&PROJECT=HERE_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
24
|
+
this._here = this.fetchAndExtractRelease(url);
|
|
35
25
|
}
|
|
36
26
|
return this._here;
|
|
37
|
-
} else {
|
|
27
|
+
} else if (provider === "openstreetmap") {
|
|
38
28
|
if (!this._osm) {
|
|
39
|
-
|
|
29
|
+
const url =
|
|
30
|
+
"https://v1.maptrip.de/?CMD=GETFILE&PROJECT=OSM_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
31
|
+
this._osm = this.fetchAndExtractRelease(url);
|
|
40
32
|
}
|
|
41
33
|
return this._osm;
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
async fetchAndExtractRelease(
|
|
46
|
-
const providerVar = this.updateUrl(provider);
|
|
37
|
+
async fetchAndExtractRelease(url: string): Promise<string | null> {
|
|
47
38
|
return new Promise((resolve, reject) => {
|
|
48
39
|
var xhr = new XMLHttpRequest();
|
|
49
40
|
xhr.onreadystatechange = () => {
|
|
@@ -52,22 +43,15 @@ export class MapReleaseFetcher {
|
|
|
52
43
|
if (xhr.status === 200) {
|
|
53
44
|
const text = new TextDecoder("latin1").decode(xhr.response);
|
|
54
45
|
const textString = this.extractTargetString(text);
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
if (provider === "tomtom") {
|
|
58
|
-
this._tomtom = Promise.resolve(release);
|
|
59
|
-
} else if (provider === "here") {
|
|
60
|
-
this._here = Promise.resolve(release);
|
|
61
|
-
} else if (provider === "openstreetmap") {
|
|
62
|
-
this._osm = Promise.resolve(release);
|
|
63
|
-
}
|
|
46
|
+
const formattedString = textString!.split("Q").join(" Q");
|
|
47
|
+
const release = ` ${formattedString}`;
|
|
64
48
|
|
|
65
49
|
resolve(release);
|
|
66
50
|
} else {
|
|
67
51
|
reject(`Error fetching: ${xhr.status}`);
|
|
68
52
|
}
|
|
69
53
|
};
|
|
70
|
-
xhr.open("GET",
|
|
54
|
+
xhr.open("GET", url, true);
|
|
71
55
|
xhr.setRequestHeader("Authorization", `Bearer ${this._token}`);
|
|
72
56
|
xhr.setRequestHeader("Accept", "*/*");
|
|
73
57
|
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptrip/map-tiles",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "API to use MapTrip map tiles in other map APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"map",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dev": "vite src",
|
|
22
22
|
"prepublish": "tsc",
|
|
23
23
|
"build": "tsc && vite build",
|
|
24
|
-
"publish": "tsc && vite build && npm login --scope=@maptrip && npm publish"
|
|
24
|
+
"publish": "npm update && tsc && vite build && npm login --scope=@maptrip && npm publish"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@googlemaps/js-api-loader": "^1.16.2",
|
|
@@ -30,21 +30,19 @@
|
|
|
30
30
|
"eslint": "^8.52.0",
|
|
31
31
|
"ol": "~8.2.x",
|
|
32
32
|
"typescript": "^5.4.5",
|
|
33
|
-
"vite": "^
|
|
33
|
+
"vite": "^6.2.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@types/geojson": "^7946.0.14",
|
|
37
|
-
|
|
38
37
|
"@types/webfontloader": "^1.6.38",
|
|
39
|
-
|
|
40
38
|
"rtree": "^1.4.2",
|
|
41
|
-
"vite-plugin-dts": "^
|
|
39
|
+
"vite-plugin-dts": "^4.5.3",
|
|
42
40
|
"webfontloader": "^1.6.28"
|
|
43
41
|
},
|
|
44
42
|
"peerDependencies": {
|
|
45
|
-
"leaflet": "^1.9.x",
|
|
46
|
-
"@types/leaflet": "^1.9.12",
|
|
47
43
|
"@googlemaps/js-api-loader": "^1.16.2",
|
|
44
|
+
"@types/leaflet": "^1.9.12",
|
|
45
|
+
"leaflet": "^1.9.x",
|
|
48
46
|
"ol": "~8.2.x"
|
|
49
47
|
},
|
|
50
48
|
"directories": {
|