From 8c011b481a2a5b440d8b96ba8842c4bbeca3cebf Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Sat, 19 Aug 2023 13:53:12 -0500 Subject: [PATCH] Add Sprint/AT&T coverage layers --- layers/cellular.js | 127 +++++++++++++++++++++++++++++++++++++++++++++ layers/index.js | 2 + 2 files changed, 129 insertions(+) create mode 100644 layers/cellular.js diff --git a/layers/cellular.js b/layers/cellular.js new file mode 100644 index 0000000..90481be --- /dev/null +++ b/layers/cellular.js @@ -0,0 +1,127 @@ +import { XYZ } from 'ol/source.js'; +import TileLayer from 'ol/layer/Tile'; + +// from https://stackoverflow.com/q/32454234 +var quadkey = function (x, y, z) { + var quadKey = []; + for (var i = z; i > 0; i--) { + var digit = '0'; + var mask = 1 << (i - 1); + if ((x & mask) != 0) { + digit++; + } + if ((y & mask) != 0) { + digit++; + digit++; + } + quadKey.push(digit); + } + return quadKey.join(''); +}; + +const cellular_layers = { + name: "Cellular Providers", + layers: [ + // { + // name: "Verizon", + // // enabled: true, + // layer: new VectorTileLayer({ + // source: new VectorTileSource({ + // format: new MVT(), + // // https://api.mapbox.com/v4/gismaps.3knn09ds,gismaps.2x81tn8t,mapbox.mapbox-streets-v8,gismaps.aq7mk519,mapbox.country-boundaries-v1,gismaps.cbihlc9h,gismaps.7is2087g,gismaps.8hjkv530/7/31/46.vector.pbf + // // url: 'https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/{z}/{y}/{x}.pbf', + // url: 'https://api.mapbox.com/v4/gismaps.3knn09ds,gismaps.2x81tn8t,mapbox.mapbox-streets-v8,gismaps.aq7mk519,mapbox.country-boundaries-v1,gismaps.cbihlc9h,gismaps.7is2087g,gismaps.8hjkv530/{z}/{y}/{x}.pbf' + // }), + // }), + // }, + { + name: "AT&T Domestic", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]; + var x = tileCoord[1]; + var y = tileCoord[2]; + return "https://geolink-igw.cloud.att.com/mapservice/quadkeytile?layer=attDomestic&quadkey=" + quadkey(x, y, z); + }, + }), + }), + }, + { + name: "AT&T Prepaid", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]; + var x = tileCoord[1]; + var y = tileCoord[2]; + return "https://geolink-igw.cloud.att.com/mapservice/quadkeytile?layer=attPrepaid&quadkey=" + quadkey(x, y, z); + }, + }), + }), + }, + { + name: "AT&T International", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]; + var x = tileCoord[1]; + var y = tileCoord[2]; + return "https://geolink-igw.cloud.att.com/mapservice/quadkeytile?layer=attIntl&quadkey=" + quadkey(x, y, z); + }, + }), + }), + }, + { + name: "Sprint 5G? (may also be T-Mo now); see Sprint for legends", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + // url: 'https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_5G/{z}/{x}:{y}/tile.png' + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]+1; + var x = tileCoord[1]+1; + var y = tileCoord[2]+1; + return `https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_5G/${z}/${x}:${y}/tile.png`; + }, + }), + }), + }, + { + name: "Sprint LTE? (may also be T-Mo now)", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + // url: 'https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_lte/{z}/{x}:{y}/tile.png' + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]+1; + var x = tileCoord[1]+1; + var y = tileCoord[2]+1; + return `https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_lte/${z}/${x}:${y}/tile.png`; + }, + }), + }), + }, + { + name: "Sprint non-LTE? (may also be T-Mo now)", + layer: new TileLayer({ + opacity: 0.5, + source: new XYZ({ + // url: 'https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_5G/{z}/{x}:{y}/tile.png' + tileUrlFunction: function (tileCoord, pixelRatio, projection) { + var z = tileCoord[0]+1; + var x = tileCoord[1]+1; + var y = tileCoord[2]+1; + return `https://coverage.sprint.com/MapTile/5GDataMap/Tiles/data_xp_3G/${z}/${x}:${y}/tile.png`; + }, + }), + }), + }, + ], +}; + +export default cellular_layers; diff --git a/layers/index.js b/layers/index.js index eef17c8..674c962 100644 --- a/layers/index.js +++ b/layers/index.js @@ -10,6 +10,7 @@ import chains from './chains/index.js'; import census_bureau from './census-bureau/index.js'; import states from './states/index.js'; import national_land from './national-land/index.js'; +import cellular from './cellular.js'; const layerCategories = [ { // Base maps @@ -77,6 +78,7 @@ const layerCategories = [ census_bureau, states, national_land, + cellular, ]; export default layerCategories;