@maptrip/map-tiles 1.3.0 → 1.3.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/README.md CHANGED
@@ -277,6 +277,7 @@ To use them, you mapping API has to be able to use both base layers and overlays
277
277
 
278
278
  ## History
279
279
 
280
+ - 1.3.1: Updated all all providers to use the latest build of the project
280
281
  - 1.3.0: Added map release data for Leaflet and OpenLayers map attributions
281
282
  - 1.2.1: Fixed a bug in MapTripLeafletGridLayer type implementation
282
283
  - 1.2.0: Added TypeScript declaration file
package/dist/map-tiles.js CHANGED
@@ -1919,8 +1919,8 @@ class VectorTileRenderer {
1919
1919
  const URL_TEMPLATE = "https://v${index}.maptrip.de/?tilex=${x}&tiley=${y}&acao=true&context=tomtom${z}&project=${project}&projection=wgs84";
1920
1920
  const PROVIDER_PROJECTS = {
1921
1921
  tomtom: "TomTom_latest",
1922
- here: "HERE_PLANET_2023_03",
1923
- openstreetmap: "OSM_PLANET_2023_03"
1922
+ here: "HERE_latest",
1923
+ openstreetmap: "OSM_latest"
1924
1924
  };
1925
1925
  const PROVIDER_TRAFFIC = {
1926
1926
  tomtom: "https://v0.maptrip.de/tiles?project=TrafficMobileTomTom_EUROPE&tilex=${x}&tiley=${y}&acao=true&context=traffic${z}&projection=wgs84",
@@ -4549,45 +4549,35 @@ const RENDERING_CONFIG_GRAYSCALE = {
4549
4549
  };
4550
4550
 
4551
4551
  class MapReleaseFetcher {
4552
- _baseUrl;
4553
4552
  _token;
4554
4553
  _tomtom = null;
4555
4554
  _osm = null;
4556
4555
  _here = null;
4557
4556
  constructor(token) {
4558
- this._baseUrl = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=${project}&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
4559
4557
  this._token = token;
4560
4558
  }
4561
- updateUrl(provider) {
4562
- if (provider === "tomtom") {
4563
- this._baseUrl = this._baseUrl.replace("${project}", "TomTom_latest");
4564
- } else if (provider === "openstreetmap") {
4565
- this._baseUrl = this._baseUrl.replace("${project}", "OSM_latest");
4566
- } else {
4567
- this._baseUrl = this._baseUrl.replace("${project}", "HERE_latest");
4568
- }
4569
- }
4570
4559
  async getRelease(provider) {
4571
- const providerLowercase = provider.toLowerCase();
4572
- if (providerLowercase === "tomtom") {
4560
+ if (provider === "tomtom") {
4573
4561
  if (!this._tomtom) {
4574
- this._tomtom = this.fetchAndExtractRelease(providerLowercase);
4562
+ const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=TomTom_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
4563
+ this._tomtom = this.fetchAndExtractRelease(url);
4575
4564
  }
4576
4565
  return this._tomtom;
4577
- } else if (providerLowercase === "here") {
4566
+ } else if (provider === "here") {
4578
4567
  if (!this._here) {
4579
- this._here = this.fetchAndExtractRelease(providerLowercase);
4568
+ const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=HERE_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
4569
+ this._here = this.fetchAndExtractRelease(url);
4580
4570
  }
4581
4571
  return this._here;
4582
- } else {
4572
+ } else if (provider === "openstreetmap") {
4583
4573
  if (!this._osm) {
4584
- this._osm = this.fetchAndExtractRelease(providerLowercase);
4574
+ const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=OSM_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
4575
+ this._osm = this.fetchAndExtractRelease(url);
4585
4576
  }
4586
4577
  return this._osm;
4587
4578
  }
4588
4579
  }
4589
- async fetchAndExtractRelease(provider) {
4590
- this.updateUrl(provider);
4580
+ async fetchAndExtractRelease(url) {
4591
4581
  return new Promise((resolve, reject) => {
4592
4582
  var xhr = new XMLHttpRequest();
4593
4583
  xhr.onreadystatechange = () => {
@@ -4596,20 +4586,14 @@ class MapReleaseFetcher {
4596
4586
  if (xhr.status === 200) {
4597
4587
  const text = new TextDecoder("latin1").decode(xhr.response);
4598
4588
  const textString = this.extractTargetString(text);
4599
- const release = ` ${textString}`;
4600
- if (provider === "tomtom") {
4601
- this._tomtom = Promise.resolve(release);
4602
- } else if (provider === "here") {
4603
- this._here = Promise.resolve(release);
4604
- } else if (provider === "openstreetmap") {
4605
- this._osm = Promise.resolve(release);
4606
- }
4589
+ const formattedString = textString.split("Q").join(" Q");
4590
+ const release = ` ${formattedString}`;
4607
4591
  resolve(release);
4608
4592
  } else {
4609
4593
  reject(`Error fetching: ${xhr.status}`);
4610
4594
  }
4611
4595
  };
4612
- xhr.open("GET", this._baseUrl, true);
4596
+ xhr.open("GET", url, true);
4613
4597
  xhr.setRequestHeader("Authorization", `Bearer ${this._token}`);
4614
4598
  xhr.setRequestHeader("Accept", "*/*");
4615
4599
  xhr.setRequestHeader("Content-Type", "application/octet-stream");