From 371c3bad16e85ae06a2b8bd5b0ec240d02f1119f Mon Sep 17 00:00:00 2001 From: Lenny Date: Fri, 23 Mar 2018 08:39:11 -0500 Subject: [PATCH] @types\mapbox-gl Change RasterSource URL to optional. --- types/mapbox-gl/index.d.ts | 2 +- types/mapbox-gl/mapbox-gl-tests.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index a51172daec..24dca985e4 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -610,7 +610,7 @@ declare namespace mapboxgl { interface RasterSource extends Source { type: 'raster'; - url: string; + url?: string; tiles?: string[]; minzoom?: number; maxzoom?: number; diff --git a/types/mapbox-gl/mapbox-gl-tests.ts b/types/mapbox-gl/mapbox-gl-tests.ts index 422cb3913d..ce10a26564 100644 --- a/types/mapbox-gl/mapbox-gl-tests.ts +++ b/types/mapbox-gl/mapbox-gl-tests.ts @@ -205,6 +205,22 @@ var videoSourceObj = new mapboxgl.VideoSource({ map.addSource('some id', videoSourceObj); // add map.removeSource('some id'); // remove +/** + * Add Raster Source /// made URL optional to allow only tiles. + */ +map.addSource('radar', { + type: 'raster', + tiles: ['https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WmsServer?bbox={bbox-epsg-3857}&service=WMS&request=GetMap&version=1.3.0&layers=1&styles=&format=image/png&transparent=true&height=256&width=256&crs=EPSG:3857'], + tileSize: 256 +}) + +map.addLayer({ + id: 'radar', + type: 'raster', + source: 'radar', + paint: {} +}) + /** * Popup */