@maptrip/map-tiles 1.3.2 → 1.4.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/README.md +9 -2
- package/dist/core/VectorTileFactory.d.ts +2 -0
- package/dist/core/constants.d.ts +5 -0
- package/dist/map-tiles.js +126 -58
- package/dist/map-tiles.js.map +1 -1
- package/dist/util/MapReleaseFetcher.d.ts +2 -1
- package/lib/api-extensions/leaflet/MapTripLeafletGridLayer.ts +3 -1
- package/lib/core/VectorTileFactory.ts +52 -7
- package/lib/core/VectorTileRenderer.ts +66 -101
- package/lib/core/constants.ts +12 -1
- package/lib/util/MapReleaseFetcher.ts +15 -5
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ The response body will include the key `token` in the schema:
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Integration in your mapping API
|
|
41
|
+
To see the subsequent code examples in action, visit our [map tiles demo page](https://demo.infoware.de/examples/npm/map-tiles/).
|
|
41
42
|
|
|
42
43
|
### LeafletJS
|
|
43
44
|
|
|
@@ -187,7 +188,7 @@ Please refer to the documentation of your API to see how you can implement your
|
|
|
187
188
|
## Map Data Providers
|
|
188
189
|
|
|
189
190
|
The maps can be rendered with map data from various providers. To do this, set the property `provider`
|
|
190
|
-
to one of the strings `TomTom`, `HERE` or `OpenStreetmap` when creating a factory:
|
|
191
|
+
to one of the strings `TomTom`, `Orbis`, `HERE` or `OpenStreetmap` when creating a factory:
|
|
191
192
|
|
|
192
193
|
```js
|
|
193
194
|
const factory = VectorTileFactory.createFactory({
|
|
@@ -235,7 +236,7 @@ You can specify a third parameter with properties when creating the factory. The
|
|
|
235
236
|
|
|
236
237
|
| Property | Description | Default Value |
|
|
237
238
|
| ----------------- | ------------------------------------------------------------------------------------------------- | ------------------------ |
|
|
238
|
-
| provider | The map data provider (`TomTom`, `HERE` or `OpenStreetmap`)
|
|
239
|
+
| provider | The map data provider (`TomTom`, `Orbis`, `HERE` or `OpenStreetmap`) | OpenStreetmap |
|
|
239
240
|
| baseMap | Set to `false` for a traffic overlay which can be used on top of e.g. an aerial view | true |
|
|
240
241
|
| traffic | Add traffic flows to the map tiles (only available for TomTom and HERE maps) | false |
|
|
241
242
|
| timeout | Load timeout for tiles in milliseconds. Increase this if you have a very slow internet connection | 5000 |
|
|
@@ -277,6 +278,12 @@ To use them, you mapping API has to be able to use both base layers and overlays
|
|
|
277
278
|
|
|
278
279
|
## History
|
|
279
280
|
|
|
281
|
+
- 1.4.0:
|
|
282
|
+
- Added map data provider `Orbis`
|
|
283
|
+
- Added map data provider name to attribution
|
|
284
|
+
- Fixed rendering of polygons with rings (esp. small islands)
|
|
285
|
+
- Updated dependencies with security vulnerabilities
|
|
286
|
+
- 1.3.3: Added a link for demo apps to README.md
|
|
280
287
|
- 1.3.2: Updated dependencies with security vulnerabilities
|
|
281
288
|
- 1.3.1: Updated all all providers to use the latest build of the project
|
|
282
289
|
- 1.3.0: Added map release data for Leaflet and OpenLayers map attributions
|
|
@@ -26,6 +26,8 @@ declare class VectorTileFactory {
|
|
|
26
26
|
private static getUrlTemplatesForBaseLayer;
|
|
27
27
|
private static getUrlTemplatesForTrafficLayer;
|
|
28
28
|
private static getRenderingConfig;
|
|
29
|
+
private createCanvas;
|
|
30
|
+
private cropCanvas;
|
|
29
31
|
getJsonTile(z: number, x: number, y: number, token: string, callback?: SuccessCallback): HTMLCanvasElement;
|
|
30
32
|
/**
|
|
31
33
|
* @private
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -2,9 +2,14 @@ export declare const URL_TEMPLATE = "https://v${index}.maptrip.de/?tilex=${x}&ti
|
|
|
2
2
|
export declare const PROVIDER_PROJECTS: {
|
|
3
3
|
[key: string]: string;
|
|
4
4
|
};
|
|
5
|
+
export declare const PROVIDER_NAMES: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
5
8
|
export declare const PROVIDER_TRAFFIC: {
|
|
6
9
|
[key: string]: string | null;
|
|
7
10
|
};
|
|
8
11
|
export declare const MIN_ZOOM = 2;
|
|
9
12
|
export declare const MAX_ZOOM = 18;
|
|
10
13
|
export declare const ATTRIBUTION = "© <a href=\"https://maptrip.de/\" target=\"_blank\">infoware GmbH</a>";
|
|
14
|
+
export declare const VECTOR_TILE_SIZE = 256;
|
|
15
|
+
export declare const VECTOR_TILE_RENDER_PADDING = 32;
|
package/dist/map-tiles.js
CHANGED
|
@@ -1107,6 +1107,30 @@ class CollisionDetector {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
|
+
const URL_TEMPLATE = "https://v${index}.maptrip.de/?tilex=${x}&tiley=${y}&acao=true&context=tomtom${z}&project=${project}&projection=wgs84";
|
|
1111
|
+
const PROVIDER_PROJECTS = {
|
|
1112
|
+
tomtom: "TomTom_latest",
|
|
1113
|
+
orbis: "Orbis_latest",
|
|
1114
|
+
here: "HERE_latest",
|
|
1115
|
+
openstreetmap: "OSM_latest"
|
|
1116
|
+
};
|
|
1117
|
+
const PROVIDER_NAMES = {
|
|
1118
|
+
tomtom: "TomTom",
|
|
1119
|
+
orbis: "TomTom Orbis",
|
|
1120
|
+
here: "HERE",
|
|
1121
|
+
openstreetmap: "OpenStreetMap"
|
|
1122
|
+
};
|
|
1123
|
+
const PROVIDER_TRAFFIC = {
|
|
1124
|
+
tomtom: "https://v0.maptrip.de/tiles?project=TrafficMobileTomTom_EUROPE&tilex=${x}&tiley=${y}&acao=true&context=traffic${z}&projection=wgs84",
|
|
1125
|
+
here: "https://v0.maptrip.de/tiles?project=TrafficMobileHere_EUROPE&tilex=${x}&tiley=${y}&acao=true&context=traffic${z}&projection=wgs84",
|
|
1126
|
+
openstreetmap: null
|
|
1127
|
+
};
|
|
1128
|
+
const MIN_ZOOM = 2;
|
|
1129
|
+
const MAX_ZOOM = 18;
|
|
1130
|
+
const ATTRIBUTION = '© <a href="https://maptrip.de/" target="_blank">infoware GmbH</a>';
|
|
1131
|
+
const VECTOR_TILE_SIZE = 256;
|
|
1132
|
+
const VECTOR_TILE_RENDER_PADDING = 32;
|
|
1133
|
+
|
|
1110
1134
|
class VectorTileRenderer {
|
|
1111
1135
|
_styles;
|
|
1112
1136
|
_images;
|
|
@@ -1117,7 +1141,7 @@ class VectorTileRenderer {
|
|
|
1117
1141
|
}
|
|
1118
1142
|
drawTile(layer, z, boundaries, context) {
|
|
1119
1143
|
context.fillStyle = this.getBackgroundColor(z);
|
|
1120
|
-
context.fillRect(0, 0,
|
|
1144
|
+
context.fillRect(0, 0, VECTOR_TILE_SIZE, VECTOR_TILE_SIZE);
|
|
1121
1145
|
var collisions = new CollisionDetector();
|
|
1122
1146
|
let polygons = layer.filter((it) => !!it.properties && !!it.geometry.type).filter(
|
|
1123
1147
|
(it) => it.geometry.type === "Polygon" || it.geometry.type === "MultiPolygon"
|
|
@@ -1173,7 +1197,7 @@ class VectorTileRenderer {
|
|
|
1173
1197
|
var context = canvas.getContext("2d");
|
|
1174
1198
|
if (context != null) {
|
|
1175
1199
|
context.fillStyle = "#C8C8C8";
|
|
1176
|
-
context.fillRect(0, 0,
|
|
1200
|
+
context.fillRect(0, 0, VECTOR_TILE_SIZE, VECTOR_TILE_SIZE);
|
|
1177
1201
|
context.fillStyle = "#AAA";
|
|
1178
1202
|
context.font = "15px Arial";
|
|
1179
1203
|
context.textAlign = "center";
|
|
@@ -1366,6 +1390,8 @@ class VectorTileRenderer {
|
|
|
1366
1390
|
}
|
|
1367
1391
|
}
|
|
1368
1392
|
}
|
|
1393
|
+
} else {
|
|
1394
|
+
console.log("no renderer for kind " + kind);
|
|
1369
1395
|
}
|
|
1370
1396
|
}
|
|
1371
1397
|
}
|
|
@@ -1417,11 +1443,18 @@ class VectorTileRenderer {
|
|
|
1417
1443
|
for (var j = 0; j < coordinates.length; j++) {
|
|
1418
1444
|
var part = coordinates[j];
|
|
1419
1445
|
context.globalAlpha = merged.opacity;
|
|
1420
|
-
|
|
1446
|
+
if ("areas" !== phase || j === 0) {
|
|
1447
|
+
context.beginPath();
|
|
1448
|
+
}
|
|
1449
|
+
const width = boundaries.max.lon - boundaries.min.lon;
|
|
1450
|
+
const height = boundaries.max.lat - boundaries.min.lat;
|
|
1451
|
+
if (width === 0 || height === 0) {
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1421
1454
|
var points = [];
|
|
1422
1455
|
for (let k = 0; k < part.length; k++) {
|
|
1423
|
-
let x =
|
|
1424
|
-
let y =
|
|
1456
|
+
let x = VECTOR_TILE_SIZE * (part[k][0] - boundaries.min.lon) / width;
|
|
1457
|
+
let y = VECTOR_TILE_SIZE * (part[k][1] - boundaries.min.lat) / height;
|
|
1425
1458
|
points.push({ x, y });
|
|
1426
1459
|
if (k == 0) {
|
|
1427
1460
|
context.moveTo(x, y);
|
|
@@ -1437,7 +1470,7 @@ class VectorTileRenderer {
|
|
|
1437
1470
|
context.stroke();
|
|
1438
1471
|
}
|
|
1439
1472
|
return;
|
|
1440
|
-
} else if ("areas" === phase) {
|
|
1473
|
+
} else if ("areas" === phase && j === coordinates.length - 1) {
|
|
1441
1474
|
if (merged.url) {
|
|
1442
1475
|
if (this._images[merged.url]) {
|
|
1443
1476
|
var pattern = context.createPattern(
|
|
@@ -1454,7 +1487,7 @@ class VectorTileRenderer {
|
|
|
1454
1487
|
}
|
|
1455
1488
|
context.fillStyle = merged.color;
|
|
1456
1489
|
}
|
|
1457
|
-
context.fill();
|
|
1490
|
+
context.fill("evenodd");
|
|
1458
1491
|
} else if ("areaTexts" === phase) {
|
|
1459
1492
|
if (geoJsonProperties && geoJsonProperties.NAME) {
|
|
1460
1493
|
if (texts && texts[geoJsonProperties.NAME]) {
|
|
@@ -1462,7 +1495,7 @@ class VectorTileRenderer {
|
|
|
1462
1495
|
}
|
|
1463
1496
|
let merged2 = { ...VectorTileRenderer.DEFAULT_STYLE.TEXT, ...style };
|
|
1464
1497
|
context.globalAlpha = merged2.opacity;
|
|
1465
|
-
context.font = merged2.fontStyle
|
|
1498
|
+
context.font = `${merged2.fontStyle} ${merged2.fontWeight} ${merged2.size}px ${merged2.font}`;
|
|
1466
1499
|
context.textAlign = "left";
|
|
1467
1500
|
context.textBaseline = "top";
|
|
1468
1501
|
var metrics = context.measureText(geoJsonProperties.NAME);
|
|
@@ -1471,7 +1504,7 @@ class VectorTileRenderer {
|
|
|
1471
1504
|
let y = centroid.y;
|
|
1472
1505
|
let w = metrics.width;
|
|
1473
1506
|
let h = merged2.size;
|
|
1474
|
-
if (x < 0 || x + w >
|
|
1507
|
+
if (x < 0 || x + w > VECTOR_TILE_SIZE || y < 0 || y + h > VECTOR_TILE_SIZE) {
|
|
1475
1508
|
return;
|
|
1476
1509
|
}
|
|
1477
1510
|
if (collisions && collisions.isCollision(x, y, w, h)) {
|
|
@@ -1551,13 +1584,11 @@ class VectorTileRenderer {
|
|
|
1551
1584
|
projectCoordinates(coordinates, boundaries) {
|
|
1552
1585
|
var lastX, lastY;
|
|
1553
1586
|
var points = [];
|
|
1587
|
+
const width = boundaries.max.lon - boundaries.min.lon;
|
|
1588
|
+
const height = boundaries.max.lat - boundaries.min.lat;
|
|
1554
1589
|
for (var j = 0; j < coordinates.length; j++) {
|
|
1555
|
-
var x = Math.round(
|
|
1556
|
-
|
|
1557
|
-
);
|
|
1558
|
-
var y = Math.round(
|
|
1559
|
-
256 * (coordinates[j][1] - boundaries.min.lat) / (boundaries.max.lat - boundaries.min.lat)
|
|
1560
|
-
);
|
|
1590
|
+
var x = Math.round(VECTOR_TILE_SIZE * (coordinates[j][0] - boundaries.min.lon) / width);
|
|
1591
|
+
var y = Math.round(VECTOR_TILE_SIZE * (coordinates[j][1] - boundaries.min.lat) / height);
|
|
1561
1592
|
if (x != lastX || y != lastY) {
|
|
1562
1593
|
points.push({ x, y });
|
|
1563
1594
|
}
|
|
@@ -1634,7 +1665,7 @@ class VectorTileRenderer {
|
|
|
1634
1665
|
}
|
|
1635
1666
|
var merged = { ...VectorTileRenderer.DEFAULT_STYLE.TEXT, ...style };
|
|
1636
1667
|
context.globalAlpha = merged.opacity;
|
|
1637
|
-
context.font = merged.fontStyle
|
|
1668
|
+
context.font = `${merged.fontStyle} ${merged.fontWeight} ${merged.size}px ${merged.font}`;
|
|
1638
1669
|
var points = this.projectCoordinates(coordinates, boundaries);
|
|
1639
1670
|
if (points.length < 2) {
|
|
1640
1671
|
return;
|
|
@@ -1808,10 +1839,10 @@ class VectorTileRenderer {
|
|
|
1808
1839
|
if (merged.url) {
|
|
1809
1840
|
if (this._images[merged.url]) {
|
|
1810
1841
|
var x = Math.round(
|
|
1811
|
-
|
|
1842
|
+
VECTOR_TILE_SIZE * (coordinate[0] - boundaries.min.lon) / (boundaries.max.lon - boundaries.min.lon)
|
|
1812
1843
|
);
|
|
1813
1844
|
var y = Math.round(
|
|
1814
|
-
|
|
1845
|
+
VECTOR_TILE_SIZE * (coordinate[1] - boundaries.min.lat) / (boundaries.max.lat - boundaries.min.lat)
|
|
1815
1846
|
);
|
|
1816
1847
|
if (merged.width && merged.height) {
|
|
1817
1848
|
merged.width = Number(merged.width);
|
|
@@ -1832,15 +1863,15 @@ class VectorTileRenderer {
|
|
|
1832
1863
|
*/
|
|
1833
1864
|
isTextCollision(coordinate, name, boundaries, style, context, collisions) {
|
|
1834
1865
|
var merged = { ...VectorTileRenderer.DEFAULT_STYLE.TEXT, ...style };
|
|
1835
|
-
|
|
1836
|
-
|
|
1866
|
+
let x = Math.round(
|
|
1867
|
+
VECTOR_TILE_SIZE * (coordinate[0] - boundaries.min.lon) / (boundaries.max.lon - boundaries.min.lon)
|
|
1837
1868
|
);
|
|
1838
|
-
|
|
1839
|
-
|
|
1869
|
+
let y = Math.round(
|
|
1870
|
+
VECTOR_TILE_SIZE * (coordinate[1] - boundaries.min.lat) / (boundaries.max.lat - boundaries.min.lat)
|
|
1840
1871
|
);
|
|
1841
|
-
context.font = merged.fontStyle
|
|
1842
|
-
|
|
1843
|
-
|
|
1872
|
+
context.font = `${merged.fontStyle} ${merged.fontWeight} ${merged.size}px ${merged.font}`;
|
|
1873
|
+
const w = context.measureText(name).width;
|
|
1874
|
+
const h = merged.size;
|
|
1844
1875
|
x = x - w / 2;
|
|
1845
1876
|
return collisions.isCollision(x, y, w, h);
|
|
1846
1877
|
}
|
|
@@ -1850,13 +1881,13 @@ class VectorTileRenderer {
|
|
|
1850
1881
|
drawText(coordinate, name, boundaries, style, context, collisions) {
|
|
1851
1882
|
var merged = { ...VectorTileRenderer.DEFAULT_STYLE.TEXT, ...style };
|
|
1852
1883
|
var x = Math.round(
|
|
1853
|
-
|
|
1884
|
+
VECTOR_TILE_SIZE * (coordinate[0] - boundaries.min.lon) / (boundaries.max.lon - boundaries.min.lon)
|
|
1854
1885
|
);
|
|
1855
1886
|
var y = Math.round(
|
|
1856
|
-
|
|
1887
|
+
VECTOR_TILE_SIZE * (coordinate[1] - boundaries.min.lat) / (boundaries.max.lat - boundaries.min.lat)
|
|
1857
1888
|
);
|
|
1858
1889
|
context.globalAlpha = merged.opacity;
|
|
1859
|
-
context.font = merged.fontStyle
|
|
1890
|
+
context.font = `${merged.fontStyle} ${merged.fontWeight} ${merged.size}px ${merged.font}`;
|
|
1860
1891
|
var w = context.measureText(name).width;
|
|
1861
1892
|
var h = merged.size;
|
|
1862
1893
|
x = x - w / 2;
|
|
@@ -1897,7 +1928,7 @@ class VectorTileRenderer {
|
|
|
1897
1928
|
let text = this._styles.renderers[renderer][i].text;
|
|
1898
1929
|
if (text) {
|
|
1899
1930
|
let merged = { ...VectorTileRenderer.DEFAULT_STYLE.TEXT, ...text };
|
|
1900
|
-
let font =
|
|
1931
|
+
let font = `${merged.fontStyle} ${merged.fontWeight} ${merged.size}px ${merged.font}`.trim();
|
|
1901
1932
|
result.push(font);
|
|
1902
1933
|
}
|
|
1903
1934
|
}
|
|
@@ -1946,21 +1977,6 @@ class VectorTileRenderer {
|
|
|
1946
1977
|
};
|
|
1947
1978
|
}
|
|
1948
1979
|
|
|
1949
|
-
const URL_TEMPLATE = "https://v${index}.maptrip.de/?tilex=${x}&tiley=${y}&acao=true&context=tomtom${z}&project=${project}&projection=wgs84";
|
|
1950
|
-
const PROVIDER_PROJECTS = {
|
|
1951
|
-
tomtom: "TomTom_latest",
|
|
1952
|
-
here: "HERE_latest",
|
|
1953
|
-
openstreetmap: "OSM_latest"
|
|
1954
|
-
};
|
|
1955
|
-
const PROVIDER_TRAFFIC = {
|
|
1956
|
-
tomtom: "https://v0.maptrip.de/tiles?project=TrafficMobileTomTom_EUROPE&tilex=${x}&tiley=${y}&acao=true&context=traffic${z}&projection=wgs84",
|
|
1957
|
-
here: "https://v0.maptrip.de/tiles?project=TrafficMobileHere_EUROPE&tilex=${x}&tiley=${y}&acao=true&context=traffic${z}&projection=wgs84",
|
|
1958
|
-
openstreetmap: null
|
|
1959
|
-
};
|
|
1960
|
-
const MIN_ZOOM = 2;
|
|
1961
|
-
const MAX_ZOOM = 18;
|
|
1962
|
-
const ATTRIBUTION = '© <a href="https://maptrip.de/" target="_blank">infoware GmbH</a>';
|
|
1963
|
-
|
|
1964
1980
|
var webfontloader = {exports: {}};
|
|
1965
1981
|
|
|
1966
1982
|
/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */
|
|
@@ -3333,13 +3349,54 @@ class VectorTileFactory {
|
|
|
3333
3349
|
return RENDERING_CONFIG_TRAFFIC;
|
|
3334
3350
|
}
|
|
3335
3351
|
}
|
|
3352
|
+
createCanvas(size, padding) {
|
|
3353
|
+
let canvas = document.createElement("canvas");
|
|
3354
|
+
const paddedTileSize = size + 2 * padding;
|
|
3355
|
+
canvas.width = paddedTileSize;
|
|
3356
|
+
canvas.height = paddedTileSize;
|
|
3357
|
+
canvas.style.width = paddedTileSize + "px";
|
|
3358
|
+
canvas.style.height = paddedTileSize + "px";
|
|
3359
|
+
canvas.style.maxWidth = paddedTileSize + "px";
|
|
3360
|
+
canvas.style.maxHeight = paddedTileSize + "px";
|
|
3361
|
+
canvas.style.left = -padding + "px";
|
|
3362
|
+
canvas.style.top = -padding + "px";
|
|
3363
|
+
const context = canvas.getContext("2d");
|
|
3364
|
+
if (!context) {
|
|
3365
|
+
throw new Error("Failed to create canvas");
|
|
3366
|
+
}
|
|
3367
|
+
if (typeof context.setTransform === "function") {
|
|
3368
|
+
context.setTransform(1, 0, 0, 1, padding, padding);
|
|
3369
|
+
} else {
|
|
3370
|
+
context.translate(padding, padding);
|
|
3371
|
+
}
|
|
3372
|
+
return canvas;
|
|
3373
|
+
}
|
|
3374
|
+
cropCanvas(source, target) {
|
|
3375
|
+
const ctx = target.getContext("2d");
|
|
3376
|
+
if (ctx) {
|
|
3377
|
+
ctx.drawImage(
|
|
3378
|
+
source,
|
|
3379
|
+
VECTOR_TILE_RENDER_PADDING,
|
|
3380
|
+
VECTOR_TILE_RENDER_PADDING,
|
|
3381
|
+
// position in source
|
|
3382
|
+
VECTOR_TILE_SIZE,
|
|
3383
|
+
VECTOR_TILE_SIZE,
|
|
3384
|
+
// size in source
|
|
3385
|
+
0,
|
|
3386
|
+
0,
|
|
3387
|
+
// position in target
|
|
3388
|
+
VECTOR_TILE_SIZE,
|
|
3389
|
+
VECTOR_TILE_SIZE
|
|
3390
|
+
// size in target
|
|
3391
|
+
);
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3336
3394
|
getJsonTile(z, x, y, token, callback) {
|
|
3337
3395
|
let maximumIndex = Math.pow(2, z);
|
|
3338
3396
|
x = (x + 16 * maximumIndex) % maximumIndex;
|
|
3339
3397
|
y = (y + 16 * maximumIndex) % maximumIndex;
|
|
3340
|
-
let
|
|
3341
|
-
|
|
3342
|
-
canvas.height = 256;
|
|
3398
|
+
let resultCanvas = this.createCanvas(VECTOR_TILE_SIZE, 0);
|
|
3399
|
+
let tempCanvas = this.createCanvas(VECTOR_TILE_SIZE, VECTOR_TILE_RENDER_PADDING);
|
|
3343
3400
|
let baseMapUrl = this.resolveTileUrl(z, x, y);
|
|
3344
3401
|
let urls = baseMapUrl ? [baseMapUrl] : [];
|
|
3345
3402
|
this._additionalUrls.forEach((it) => {
|
|
@@ -3348,13 +3405,14 @@ class VectorTileFactory {
|
|
|
3348
3405
|
);
|
|
3349
3406
|
});
|
|
3350
3407
|
let tileLoadedSuccessfullyCallback = (json) => {
|
|
3351
|
-
this.drawTile(json, z, x, y,
|
|
3408
|
+
this.drawTile(json, z, x, y, tempCanvas);
|
|
3409
|
+
this.cropCanvas(tempCanvas, resultCanvas);
|
|
3352
3410
|
if (callback) {
|
|
3353
|
-
callback(
|
|
3411
|
+
callback(resultCanvas);
|
|
3354
3412
|
}
|
|
3355
3413
|
};
|
|
3356
3414
|
let tile_FailedCallback = () => {
|
|
3357
|
-
this.drawErroredTile(
|
|
3415
|
+
this.drawErroredTile(resultCanvas);
|
|
3358
3416
|
if (callback) {
|
|
3359
3417
|
callback(null);
|
|
3360
3418
|
}
|
|
@@ -3367,7 +3425,7 @@ class VectorTileFactory {
|
|
|
3367
3425
|
if (VectorTileFactory._fonts === "active") {
|
|
3368
3426
|
this._tileLoader.loadNext();
|
|
3369
3427
|
}
|
|
3370
|
-
return
|
|
3428
|
+
return resultCanvas;
|
|
3371
3429
|
}
|
|
3372
3430
|
/**
|
|
3373
3431
|
* @private
|
|
@@ -4588,6 +4646,7 @@ const RENDERING_CONFIG_GRAYSCALE = {
|
|
|
4588
4646
|
class MapReleaseFetcher {
|
|
4589
4647
|
_token;
|
|
4590
4648
|
_tomtom = null;
|
|
4649
|
+
_orbis = null;
|
|
4591
4650
|
_osm = null;
|
|
4592
4651
|
_here = null;
|
|
4593
4652
|
constructor(token) {
|
|
@@ -4597,24 +4656,31 @@ class MapReleaseFetcher {
|
|
|
4597
4656
|
if (provider === "tomtom") {
|
|
4598
4657
|
if (!this._tomtom) {
|
|
4599
4658
|
const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=TomTom_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
4600
|
-
this._tomtom = this.fetchAndExtractRelease(url);
|
|
4659
|
+
this._tomtom = this.fetchAndExtractRelease(provider, url);
|
|
4601
4660
|
}
|
|
4602
4661
|
return this._tomtom;
|
|
4662
|
+
}
|
|
4663
|
+
if (provider === "orbis") {
|
|
4664
|
+
if (!this._orbis) {
|
|
4665
|
+
const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=Orbis_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
4666
|
+
this._orbis = this.fetchAndExtractRelease(provider, url);
|
|
4667
|
+
}
|
|
4668
|
+
return this._orbis;
|
|
4603
4669
|
} else if (provider === "here") {
|
|
4604
4670
|
if (!this._here) {
|
|
4605
4671
|
const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=HERE_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
4606
|
-
this._here = this.fetchAndExtractRelease(url);
|
|
4672
|
+
this._here = this.fetchAndExtractRelease(provider, url);
|
|
4607
4673
|
}
|
|
4608
4674
|
return this._here;
|
|
4609
4675
|
} else if (provider === "openstreetmap") {
|
|
4610
4676
|
if (!this._osm) {
|
|
4611
4677
|
const url = "https://v1.maptrip.de/?CMD=GETFILE&PROJECT=OSM_latest&RELATIVEPATH=/data/mapset/data/routing_geocoder/admin.bin&acao=true";
|
|
4612
|
-
this._osm = this.fetchAndExtractRelease(url);
|
|
4678
|
+
this._osm = this.fetchAndExtractRelease(provider, url);
|
|
4613
4679
|
}
|
|
4614
4680
|
return this._osm;
|
|
4615
4681
|
}
|
|
4616
4682
|
}
|
|
4617
|
-
async fetchAndExtractRelease(url) {
|
|
4683
|
+
async fetchAndExtractRelease(provider, url) {
|
|
4618
4684
|
return new Promise((resolve, reject) => {
|
|
4619
4685
|
var xhr = new XMLHttpRequest();
|
|
4620
4686
|
xhr.onreadystatechange = () => {
|
|
@@ -4623,7 +4689,7 @@ class MapReleaseFetcher {
|
|
|
4623
4689
|
const text = new TextDecoder("latin1").decode(xhr.response);
|
|
4624
4690
|
const textString = this.extractTargetString(text);
|
|
4625
4691
|
const formattedString = textString.split("Q").join(" Q");
|
|
4626
|
-
const release = ` ${formattedString}`;
|
|
4692
|
+
const release = ` ${PROVIDER_NAMES[provider]} ${formattedString}`;
|
|
4627
4693
|
resolve(release);
|
|
4628
4694
|
} else {
|
|
4629
4695
|
reject(`Error fetching: ${xhr.status}`);
|
|
@@ -19264,10 +19330,12 @@ class MapTripLeafletGridLayer extends L$1.GridLayer {
|
|
|
19264
19330
|
const eventProvider = event.layer.options.provider;
|
|
19265
19331
|
let newProvider;
|
|
19266
19332
|
if (eventProvider) {
|
|
19267
|
-
if (eventProvider.toLowerCase() === "
|
|
19333
|
+
if (eventProvider.toLowerCase() === "openstreetmap") {
|
|
19268
19334
|
newProvider = "openstreetmap";
|
|
19269
19335
|
} else if (eventProvider.toLowerCase() === "tomtom") {
|
|
19270
19336
|
newProvider = "tomtom";
|
|
19337
|
+
} else if (eventProvider.toLowerCase() === "orbis") {
|
|
19338
|
+
newProvider = "orbis";
|
|
19271
19339
|
} else if (eventProvider.toLowerCase() === "here") {
|
|
19272
19340
|
newProvider = "here";
|
|
19273
19341
|
} else {
|
|
@@ -21941,7 +22009,7 @@ function getPointResolution(projection, resolution, point, units) {
|
|
|
21941
22009
|
pointResolution = getter(resolution, point);
|
|
21942
22010
|
} else {
|
|
21943
22011
|
const projUnits = projection.getUnits();
|
|
21944
|
-
if ((projUnits == 'degrees' &&
|
|
22012
|
+
if ((projUnits == 'degrees' && !units) || units == 'degrees') {
|
|
21945
22013
|
pointResolution = resolution;
|
|
21946
22014
|
} else {
|
|
21947
22015
|
// Estimate point resolution by transforming the center pixel to EPSG:4326,
|