mapcachetools 2.2.4 → 2.2.6

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.
@@ -98,10 +98,11 @@ function fn_convertFromLngLatToPoints(lat1, lng1, lat2, lng2, zoom) {
98
98
  point2.x = Math.floor(point2.x / 256);
99
99
  point2.y = Math.floor(point2.y / 256);
100
100
 
101
- // Ensure point1 is top-left, point2 bottom-right
102
- if (point1.y > point2.y) [point1.y, point2.y] = [point2.y, point1.y];
103
-
104
- return [point1, point2];
101
+ // Ensure point1 is top-left (min x, min y), point2 is bottom-right (max x, max y)
102
+ return [
103
+ { x: Math.min(point1.x, point2.x), y: Math.min(point1.y, point2.y) },
104
+ { x: Math.max(point1.x, point2.x), y: Math.max(point1.y, point2.y) }
105
+ ];
105
106
  }
106
107
 
107
108
  /* ============================================================
@@ -151,6 +152,7 @@ function getTileUrlAndFilename(i, j, zoom) {
151
152
  typePrefix = "terrain";
152
153
  } else if (map_provider == 3) {
153
154
  url = `https://tiles.stadiamaps.com/tiles/alidade_satellite/${zoom}/${i}/${j}.jpg?api_key=${TOKEN}`;
155
+ typePrefix = "stadiamaps";
154
156
  } else {
155
157
  // OpenStreetMap
156
158
  url = `https://tile.openstreetmap.org/${zoom}/${i}/${j}.png`;
@@ -268,7 +270,7 @@ function fn_handle_arguments() {
268
270
 
269
271
  // Provider and token
270
272
  map_provider = myArgs.provider ? parseInt(myArgs.provider) : DEFAULT_PROVIDER;
271
- if (map_provider === 1 || map_provider === 2) {
273
+ if (map_provider === 1 || map_provider === 2 || map_provider === 3) {
272
274
  TOKEN = myArgs.token;
273
275
  if (!TOKEN) {
274
276
  error = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapcachetools",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "A Node.js tool to download and cache map tiles (OSM, Mapbox Satellite, Mapbox Terrain RGB) as PNG images for offline use in mapping applications. Use at your own risk and comply with provider terms.",
5
5
  "main": "bin/mapcache_download.js",
6
6
  "bin": {