diff --git a/packages/base/layer_gallery.json b/packages/base/layer_gallery.json new file mode 100644 index 000000000..20f9a62e8 --- /dev/null +++ b/packages/base/layer_gallery.json @@ -0,0 +1,792 @@ +{ + "OpenStreetMap": { + "Mapnik": { + "thumbnailPath": "layer_gallery/OpenStreetMap-Mapnik.png", + "name": "OpenStreetMap.Mapnik", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors" + }, + "BZH": { + "thumbnailPath": "layer_gallery/OpenStreetMap-BZH.png", + "name": "OpenStreetMap.BZH", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team" + }, + "CAT": { + "thumbnailPath": "layer_gallery/OpenStreetMap-CAT.png", + "name": "OpenStreetMap.CAT", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.openstreetmap.bzh/ca/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team" + }, + "CH": { + "thumbnailPath": "layer_gallery/OpenStreetMap-CH.png", + "name": "OpenStreetMap.CH", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.osm.ch/switzerland/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors" + }, + "DE": { + "thumbnailPath": "layer_gallery/OpenStreetMap-DE.png", + "name": "OpenStreetMap.DE", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.openstreetmap.de/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors" + }, + "France": { + "thumbnailPath": "layer_gallery/OpenStreetMap-France.png", + "name": "OpenStreetMap.France", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap France | (C) OpenStreetMap contributors", + "maxZoom": 20, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap France | (C) OpenStreetMap contributors" + }, + "HOT": { + "thumbnailPath": "layer_gallery/OpenStreetMap-HOT.png", + "name": "OpenStreetMap.HOT", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", + "attribution": "(C) OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "(C) OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France" + } + }, + "NASAGIBS": { + "ModisTerraTrueColorCR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraTrueColorCR.png", + "name": "NASAGIBS.ModisTerraTrueColorCR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 1, + "urlParameters": { + "maxZoom": 9, + "variant": "MODIS_Terra_CorrectedReflectance_TrueColor", + "time": "2026-02-02", + "format": "jpg", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraBands367CR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraBands367CR.png", + "name": "NASAGIBS.ModisTerraBands367CR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 1, + "urlParameters": { + "maxZoom": 9, + "variant": "MODIS_Terra_CorrectedReflectance_Bands367", + "time": "2026-02-02", + "format": "jpg", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ViirsEarthAtNight2012": { + "thumbnailPath": "layer_gallery/NASAGIBS-ViirsEarthAtNight2012.png", + "name": "NASAGIBS.ViirsEarthAtNight2012", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 8, + "minZoom": 1, + "urlParameters": { + "maxZoom": 8, + "variant": "VIIRS_CityLights_2012", + "time": "2026-02-02", + "format": "jpg", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraLSTDay": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraLSTDay.png", + "name": "NASAGIBS.ModisTerraLSTDay", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 7, + "minZoom": 1, + "urlParameters": { + "maxZoom": 7, + "variant": "MODIS_Terra_Land_Surface_Temp_Day", + "time": "2026-02-02", + "format": "png", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraSnowCover": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraSnowCover.png", + "name": "NASAGIBS.ModisTerraSnowCover", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 8, + "minZoom": 1, + "urlParameters": { + "maxZoom": 8, + "variant": "MODIS_Terra_NDSI_Snow_Cover", + "time": "2026-02-02", + "format": "png", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraAOD": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraAOD.png", + "name": "NASAGIBS.ModisTerraAOD", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 6, + "minZoom": 1, + "urlParameters": { + "maxZoom": 6, + "variant": "MODIS_Terra_Aerosol", + "time": "2026-02-02", + "format": "png", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraChlorophyll": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraChlorophyll.png", + "name": "NASAGIBS.ModisTerraChlorophyll", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 7, + "minZoom": 1, + "urlParameters": { + "maxZoom": 7, + "variant": "MODIS_Terra_L2_Chlorophyll_A", + "time": "2026-02-02", + "format": "png", + "tilematrixset": "GoogleMapsCompatible_Level" + } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisTerraBands721CR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisTerraBands721CR.png", + "name": "NASAGIBS.ModisTerraBands721CR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_Bands721/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 0, + "urlParameters": { "time": "2026-02-02" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisAquaTrueColorCR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisAquaTrueColorCR.png", + "name": "NASAGIBS.ModisAquaTrueColorCR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_TrueColor/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 0, + "urlParameters": { "time": "2026-02-02" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ModisAquaBands721CR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ModisAquaBands721CR.png", + "name": "NASAGIBS.ModisAquaBands721CR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_Bands721/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 0, + "urlParameters": { "time": "2026-02-02" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ViirsTrueColorCR": { + "thumbnailPath": "layer_gallery/NASAGIBS-ViirsTrueColorCR.png", + "name": "NASAGIBS.ViirsTrueColorCR", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 9, + "minZoom": 0, + "urlParameters": { "time": "2026-02-02" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + }, + "ASTER_GDEM_Greyscale_Shaded_Relief": { + "thumbnailPath": "layer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png", + "name": "NASAGIBS.ASTER_GDEM_Greyscale_Shaded_Relief", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/ASTER_GDEM_Greyscale_Shaded_Relief/default/GoogleMapsCompatible_Level12/{z}/{y}/{x}.jpg", + "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", + "maxZoom": 12, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ." + } + }, + "WaymarkedTrails": { + "hiking": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-hiking.png", + "name": "WaymarkedTrails.hiking", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "hiking" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + }, + "cycling": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-cycling.png", + "name": "WaymarkedTrails.cycling", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "cycling" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + }, + "mtb": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-mtb.png", + "name": "WaymarkedTrails.mtb", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "mtb" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + }, + "slopes": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-slopes.png", + "name": "WaymarkedTrails.slopes", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "slopes" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + }, + "riding": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-riding.png", + "name": "WaymarkedTrails.riding", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "riding" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + }, + "skating": { + "thumbnailPath": "layer_gallery/WaymarkedTrails-skating.png", + "name": "WaymarkedTrails.skating", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": { "variant": "skating" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)" + } + }, + "USGS": { + "USTopo": { + "thumbnailPath": "layer_gallery/USGS-USTopo.png", + "name": "USGS.USTopo", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles courtesy of the U.S. Geological Survey", + "maxZoom": 20, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles courtesy of the U.S. Geological Survey" + }, + "USImagery": { + "thumbnailPath": "layer_gallery/USGS-USImagery.png", + "name": "USGS.USImagery", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles courtesy of the U.S. Geological Survey", + "maxZoom": 20, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles courtesy of the U.S. Geological Survey" + }, + "USImageryTopo": { + "thumbnailPath": "layer_gallery/USGS-USImageryTopo.png", + "name": "USGS.USImageryTopo", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles courtesy of the U.S. Geological Survey", + "maxZoom": 20, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles courtesy of the U.S. Geological Survey" + } + }, + "Gaode": { + "Normal": { + "thumbnailPath": "layer_gallery/Gaode-Normal.png", + "name": "Gaode.Normal", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}", + "attribution": "© Gaode.com", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "© Gaode.com" + }, + "Satellite": { + "thumbnailPath": "layer_gallery/Gaode-Satellite.png", + "name": "Gaode.Satellite", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", + "attribution": "© Gaode.com", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "© Gaode.com" + } + }, + "Strava": { + "All": { + "thumbnailPath": "layer_gallery/Strava-All.png", + "name": "Strava.All", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://heatmap-external-a.strava.com/tiles/all/hot/{z}/{x}/{y}.png", + "attribution": "Map tiles by Strava 2021", + "maxZoom": 15, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Map tiles by Strava 2021" + }, + "Ride": { + "thumbnailPath": "layer_gallery/Strava-Ride.png", + "name": "Strava.Ride", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://heatmap-external-a.strava.com/tiles/ride/hot/{z}/{x}/{y}.png", + "attribution": "Map tiles by Strava 2021", + "maxZoom": 15, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Map tiles by Strava 2021" + }, + "Run": { + "thumbnailPath": "layer_gallery/Strava-Run.png", + "name": "Strava.Run", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://heatmap-external-a.strava.com/tiles/run/bluered/{z}/{x}/{y}.png", + "attribution": "Map tiles by Strava 2021", + "maxZoom": 15, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Map tiles by Strava 2021" + }, + "Water": { + "thumbnailPath": "layer_gallery/Strava-Water.png", + "name": "Strava.Water", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://heatmap-external-a.strava.com/tiles/water/blue/{z}/{x}/{y}.png", + "attribution": "Map tiles by Strava 2021", + "maxZoom": 15, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Map tiles by Strava 2021" + }, + "Winter": { + "thumbnailPath": "layer_gallery/Strava-Winter.png", + "name": "Strava.Winter", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://heatmap-external-a.strava.com/tiles/winter/hot/{z}/{x}/{y}.png", + "attribution": "Map tiles by Strava 2021", + "maxZoom": 15, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "Map tiles by Strava 2021" + } + }, + "OPNVKarte": { + "thumbnailPath": "layer_gallery/OPNVKarte.png", + "name": "OPNVKarte", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png", + "attribution": "Map memomaps.de CC-BY-SA, map data (C) OpenStreetMap contributors", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": "https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png" + }, + "layerParameters": { "opacity": 1 } + }, + "OpenTopoMap": { + "thumbnailPath": "layer_gallery/OpenTopoMap.png", + "name": "OpenTopoMap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)", + "maxZoom": 17, + "minZoom": 0, + "urlParameters": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png" + }, + "layerParameters": { "opacity": 1 } + }, + "OpenRailwayMap": { + "thumbnailPath": "layer_gallery/OpenRailwayMap.png", + "name": "OpenRailwayMap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png", + "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) OpenRailwayMap (CC-BY-SA)", + "maxZoom": 19, + "minZoom": 0, + "urlParameters": "https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png" + }, + "layerParameters": { "opacity": 1 } + }, + "Esri": { + "WorldStreetMap": { + "thumbnailPath": "layer_gallery/Esri-WorldStreetMap.png", + "name": "Esri.WorldStreetMap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012", + "maxZoom": null, + "minZoom": 0, + "urlParameters": { "variant": "World_Street_Map" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012" + }, + "WorldTopoMap": { + "thumbnailPath": "layer_gallery/Esri-WorldTopoMap.png", + "name": "Esri.WorldTopoMap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community", + "maxZoom": null, + "minZoom": 0, + "urlParameters": { "variant": "World_Topo_Map" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community" + }, + "WorldImagery": { + "thumbnailPath": "layer_gallery/Esri-WorldImagery.png", + "name": "Esri.WorldImagery", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", + "maxZoom": null, + "minZoom": 0, + "urlParameters": { "variant": "World_Imagery" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community" + }, + "WorldTerrain": { + "thumbnailPath": "layer_gallery/Esri-WorldTerrain.png", + "name": "Esri.WorldTerrain", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Source: USGS, Esri, TANA, DeLorme, and NPS", + "maxZoom": 13, + "minZoom": 0, + "urlParameters": { "variant": "World_Terrain_Base" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Source: USGS, Esri, TANA, DeLorme, and NPS" + }, + "WorldShadedRelief": { + "thumbnailPath": "layer_gallery/Esri-WorldShadedRelief.png", + "name": "Esri.WorldShadedRelief", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Source: Esri", + "maxZoom": 13, + "minZoom": 0, + "urlParameters": { "variant": "World_Shaded_Relief" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Source: Esri" + }, + "WorldPhysical": { + "thumbnailPath": "layer_gallery/Esri-WorldPhysical.png", + "name": "Esri.WorldPhysical", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Source: US National Park Service", + "maxZoom": 8, + "minZoom": 0, + "urlParameters": { "variant": "World_Physical_Map" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Source: US National Park Service" + }, + "OceanBasemap": { + "thumbnailPath": "layer_gallery/Esri-OceanBasemap.png", + "name": "Esri.OceanBasemap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri", + "maxZoom": 13, + "minZoom": 0, + "urlParameters": { "variant": "Ocean/World_Ocean_Base" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri" + }, + "NatGeoWorldMap": { + "thumbnailPath": "layer_gallery/Esri-NatGeoWorldMap.png", + "name": "Esri.NatGeoWorldMap", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC", + "maxZoom": 16, + "minZoom": 0, + "urlParameters": { "variant": "NatGeo_World_Map" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC" + }, + "WorldGrayCanvas": { + "thumbnailPath": "layer_gallery/Esri-WorldGrayCanvas.png", + "name": "Esri.WorldGrayCanvas", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", + "attribution": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ", + "maxZoom": 16, + "minZoom": 0, + "urlParameters": { "variant": "Canvas/World_Light_Gray_Base" } + }, + "layerParameters": { "opacity": 1 }, + "description": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ" + } + }, + "MacroStrat": { + "CartoRaster": { + "thumbnailPath": "layer_gallery/MacroStrat-CartoRaster.png", + "name": "MacroStrat.CartoRaster", + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "sourceParameters": { + "url": "https://tiles.macrostrat.org/carto/{z}/{x}/{y}.png", + "attribution": "\u00a9 Geologic data \u00a9 Macrostrat raster layer (CC\u2011BY 4.0)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "\u00a9 Geologic data \u00a9 Macrostrat raster layer (CC\u2011BY 4.0)" + }, + "CartoVector": { + "thumbnailPath": "layer_gallery/MacroStrat-CartoVector.png", + "name": "MacroStrat.CartoVector", + "layerType": "VectorTileLayer", + "sourceType": "VectorTileSource", + "sourceParameters": { + "url": "https://tiles.macrostrat.org/carto/{z}/{x}/{y}.mvt", + "attribution": "\u00a9 Geologic data \u00a9 Macrostrat vector layer (CC\u2011BY 4.0)", + "maxZoom": 18, + "minZoom": 0, + "urlParameters": {} + }, + "layerParameters": { "opacity": 1 }, + "description": "\u00a9 Geologic data \u00a9 Macrostrat vector layer (CC\u2011BY 4.0)" + } + } +} diff --git a/packages/base/rasterlayer_gallery/Esri-NatGeoWorldMap.png b/packages/base/layer_gallery/Esri-NatGeoWorldMap.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-NatGeoWorldMap.png rename to packages/base/layer_gallery/Esri-NatGeoWorldMap.png diff --git a/packages/base/rasterlayer_gallery/Esri-OceanBasemap.png b/packages/base/layer_gallery/Esri-OceanBasemap.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-OceanBasemap.png rename to packages/base/layer_gallery/Esri-OceanBasemap.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldGrayCanvas.png b/packages/base/layer_gallery/Esri-WorldGrayCanvas.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldGrayCanvas.png rename to packages/base/layer_gallery/Esri-WorldGrayCanvas.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldImagery.png b/packages/base/layer_gallery/Esri-WorldImagery.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldImagery.png rename to packages/base/layer_gallery/Esri-WorldImagery.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldPhysical.png b/packages/base/layer_gallery/Esri-WorldPhysical.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldPhysical.png rename to packages/base/layer_gallery/Esri-WorldPhysical.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldShadedRelief.png b/packages/base/layer_gallery/Esri-WorldShadedRelief.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldShadedRelief.png rename to packages/base/layer_gallery/Esri-WorldShadedRelief.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldStreetMap.png b/packages/base/layer_gallery/Esri-WorldStreetMap.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldStreetMap.png rename to packages/base/layer_gallery/Esri-WorldStreetMap.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldTerrain.png b/packages/base/layer_gallery/Esri-WorldTerrain.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldTerrain.png rename to packages/base/layer_gallery/Esri-WorldTerrain.png diff --git a/packages/base/rasterlayer_gallery/Esri-WorldTopoMap.png b/packages/base/layer_gallery/Esri-WorldTopoMap.png similarity index 100% rename from packages/base/rasterlayer_gallery/Esri-WorldTopoMap.png rename to packages/base/layer_gallery/Esri-WorldTopoMap.png diff --git a/packages/base/rasterlayer_gallery/Gaode-Normal.png b/packages/base/layer_gallery/Gaode-Normal.png similarity index 100% rename from packages/base/rasterlayer_gallery/Gaode-Normal.png rename to packages/base/layer_gallery/Gaode-Normal.png diff --git a/packages/base/rasterlayer_gallery/Gaode-Satellite.png b/packages/base/layer_gallery/Gaode-Satellite.png similarity index 100% rename from packages/base/rasterlayer_gallery/Gaode-Satellite.png rename to packages/base/layer_gallery/Gaode-Satellite.png diff --git a/packages/base/rasterlayer_gallery/MacroStrat-CartoRaster.png b/packages/base/layer_gallery/MacroStrat-CartoRaster.png similarity index 100% rename from packages/base/rasterlayer_gallery/MacroStrat-CartoRaster.png rename to packages/base/layer_gallery/MacroStrat-CartoRaster.png diff --git a/packages/base/layer_gallery/MacroStrat-CartoVector.png b/packages/base/layer_gallery/MacroStrat-CartoVector.png new file mode 100644 index 000000000..0e63decd3 Binary files /dev/null and b/packages/base/layer_gallery/MacroStrat-CartoVector.png differ diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png b/packages/base/layer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png rename to packages/base/layer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisAquaBands721CR.png b/packages/base/layer_gallery/NASAGIBS-ModisAquaBands721CR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisAquaBands721CR.png rename to packages/base/layer_gallery/NASAGIBS-ModisAquaBands721CR.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisAquaTrueColorCR.png b/packages/base/layer_gallery/NASAGIBS-ModisAquaTrueColorCR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisAquaTrueColorCR.png rename to packages/base/layer_gallery/NASAGIBS-ModisAquaTrueColorCR.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraAOD.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraAOD.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraAOD.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraAOD.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraBands367CR.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraBands367CR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraBands367CR.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraBands367CR.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraBands721CR.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraBands721CR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraBands721CR.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraBands721CR.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraChlorophyll.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraChlorophyll.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraChlorophyll.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraChlorophyll.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraLSTDay.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraLSTDay.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraLSTDay.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraLSTDay.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraSnowCover.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraSnowCover.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraSnowCover.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraSnowCover.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraTrueColorCR.png b/packages/base/layer_gallery/NASAGIBS-ModisTerraTrueColorCR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ModisTerraTrueColorCR.png rename to packages/base/layer_gallery/NASAGIBS-ModisTerraTrueColorCR.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ViirsEarthAtNight2012.png b/packages/base/layer_gallery/NASAGIBS-ViirsEarthAtNight2012.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ViirsEarthAtNight2012.png rename to packages/base/layer_gallery/NASAGIBS-ViirsEarthAtNight2012.png diff --git a/packages/base/rasterlayer_gallery/NASAGIBS-ViirsTrueColorCR.png b/packages/base/layer_gallery/NASAGIBS-ViirsTrueColorCR.png similarity index 100% rename from packages/base/rasterlayer_gallery/NASAGIBS-ViirsTrueColorCR.png rename to packages/base/layer_gallery/NASAGIBS-ViirsTrueColorCR.png diff --git a/packages/base/layer_gallery/NaturalEarth-Countries.png b/packages/base/layer_gallery/NaturalEarth-Countries.png new file mode 100644 index 000000000..4150f368e Binary files /dev/null and b/packages/base/layer_gallery/NaturalEarth-Countries.png differ diff --git a/packages/base/rasterlayer_gallery/OPNVKarte.png b/packages/base/layer_gallery/OPNVKarte.png similarity index 100% rename from packages/base/rasterlayer_gallery/OPNVKarte.png rename to packages/base/layer_gallery/OPNVKarte.png diff --git a/packages/base/rasterlayer_gallery/OpenRailwayMap.png b/packages/base/layer_gallery/OpenRailwayMap.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenRailwayMap.png rename to packages/base/layer_gallery/OpenRailwayMap.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-BZH.png b/packages/base/layer_gallery/OpenStreetMap-BZH.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-BZH.png rename to packages/base/layer_gallery/OpenStreetMap-BZH.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-CAT.png b/packages/base/layer_gallery/OpenStreetMap-CAT.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-CAT.png rename to packages/base/layer_gallery/OpenStreetMap-CAT.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-CH.png b/packages/base/layer_gallery/OpenStreetMap-CH.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-CH.png rename to packages/base/layer_gallery/OpenStreetMap-CH.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-DE.png b/packages/base/layer_gallery/OpenStreetMap-DE.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-DE.png rename to packages/base/layer_gallery/OpenStreetMap-DE.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-France.png b/packages/base/layer_gallery/OpenStreetMap-France.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-France.png rename to packages/base/layer_gallery/OpenStreetMap-France.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-HOT.png b/packages/base/layer_gallery/OpenStreetMap-HOT.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-HOT.png rename to packages/base/layer_gallery/OpenStreetMap-HOT.png diff --git a/packages/base/rasterlayer_gallery/OpenStreetMap-Mapnik.png b/packages/base/layer_gallery/OpenStreetMap-Mapnik.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenStreetMap-Mapnik.png rename to packages/base/layer_gallery/OpenStreetMap-Mapnik.png diff --git a/packages/base/rasterlayer_gallery/OpenTopoMap.png b/packages/base/layer_gallery/OpenTopoMap.png similarity index 100% rename from packages/base/rasterlayer_gallery/OpenTopoMap.png rename to packages/base/layer_gallery/OpenTopoMap.png diff --git a/packages/base/rasterlayer_gallery/Strava-All.png b/packages/base/layer_gallery/Strava-All.png similarity index 100% rename from packages/base/rasterlayer_gallery/Strava-All.png rename to packages/base/layer_gallery/Strava-All.png diff --git a/packages/base/rasterlayer_gallery/Strava-Ride.png b/packages/base/layer_gallery/Strava-Ride.png similarity index 100% rename from packages/base/rasterlayer_gallery/Strava-Ride.png rename to packages/base/layer_gallery/Strava-Ride.png diff --git a/packages/base/rasterlayer_gallery/Strava-Run.png b/packages/base/layer_gallery/Strava-Run.png similarity index 100% rename from packages/base/rasterlayer_gallery/Strava-Run.png rename to packages/base/layer_gallery/Strava-Run.png diff --git a/packages/base/rasterlayer_gallery/Strava-Water.png b/packages/base/layer_gallery/Strava-Water.png similarity index 100% rename from packages/base/rasterlayer_gallery/Strava-Water.png rename to packages/base/layer_gallery/Strava-Water.png diff --git a/packages/base/rasterlayer_gallery/Strava-Winter.png b/packages/base/layer_gallery/Strava-Winter.png similarity index 100% rename from packages/base/rasterlayer_gallery/Strava-Winter.png rename to packages/base/layer_gallery/Strava-Winter.png diff --git a/packages/base/rasterlayer_gallery/USGS-USImagery.png b/packages/base/layer_gallery/USGS-USImagery.png similarity index 100% rename from packages/base/rasterlayer_gallery/USGS-USImagery.png rename to packages/base/layer_gallery/USGS-USImagery.png diff --git a/packages/base/rasterlayer_gallery/USGS-USImageryTopo.png b/packages/base/layer_gallery/USGS-USImageryTopo.png similarity index 100% rename from packages/base/rasterlayer_gallery/USGS-USImageryTopo.png rename to packages/base/layer_gallery/USGS-USImageryTopo.png diff --git a/packages/base/rasterlayer_gallery/USGS-USTopo.png b/packages/base/layer_gallery/USGS-USTopo.png similarity index 100% rename from packages/base/rasterlayer_gallery/USGS-USTopo.png rename to packages/base/layer_gallery/USGS-USTopo.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-cycling.png b/packages/base/layer_gallery/WaymarkedTrails-cycling.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-cycling.png rename to packages/base/layer_gallery/WaymarkedTrails-cycling.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-hiking.png b/packages/base/layer_gallery/WaymarkedTrails-hiking.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-hiking.png rename to packages/base/layer_gallery/WaymarkedTrails-hiking.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-mtb.png b/packages/base/layer_gallery/WaymarkedTrails-mtb.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-mtb.png rename to packages/base/layer_gallery/WaymarkedTrails-mtb.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-riding.png b/packages/base/layer_gallery/WaymarkedTrails-riding.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-riding.png rename to packages/base/layer_gallery/WaymarkedTrails-riding.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-skating.png b/packages/base/layer_gallery/WaymarkedTrails-skating.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-skating.png rename to packages/base/layer_gallery/WaymarkedTrails-skating.png diff --git a/packages/base/rasterlayer_gallery/WaymarkedTrails-slopes.png b/packages/base/layer_gallery/WaymarkedTrails-slopes.png similarity index 100% rename from packages/base/rasterlayer_gallery/WaymarkedTrails-slopes.png rename to packages/base/layer_gallery/WaymarkedTrails-slopes.png diff --git a/packages/base/rasterlayer_gallery/custom_raster.png b/packages/base/layer_gallery/custom_raster.png similarity index 100% rename from packages/base/rasterlayer_gallery/custom_raster.png rename to packages/base/layer_gallery/custom_raster.png diff --git a/packages/base/layer_gallery/thumbnail_config.json b/packages/base/layer_gallery/thumbnail_config.json new file mode 100644 index 000000000..54b1b0f1c --- /dev/null +++ b/packages/base/layer_gallery/thumbnail_config.json @@ -0,0 +1,530 @@ +{ + "OpenStreetMap": { + "Mapnik": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "BZH": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": { + "lat": 47.76702233051035, + "lng": -3.4675598144531254, + "zoom": 8 + }, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "CAT": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "CH": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": { + "lat": 46.8182, + "lng": 8.2275, + "zoom": 8 + }, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "DE": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": { + "lat": 51.1657, + "lng": 10.4515, + "zoom": 8 + }, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "France": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "HOT": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + } + }, + "NASAGIBS": { + "ModisTerraTrueColorCR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraBands367CR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ViirsEarthAtNight2012": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraLSTDay": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraSnowCover": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraAOD": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraChlorophyll": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisTerraBands721CR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisAquaTrueColorCR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ModisAquaBands721CR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ViirsTrueColorCR": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "ASTER_GDEM_Greyscale_Shaded_Relief": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + } + }, + "WaymarkedTrails": { + "hiking": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "cycling": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "mtb": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "slopes": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "riding": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "skating": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + } + }, + "USGS": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "Gaode": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "Strava": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + }, + "TileSize": 512 + } + }, + "OPNVKarte": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "OpenTopoMap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "OpenRailwayMap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + }, + "TileSize": 512 + } + }, + "Esri": { + "WorldStreetMap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldTopoMap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldImagery": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldTerrain": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldShadedRelief": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldPhysical": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "OceanBasemap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "NatGeoWorldMap": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + }, + "WorldGrayCanvas": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 37.7749, + "lng": -122.4194, + "zoom": 5 + } + } + } + }, + "MacroStrat": { + "CartoRaster": { + "layerType": "RasterLayer", + "sourceType": "RasterSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + }, + "CartoVector": { + "layerType": "VectorTileLayer", + "sourceType": "VectorTileSource", + "thumbnail": { + "Special Rules": {}, + "Default": { + "lat": 47.040182144806664, + "lng": 1.2963867187500002, + "zoom": 5 + } + } + } + } +} diff --git a/packages/base/layer_gallery_generator.py b/packages/base/layer_gallery_generator.py new file mode 100644 index 000000000..2aaef235d --- /dev/null +++ b/packages/base/layer_gallery_generator.py @@ -0,0 +1,337 @@ +from datetime import date, timedelta +import json +from io import BytesIO +import os +import subprocess + +import requests +from PIL import Image +import mercantile +from xyzservices import providers, TileProvider +import string +from requests.exceptions import RequestException + +with open("layer_gallery/thumbnail_config.json", "r", encoding="utf-8") as f: + provider_config = json.load(f) + +THUMBNAILS_LOCATION = "layer_gallery" + + +def snake_to_camel(s): + """ + Convect snake case strings into camel case ones + """ + parts = s.split("_") + return parts[0] + "".join(word.capitalize() for word in parts[1:]) + + +def dict_keys_to_camel(obj): + """ + Convect keys of a dict from snake case to camel case + """ + if isinstance(obj, dict): + return {snake_to_camel(k): dict_keys_to_camel(v) for k, v in obj.items()} + elif isinstance(obj, list): + return [dict_keys_to_camel(item) for item in obj] + else: + return obj + + +def placeholder_tile(size): + """ + Provide a white empty placeholder image + """ + return Image.new("RGB", size, (220, 220, 220)) + + +def extract_placeholders(url_template): + """ + Extract the placeholders from an url_template + """ + formatter = string.Formatter() + return { + field_name + for _, field_name, _, _ in formatter.parse(url_template) + if field_name + } + + +def build_url_parameters(tile_provider): + """ + Build the url parameters that are needed in fetch_tile, create_thumbnail and download_thumbnail + """ + url_template = tile_provider["url"] + placeholders = extract_placeholders(url_template) + + # Placeholders handled explicitly by fetch_tile + reserved = {"x", "y", "z", "s"} + + kwargs = {} + + for name in placeholders - reserved: + if name in tile_provider and tile_provider[name] is not None: + kwargs[name] = tile_provider[name] + if name == "time" and tile_provider["time"] == "": + kwargs["time"] = yesterday + else: + raise KeyError( + f"Placeholder '{name}' not found in TileProvider '{tile_provider.get('name')}'" + ) + return kwargs + + +def fetch_tile(url_template, x, y, z, s="a", **kwargs): + """ + Fetch a tile from the given URL template. + """ + try: + url = url_template.format(x=x, y=y, z=z, s=s, **kwargs) + response = requests.get( + url, + headers={"User-Agent": "JupyterGIS"}, + timeout=10, + ) + response.raise_for_status() + return Image.open(BytesIO(response.content)) + except RequestException as e: + print(f"⚠️ Tile fetch failed: {e}") + return None + + +def latlng_to_tile(lat, lng, zoom): + """ + Convert latitude/longitude to tile coordinates. + """ + tile = mercantile.tile(lng, lat, zoom, True) + return tile.x, tile.y + + +def create_thumbnail( + url_template, + lat, + lng, + zoom, + thumbnail_path, + tile_size=256, + thumbnail_size=(512, 512), + **url_parameters, +): + """ + Create a thumbnail for the specified location and zoom level. + """ + # Skip if thumbnail already exists + x, y = latlng_to_tile(lat, lng, zoom) + + # Fetch the tiles (2x2 grid for the thumbnail) + tiles = [] + for dy in range(2): + row = [] + for dx in range(2): + tile_x, tile_y = x + dx, y + dy + tile = fetch_tile(url_template, tile_x, tile_y, zoom, **url_parameters) + if tile is None: + tile = placeholder_tile((tile_size, tile_size)) + row.append(tile) + tiles.append(row) + + # Create a blank image for the thumbnail + thumbnail = Image.new("RGB", (2 * tile_size, 2 * tile_size)) + + # Paste the tiles into the thumbnail image + for dy, row in enumerate(tiles): + for dx, tile in enumerate(row): + thumbnail.paste(tile, (dx * tile_size, dy * tile_size)) + + # Resize to the desired thumbnail size + thumbnail = thumbnail.resize(thumbnail_size, Image.LANCZOS) + return thumbnail + + +yesterday = (date.today() - timedelta(days=1)).strftime("%Y-%m-%d") + +# San Francisco +# san_francisco = {"lat": 37.7749, "lng": -122.4194, "zoom": 5} + +##middle_europe = {"lat": 48.63290858589535, "lng": -350.068359375, "zoom": 4} + +# Default +# france = {"lat": 47.040182144806664, "lng": 1.2963867187500002, "zoom": 5} + + +def download_thumbnail(url_template, name, position, tile_size, **url_parameters): + file_path = f"{THUMBNAILS_LOCATION}/{name}.png" + if os.path.exists(file_path): + return file_path + thumbnail = create_thumbnail( + url_template, + position["lat"], + position["lng"], + position["zoom"], + file_path, + tile_size, + **url_parameters, + ) + thumbnail.save(file_path) + return file_path + + +# Create thumbnail dir if needed +if not os.path.exists(THUMBNAILS_LOCATION): + os.makedirs(THUMBNAILS_LOCATION) + +# This is the JSON we'll generate for the gallery +provider_gallery = {} + +custom_providers = providers.copy() + +custom_providers["MacroStrat"] = { + "CartoRaster": TileProvider( + name="MacroStrat.CartoRaster", + url="https://tiles.macrostrat.org/carto/{z}/{x}/{y}.png", + attribution="© Geologic data © Macrostrat raster layer (CC‑BY 4.0)", + max_zoom=18, + ), + "CartoVector": TileProvider( + name="MacroStrat.CartoVector", + url="https://tiles.macrostrat.org/carto/{z}/{x}/{y}.mvt", + attribution="© Geologic data © Macrostrat vector layer (CC‑BY 4.0)", + max_zoom=18, + ), +} + +# Fetch thumbnails and populate the dictionary +for provider_key, provider_value in provider_config.items(): + xyzprovider = custom_providers[provider_key] + config_is_flat = "layerType" in provider_value + xyz_is_flat = "url" in xyzprovider + + if config_is_flat and xyz_is_flat: + tile_provider = xyzprovider + + url_template = tile_provider["url"] + url_parameters = build_url_parameters(tile_provider) + + thumbnail_config = provider_value["thumbnail"] + position = thumbnail_config["Special Rules"].get( + provider_key, thumbnail_config["Default"] + ) + tile_size = thumbnail_config.get("TileSize", 256) + file_path = download_thumbnail( + url_template, provider_key, position, tile_size, **url_parameters + ) + + provider_gallery[provider_key] = { + "thumbnailPath": file_path, + "name": provider_key, + "layerType": provider_value["layerType"], + "sourceType": provider_value["sourceType"], + "sourceParameters": { + "url": url_template, + "attribution": xyzprovider.get("attribution"), + "maxZoom": xyzprovider.get("max_zoom"), + "minZoom": xyzprovider.get("min_zoom") or 0, + "urlParameters": dict_keys_to_camel(url_template), + }, + "layerParameters": {"opacity": 1}, + } + + elif config_is_flat and not xyz_is_flat: + providers_maps = {} + + for map_name, tile_provider in xyzprovider.items(): + url_template = tile_provider["url"] + url_parameters = build_url_parameters(tile_provider) + + thumbnail_config = provider_value["thumbnail"] + position = thumbnail_config["Special Rules"].get( + map_name, thumbnail_config["Default"] + ) + tile_size = thumbnail_config.get("TileSize", 256) + + name = tile_provider["name"].replace(".", "-") + + file_path = download_thumbnail( + url_template, name, position, tile_size, **url_parameters + ) + + providers_maps[map_name] = { + "thumbnailPath": file_path, + "name": provider_key + "." + map_name, + "layerType": provider_value["layerType"], + "sourceType": provider_value["sourceType"], + "sourceParameters": { + "url": url_template, + "attribution": tile_provider.get("attribution"), + "maxZoom": tile_provider.get("max_zoom"), + "minZoom": tile_provider.get("min_zoom") or 0, + "urlParameters": dict_keys_to_camel(url_parameters), + }, + "layerParameters": {"opacity": 1}, + "description": tile_provider.get("attribution"), + } + + provider_gallery[provider_key] = providers_maps + + elif not config_is_flat and not xyz_is_flat: + providers_maps = {} + for map_name, map_config in provider_value.items(): + tile_provider = xyzprovider[map_name] + url_template = tile_provider["url"] + url_parameters = build_url_parameters(tile_provider) + + thumbnail_config = map_config["thumbnail"] + position = thumbnail_config["Special Rules"].get( + map_name, thumbnail_config["Default"] + ) + tile_size = thumbnail_config.get("TileSize", 256) + + name = tile_provider["name"].replace(".", "-") + + file_path = download_thumbnail( + url_template, name, position, tile_size, **url_parameters + ) + + providers_maps[map_name] = { + "thumbnailPath": file_path, + "name": provider_key + "." + map_name, + "layerType": map_config["layerType"], + "sourceType": map_config["sourceType"], + "sourceParameters": { + "url": url_template, + "attribution": tile_provider.get("attribution"), + "maxZoom": tile_provider.get("max_zoom"), + "minZoom": tile_provider.get("min_zoom") or 0, + "urlParameters": dict_keys_to_camel(url_parameters), + }, + "layerParameters": {"opacity": 1}, + "description": tile_provider.get("attribution"), + } + + provider_gallery[provider_key] = providers_maps + + else: + raise ValueError(f"Inconsistent config for provider '{provider_key}'") + +""" +# compress each images of THUMBNAILS_LOCATION +cmd = f"shopt -s globstar && mogrify -resize 50% {THUMBNAILS_LOCATION}/*.png && optipng {THUMBNAILS_LOCATION}/*.png" +subprocess.run(["bash", "-lc", cmd], check=True) + +try: + subprocess.run(["bash", "-lc", cmd], check=True) +except subprocess.CalledProcessError as e: + print("⚠️ Image compression skipped:", e) +""" + +""" +# compress a single image of THUMBNAILS_LOCATION +image_name = "NaturalEarth-Countries.png" +cmd = ( + f'mogrify -resize 50% "{THUMBNAILS_LOCATION}/{image_name}" && ' + f'optipng "{THUMBNAILS_LOCATION}/{image_name}"' +) +subprocess.run(["bash", "-lc", cmd], check=True) +""" + +with open(f"layer_gallery.json", "w") as f: + json.dump(provider_gallery, f) diff --git a/packages/base/rasterlayer_gallery/raster_layer_gallery.json b/packages/base/rasterlayer_gallery/raster_layer_gallery.json deleted file mode 100644 index 39ebac023..000000000 --- a/packages/base/rasterlayer_gallery/raster_layer_gallery.json +++ /dev/null @@ -1 +0,0 @@ -{"OpenStreetMap": {"Mapnik": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-Mapnik.png", "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png", "max_zoom": 19, "html_attribution": "© OpenStreetMap contributors", "attribution": "(C) OpenStreetMap contributors", "name": "OpenStreetMap.Mapnik"}, "DE": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-DE.png", "url": "https://tile.openstreetmap.de/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "© OpenStreetMap contributors", "attribution": "(C) OpenStreetMap contributors", "name": "OpenStreetMap.DE"}, "CH": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-CH.png", "url": "https://tile.osm.ch/switzerland/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "© OpenStreetMap contributors", "attribution": "(C) OpenStreetMap contributors", "bounds": [[45, 5], [48, 11]], "name": "OpenStreetMap.CH"}, "France": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-France.png", "url": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", "max_zoom": 20, "html_attribution": "© OpenStreetMap France | © OpenStreetMap contributors", "attribution": "(C) OpenStreetMap France | (C) OpenStreetMap contributors", "name": "OpenStreetMap.France"}, "HOT": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-HOT.png", "url": "https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", "max_zoom": 19, "html_attribution": "© OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France", "attribution": "(C) OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France", "name": "OpenStreetMap.HOT"}, "BZH": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-BZH.png", "url": "https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png", "max_zoom": 19, "html_attribution": "© OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", "attribution": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", "bounds": [[46.2, -5.5], [50, 0.7]], "name": "OpenStreetMap.BZH"}, "CAT": {"thumbnailPath": "rasterlayer_gallery/OpenStreetMap-CAT.png", "url": "https://tile.openstreetmap.bzh/ca/{z}/{x}/{y}.png", "max_zoom": 19, "html_attribution": "© OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", "attribution": "(C) OpenStreetMap contributors, Tiles courtesy of Breton OpenStreetMap Team", "name": "OpenStreetMap.CAT"}}, "NASAGIBS": {"ModisTerraTrueColorCR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraTrueColorCR.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 9, "format": "jpg", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_CorrectedReflectance_TrueColor", "name": "NASAGIBS.ModisTerraTrueColorCR"}, "ModisTerraBands367CR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraBands367CR.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 9, "format": "jpg", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_CorrectedReflectance_Bands367", "name": "NASAGIBS.ModisTerraBands367CR"}, "ViirsEarthAtNight2012": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ViirsEarthAtNight2012.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 8, "format": "jpg", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "VIIRS_CityLights_2012", "name": "NASAGIBS.ViirsEarthAtNight2012"}, "ModisTerraLSTDay": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraLSTDay.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 7, "format": "png", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_Land_Surface_Temp_Day", "opacity": 0.75, "name": "NASAGIBS.ModisTerraLSTDay"}, "ModisTerraSnowCover": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraSnowCover.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 8, "format": "png", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_NDSI_Snow_Cover", "opacity": 0.75, "name": "NASAGIBS.ModisTerraSnowCover"}, "ModisTerraAOD": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraAOD.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 6, "format": "png", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_Aerosol", "opacity": 0.75, "name": "NASAGIBS.ModisTerraAOD"}, "ModisTerraChlorophyll": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraChlorophyll.png", "url": "https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{max_zoom}/{z}/{y}/{x}.{format}", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "bounds": [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]], "min_zoom": 1, "max_zoom": 7, "format": "png", "time": "2026-01-11", "tilematrixset": "GoogleMapsCompatible_Level", "variant": "MODIS_Terra_L2_Chlorophyll_A", "opacity": 0.75, "name": "NASAGIBS.ModisTerraChlorophyll", "status": "broken"}, "ModisTerraBands721CR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisTerraBands721CR.png", "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_Bands721/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", "max_zoom": 9, "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "name": "NASAGIBS.ModisTerraBands721CR", "time": "2026-01-11"}, "ModisAquaTrueColorCR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisAquaTrueColorCR.png", "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_TrueColor/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", "max_zoom": 9, "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "name": "NASAGIBS.ModisAquaTrueColorCR", "time": "2026-01-11"}, "ModisAquaBands721CR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ModisAquaBands721CR.png", "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_Bands721/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", "max_zoom": 9, "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "name": "NASAGIBS.ModisAquaBands721CR", "time": "2026-01-11"}, "ViirsTrueColorCR": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ViirsTrueColorCR.png", "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg", "max_zoom": 9, "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "name": "NASAGIBS.ViirsTrueColorCR", "time": "2026-01-11"}, "ASTER_GDEM_Greyscale_Shaded_Relief": {"thumbnailPath": "rasterlayer_gallery/NASAGIBS-ASTER_GDEM_Greyscale_Shaded_Relief.png", "url": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/ASTER_GDEM_Greyscale_Shaded_Relief/default/GoogleMapsCompatible_Level12/{z}/{y}/{x}.jpg", "max_zoom": 12, "attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "html_attribution": "Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.", "name": "NASAGIBS.ASTER_GDEM_Greyscale_Shaded_Relief"}}, "USGS": {"USTopo": {"thumbnailPath": "rasterlayer_gallery/USGS-USTopo.png", "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}", "max_zoom": 20, "html_attribution": "Tiles courtesy of the U.S. Geological Survey", "attribution": "Tiles courtesy of the U.S. Geological Survey", "name": "USGS.USTopo"}, "USImagery": {"thumbnailPath": "rasterlayer_gallery/USGS-USImagery.png", "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}", "max_zoom": 20, "html_attribution": "Tiles courtesy of the U.S. Geological Survey", "attribution": "Tiles courtesy of the U.S. Geological Survey", "name": "USGS.USImagery"}, "USImageryTopo": {"thumbnailPath": "rasterlayer_gallery/USGS-USImageryTopo.png", "url": "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}", "max_zoom": 20, "html_attribution": "Tiles courtesy of the U.S. Geological Survey", "attribution": "Tiles courtesy of the U.S. Geological Survey", "name": "USGS.USImageryTopo"}}, "WaymarkedTrails": {"hiking": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-hiking.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "hiking", "name": "WaymarkedTrails.hiking"}, "cycling": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-cycling.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "cycling", "name": "WaymarkedTrails.cycling"}, "mtb": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-mtb.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "mtb", "name": "WaymarkedTrails.mtb"}, "slopes": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-slopes.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "slopes", "name": "WaymarkedTrails.slopes"}, "riding": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-riding.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "riding", "name": "WaymarkedTrails.riding"}, "skating": {"thumbnailPath": "rasterlayer_gallery/WaymarkedTrails-skating.png", "url": "https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © waymarkedtrails.org (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) waymarkedtrails.org (CC-BY-SA)", "variant": "skating", "name": "WaymarkedTrails.skating"}}, "Gaode": {"Normal": {"thumbnailPath": "rasterlayer_gallery/Gaode-Normal.png", "url": "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}", "max_zoom": 19, "attribution": "© Gaode.com", "html_attribution": "© Gaode.com", "name": "Gaode.Normal"}, "Satellite": {"thumbnailPath": "rasterlayer_gallery/Gaode-Satellite.png", "url": "http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", "max_zoom": 19, "attribution": "© Gaode.com", "html_attribution": "© Gaode.com", "name": "Gaode.Satellite"}}, "Strava": {"All": {"thumbnailPath": "rasterlayer_gallery/Strava-All.png", "url": "https://heatmap-external-a.strava.com/tiles/all/hot/{z}/{x}/{y}.png", "max_zoom": 15, "attribution": "Map tiles by Strava 2021", "html_attribution": "Map tiles by Strava 2021", "name": "Strava.All"}, "Ride": {"thumbnailPath": "rasterlayer_gallery/Strava-Ride.png", "url": "https://heatmap-external-a.strava.com/tiles/ride/hot/{z}/{x}/{y}.png", "max_zoom": 15, "attribution": "Map tiles by Strava 2021", "html_attribution": "Map tiles by Strava 2021", "name": "Strava.Ride"}, "Run": {"thumbnailPath": "rasterlayer_gallery/Strava-Run.png", "url": "https://heatmap-external-a.strava.com/tiles/run/bluered/{z}/{x}/{y}.png", "max_zoom": 15, "attribution": "Map tiles by Strava 2021", "html_attribution": "Map tiles by Strava 2021", "name": "Strava.Run"}, "Water": {"thumbnailPath": "rasterlayer_gallery/Strava-Water.png", "url": "https://heatmap-external-a.strava.com/tiles/water/blue/{z}/{x}/{y}.png", "max_zoom": 15, "attribution": "Map tiles by Strava 2021", "html_attribution": "Map tiles by Strava 2021", "name": "Strava.Water"}, "Winter": {"thumbnailPath": "rasterlayer_gallery/Strava-Winter.png", "url": "https://heatmap-external-a.strava.com/tiles/winter/hot/{z}/{x}/{y}.png", "max_zoom": 15, "attribution": "Map tiles by Strava 2021", "html_attribution": "Map tiles by Strava 2021", "name": "Strava.Winter"}}, "OPNVKarte": {"thumbnailPath": "rasterlayer_gallery/OPNVKarte.png", "url": "https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png", "max_zoom": 18, "html_attribution": "Map memomaps.de CC-BY-SA, map data © OpenStreetMap contributors", "attribution": "Map memomaps.de CC-BY-SA, map data (C) OpenStreetMap contributors", "name": "OPNVKarte"}, "OpenTopoMap": {"thumbnailPath": "rasterlayer_gallery/OpenTopoMap.png", "url": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", "max_zoom": 17, "html_attribution": "Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors, SRTM | Map style: (C) OpenTopoMap (CC-BY-SA)", "name": "OpenTopoMap"}, "OpenRailwayMap": {"thumbnailPath": "rasterlayer_gallery/OpenRailwayMap.png", "url": "https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png", "max_zoom": 19, "html_attribution": "Map data: © OpenStreetMap contributors | Map style: © OpenRailwayMap (CC-BY-SA)", "attribution": "Map data: (C) OpenStreetMap contributors | Map style: (C) OpenRailwayMap (CC-BY-SA)", "name": "OpenRailwayMap"}, "Esri": {"WorldStreetMap": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldStreetMap.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Street_Map", "html_attribution": "Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012", "attribution": "Tiles (C) Esri -- Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012", "name": "Esri.WorldStreetMap"}, "WorldTopoMap": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldTopoMap.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Topo_Map", "html_attribution": "Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community", "attribution": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community", "name": "Esri.WorldTopoMap"}, "WorldImagery": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldImagery.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Imagery", "html_attribution": "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", "attribution": "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", "name": "Esri.WorldImagery"}, "WorldTerrain": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldTerrain.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Terrain_Base", "html_attribution": "Tiles © Esri — Source: USGS, Esri, TANA, DeLorme, and NPS", "attribution": "Tiles (C) Esri -- Source: USGS, Esri, TANA, DeLorme, and NPS", "max_zoom": 13, "name": "Esri.WorldTerrain"}, "WorldShadedRelief": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldShadedRelief.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Shaded_Relief", "html_attribution": "Tiles © Esri — Source: Esri", "attribution": "Tiles (C) Esri -- Source: Esri", "max_zoom": 13, "name": "Esri.WorldShadedRelief"}, "WorldPhysical": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldPhysical.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "World_Physical_Map", "html_attribution": "Tiles © Esri — Source: US National Park Service", "attribution": "Tiles (C) Esri -- Source: US National Park Service", "max_zoom": 8, "name": "Esri.WorldPhysical"}, "OceanBasemap": {"thumbnailPath": "rasterlayer_gallery/Esri-OceanBasemap.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "Ocean/World_Ocean_Base", "html_attribution": "Tiles © Esri — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri", "attribution": "Tiles (C) Esri -- Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri", "max_zoom": 13, "name": "Esri.OceanBasemap"}, "NatGeoWorldMap": {"thumbnailPath": "rasterlayer_gallery/Esri-NatGeoWorldMap.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "NatGeo_World_Map", "html_attribution": "Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC", "attribution": "Tiles (C) Esri -- National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC", "max_zoom": 16, "name": "Esri.NatGeoWorldMap"}, "WorldGrayCanvas": {"thumbnailPath": "rasterlayer_gallery/Esri-WorldGrayCanvas.png", "url": "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", "variant": "Canvas/World_Light_Gray_Base", "html_attribution": "Tiles © Esri — Esri, DeLorme, NAVTEQ", "attribution": "Tiles (C) Esri -- Esri, DeLorme, NAVTEQ", "max_zoom": 16, "name": "Esri.WorldGrayCanvas"}}, "MacroStrat": {"CartoRaster": {"thumbnailPath": "rasterlayer_gallery/MacroStrat-CartoRaster.png", "name": "MacroStrat.CartoRaster", "url": "https://tiles.macrostrat.org/carto/{z}/{x}/{y}.png", "attribution": "\u00a9 Geologic data \u00a9 Macrostrat raster layer (CC\u2011BY 4.0)", "max_zoom": 18}}} diff --git a/packages/base/rasterlayer_gallery_generator.py b/packages/base/rasterlayer_gallery_generator.py deleted file mode 100644 index 33d75e888..000000000 --- a/packages/base/rasterlayer_gallery_generator.py +++ /dev/null @@ -1,259 +0,0 @@ -from datetime import date, timedelta -import json -from io import BytesIO -import os -import subprocess - -import requests -from PIL import Image -import mercantile -from xyzservices import providers, TileProvider - -THUMBNAILS_LOCATION = "rasterlayer_gallery" - - -def fetch_tile(url_template, x, y, z, s="a"): - """ - Fetch a tile from the given URL template. - """ - url = url_template.format(x=x, y=y, z=z, s=s) - print(f" Fetch {url}") - response = requests.get( - url, headers={"Content-Type": "application/json", "User-Agent": "JupyterGIS"} - ) - response.raise_for_status() - return Image.open(BytesIO(response.content)) - - -def latlng_to_tile(lat, lng, zoom): - """ - Convert latitude/longitude to tile coordinates. - """ - tile = mercantile.tile(lng, lat, zoom, True) - return tile.x, tile.y - - -def create_thumbnail( - url_template, - lat, - lng, - zoom, - thumbnail_path, - tile_size=256, - thumbnail_size=(512, 512), -): - """ - Create a thumbnail for the specified location and zoom level. - """ - # Skip if thumbnail already exists - if os.path.exists(thumbnail_path): - return Image.open(thumbnail_path) - x, y = latlng_to_tile(lat, lng, zoom) - - # Fetch the tiles (2x2 grid for the thumbnail) - tiles = [] - for dy in range(2): - row = [] - for dx in range(2): - tile_x, tile_y = x + dx, y + dy - tile = fetch_tile(url_template, tile_x, tile_y, zoom) - row.append(tile) - tiles.append(row) - - # Create a blank image for the thumbnail - thumbnail = Image.new("RGB", (2 * tile_size, 2 * tile_size)) - - # Paste the tiles into the thumbnail image - for dy, row in enumerate(tiles): - for dx, tile in enumerate(row): - thumbnail.paste(tile, (dx * tile_size, dy * tile_size)) - - # Resize to the desired thumbnail size - thumbnail = thumbnail.resize(thumbnail_size, Image.LANCZOS) - return thumbnail - - -yesterday = (date.today() - timedelta(days=1)).strftime("%Y-%m-%d") - -# San Francisco -san_francisco = {"lat": 37.7749, "lng": -122.4194, "zoom": 5} - -middle_europe = {"lat": 48.63290858589535, "lng": -350.068359375, "zoom": 4} - -# Default -france = {"lat": 47.040182144806664, "lng": 1.2963867187500002, "zoom": 5} - -thumbnails_providers_positions = { - "OpenStreetMap": { - "Special Rules": { - "BZH": {"lat": 47.76702233051035, "lng": -3.4675598144531254, "zoom": 8}, - "CH": {"lat": 46.8182, "lng": 8.2275, "zoom": 8}, - "DE": {"lat": 51.1657, "lng": 10.4515, "zoom": 8}, - "France": france, - "HOT": france, - }, - "Default": france, - }, - "NASAGIBS": {"Special Rules": {}, "Default": france}, - # 'JusticeMap': { - # 'Special Rules': {}, - # 'Default': san_francisco, - # }, - "USGS": { - "Special Rules": {}, - "Default": san_francisco, - }, - "WaymarkedTrails": { - "Special Rules": {}, - "Default": france, - }, - "Gaode": { - "Special Rules": {}, - "Default": san_francisco, - }, - "Strava": {"Special Rules": {}, "Default": france, "TileSize": 512}, - "OPNVKarte": { - "Special Rules": {}, - "Default": san_francisco, - }, - "OpenTopoMap": { - "Special Rules": {}, - "Default": san_francisco, - }, - "OpenRailwayMap": {"Special Rules": {}, "Default": san_francisco, "TileSize": 512}, - # 'OpenFireMap': { - # 'Special Rules': {}, - # 'Default': san_francisco, - # }, - # 'SafeCast': { - # 'Special Rules': {}, - # 'Default': san_francisco, - # }, - "Esri": { - "Special Rules": {}, - "Default": san_francisco, - }, - "MacroStrat": { - "Special Rules": { - "CartoRaster": france, - }, - "Default": france, - }, -} - - -def download_thumbnail(url_template, name, position, tile_size): - file_path = f"{THUMBNAILS_LOCATION}/{name}.png" - thumbnail = create_thumbnail( - url_template, - position["lat"], - position["lng"], - position["zoom"], - file_path, - tile_size, - ) - thumbnail.save(file_path) - return file_path - - -# This is the JSON we'll generate for the raster gallery -raster_provider_gallery = {} - -# Create thumbnail dir if needed -if not os.path.exists(THUMBNAILS_LOCATION): - os.makedirs(THUMBNAILS_LOCATION) - -custom_providers = providers.copy() - -custom_providers["MacroStrat"] = { - "CartoRaster": TileProvider( - name="MacroStrat.CartoRaster", - url="https://tiles.macrostrat.org/carto/{z}/{x}/{y}.png", - attribution="© Geologic data © Macrostrat raster layer (CC‑BY 4.0)", - max_zoom=18, - ) -} - -# Fetch thumbnails and populate the dictionary -for provider in thumbnails_providers_positions.keys(): - xyzprovider = custom_providers[provider] - - if "url" in xyzprovider.keys(): - print(f"Process {provider}") - - try: - name = provider - url_template = xyzprovider["url"] - - if name in thumbnails_providers_positions[provider]["Special Rules"].keys(): - position = thumbnails_providers_positions[provider]["Special Rules"][ - name - ] - else: - position = thumbnails_providers_positions[provider]["Default"] - - tile_size = thumbnails_providers_positions[provider].get("TileSize", 256) - - file_path = download_thumbnail(url_template, name, position, tile_size) - raster_provider_gallery[name] = dict( - # jgisname=name, - thumbnailPath=file_path, - **xyzprovider, - ) - if "time" in raster_provider_gallery[name]: - raster_provider_gallery[name]["time"] = yesterday - - except Exception as e: - print("Failed...", e) - - continue - - providers_maps = {} - for map_name in xyzprovider.keys(): - print(f"Process {provider} {map_name}") - - try: - if ( - map_name - in thumbnails_providers_positions[provider]["Special Rules"].keys() - ): - position = thumbnails_providers_positions[provider]["Special Rules"][ - map_name - ] - else: - position = thumbnails_providers_positions[provider]["Default"] - - tile_provider = xyzprovider[map_name] - - if "crs" in tile_provider or "apikey" in tile_provider: - # TODO Support other projections once we have another viewer than maplibre - # TODO Support api keys - continue - - name = tile_provider["name"].replace(".", "-") - url_template = tile_provider.build_url(time=yesterday) - tile_size = thumbnails_providers_positions[provider].get("TileSize", 256) - - file_path = download_thumbnail(url_template, name, position, tile_size) - providers_maps[map_name] = dict( - # jgisname=name, - thumbnailPath=file_path, - **tile_provider, - ) - if "time" in providers_maps[map_name]: - providers_maps[map_name]["time"] = yesterday - - raster_provider_gallery[provider] = providers_maps - - except Exception as e: - print("Failed...", e) - -# Save JSON repr -with open(f"{THUMBNAILS_LOCATION}/raster_layer_gallery.json", "w") as f: - json.dump(raster_provider_gallery, f) - - -# compress images -cmd = f"shopt -s globstar && mogrify -resize 50% {THUMBNAILS_LOCATION}/*.png && optipng {THUMBNAILS_LOCATION}/*.png" - -subprocess.run(["bash", "-lc", cmd], check=True) diff --git a/packages/base/src/dialogs/layerBrowserDialog.tsx b/packages/base/src/dialogs/layerBrowserDialog.tsx index e8af9cc3f..09d6117bb 100644 --- a/packages/base/src/dialogs/layerBrowserDialog.tsx +++ b/packages/base/src/dialogs/layerBrowserDialog.tsx @@ -7,7 +7,7 @@ import { IJGISLayerDocChange, IJGISSource, IJupyterGISModel, - IRasterLayerGalleryEntry, + ILayerGalleryEntry, } from '@jupytergis/schema'; import { Dialog } from '@jupyterlab/apputils'; import { PromiseDelegate, UUID } from '@lumino/coreutils'; @@ -15,11 +15,11 @@ import { Signal } from '@lumino/signaling'; import React, { ChangeEvent, MouseEvent, useEffect, useState } from 'react'; import { CreationFormWrapper } from './layerCreationFormDialog'; -import CUSTOM_RASTER_IMAGE from '../../rasterlayer_gallery/custom_raster.png'; +import CUSTOM_RASTER_IMAGE from '../../layer_gallery/custom_raster.png'; interface ILayerBrowserDialogProps { model: IJupyterGISModel; - registry: IRasterLayerGalleryEntry[]; + registry: ILayerGalleryEntry[]; formSchemaRegistry: IJGISFormSchemaRegistry; okSignalPromise: PromiseDelegate, number>>; cancel: () => void; @@ -39,9 +39,9 @@ export const LayerBrowserComponent: React.FC = ({ const [creatingCustomRaster, setCreatingCustomRaster] = useState(false); const [galleryWithCategory, setGalleryWithCategory] = - useState(registry); + useState(registry); - const providers = [...new Set(registry.map(item => item.source.provider))]; + const providers = [...new Set(registry.map(item => item.provider))]; const filteredGallery = galleryWithCategory.filter(item => item.name.toLowerCase().includes(searchTerm), @@ -80,9 +80,7 @@ export const LayerBrowserComponent: React.FC = ({ const filteredGallery = sameAsOld ? registry - : registry.filter(item => - item.source.provider?.includes(categoryTab.innerText), - ); + : registry.filter(item => item.provider?.includes(categoryTab.innerText)); setGalleryWithCategory(filteredGallery); setSearchTerm(''); @@ -97,20 +95,18 @@ export const LayerBrowserComponent: React.FC = ({ * Add tile layer and source to model * @param tile Tile to add */ - const handleTileClick = (tile: IRasterLayerGalleryEntry) => { + const handleTileClick = (tile: ILayerGalleryEntry) => { const sourceId = UUID.uuid4(); const sourceModel: IJGISSource = { - type: 'RasterSource', + type: tile.sourceType, name: tile.name, - parameters: tile.source, + parameters: tile.sourceParameters, }; const layerModel: IJGISLayer = { - type: 'RasterLayer', - parameters: { - source: sourceId, - }, + type: tile.layerType, + parameters: { ...tile.layerParameters, source: sourceId }, visible: true, name: tile.name + ' Layer', }; @@ -231,8 +227,9 @@ export const LayerBrowserComponent: React.FC = ({ placeholder

*/} +
{tile.sourceType}

- {tile.source.attribution} + {tile.description}

@@ -244,7 +241,7 @@ export const LayerBrowserComponent: React.FC = ({ export interface ILayerBrowserOptions { model: IJupyterGISModel; - registry: IRasterLayerGalleryEntry[]; + registry: ILayerGalleryEntry[]; formSchemaRegistry: IJGISFormSchemaRegistry; } diff --git a/packages/base/src/tools.ts b/packages/base/src/tools.ts index eda87e541..cf19f4fde 100644 --- a/packages/base/src/tools.ts +++ b/packages/base/src/tools.ts @@ -4,7 +4,7 @@ import { IJGISOptions, IJGISSource, IJupyterGISModel, - IRasterLayerGalleryEntry, + ILayerGalleryEntry, SourceType, } from '@jupytergis/schema'; import { showErrorMessage } from '@jupyterlab/apputils'; @@ -15,7 +15,7 @@ import { compressors } from 'hyparquet-compressors'; import Protobuf from 'pbf'; import shp from 'shpjs'; -import RASTER_LAYER_GALLERY from '@/rasterlayer_gallery/raster_layer_gallery.json'; +import LAYER_GALLERY from '@/layer_gallery.json'; export const debounce = ( func: CallableFunction, @@ -151,7 +151,7 @@ export function deepCopy>(value: T): T { export function createDefaultLayerRegistry( layerBrowserRegistry: IJGISLayerBrowserRegistry, ): void { - const RASTER_THUMBNAILS: { [key: string]: string } = {}; + const LAYER_THUMBNAILS: { [key: string]: string } = {}; /** * Generate object to hold thumbnail URLs @@ -159,28 +159,30 @@ export function createDefaultLayerRegistry( const importAll = (r: __WebpackModuleApi.RequireContext) => { r.keys().forEach(key => { const imageName = key.replace('./', '').replace(/\.\w+$/, ''); - RASTER_THUMBNAILS[imageName] = r(key); + LAYER_THUMBNAILS[imageName] = r(key); }); }; const context = require.context( - '../rasterlayer_gallery', + '../layer_gallery', false, /\.(png|jpe?g|gif|svg)$/, ); importAll(context); - for (const entry of Object.keys(RASTER_LAYER_GALLERY)) { - const xyzprovider: any = (RASTER_LAYER_GALLERY as any)[entry]; + for (const entry of Object.keys(LAYER_GALLERY)) { + const layerProvider: any = (LAYER_GALLERY as any)[entry]; - if ('url' in xyzprovider) { - const tile = convertToRegistryEntry(entry, xyzprovider); + if ('thumbnailPath' in layerProvider) { + /*flat layer provider*/ + const tile = convertToRegistryEntry(entry, layerProvider); layerBrowserRegistry.addRegistryLayer(tile); } else { - Object.keys(xyzprovider).forEach(mapName => { + /* nested layer provider */ + Object.keys(layerProvider).forEach(mapName => { const tile = convertToRegistryEntry( - xyzprovider[mapName]['name'], - xyzprovider[mapName], + layerProvider[mapName]['name'], + layerProvider[mapName], entry, ); @@ -194,40 +196,24 @@ export function createDefaultLayerRegistry( * Parse tile information from providers to be usable in the layer registry * * @param entry - The name of the entry, which may also serve as the default provider name if none is specified. - * @param xyzprovider - An object containing the XYZ provider's details, including name, URL, zoom levels, attribution, and possibly other properties relevant to the provider. + * @param layerProvider - An object containing the provider's details, including name, URL, zoom levels, attribution, and possibly other properties relevant to the provider. * @param provider - Optional. Specifies the provider name. If not provided, the `entry` parameter is used as the default provider name. * @returns - An object representing the registry entry */ function convertToRegistryEntry( entry: string, - xyzprovider: { [x: string]: any }, + layerProvider: { [x: string]: any }, provider?: string | undefined, - ): IRasterLayerGalleryEntry { - const urlParameters: any = {}; - if (xyzprovider.time) { - urlParameters.time = xyzprovider.time; - } - if (xyzprovider.variant) { - urlParameters.variant = xyzprovider.variant; - } - if (xyzprovider.tilematrixset) { - urlParameters.tilematrixset = xyzprovider.tilematrixset; - } - if (xyzprovider.format) { - urlParameters.format = xyzprovider.format; - } - + ): ILayerGalleryEntry { return { name: entry, - thumbnail: RASTER_THUMBNAILS[xyzprovider['name'].replace('.', '-')], - source: { - url: xyzprovider['url'], - minZoom: xyzprovider['min_zoom'] || 0, - maxZoom: xyzprovider['max_zoom'] || 24, - attribution: xyzprovider['attribution'] || '', - provider: provider ?? entry, - urlParameters, - }, + thumbnail: LAYER_THUMBNAILS[layerProvider['name'].replace('.', '-')], + sourceType: layerProvider['sourceType'], + layerType: layerProvider['layerType'], + sourceParameters: layerProvider['sourceParameters'], + layerParameters: layerProvider['layerParameters'], + provider: provider ?? entry.split('.', 1)[0], + description: layerProvider['description'], }; } } diff --git a/packages/schema/src/interfaces.ts b/packages/schema/src/interfaces.ts index f1990e934..d33f81b62 100644 --- a/packages/schema/src/interfaces.ts +++ b/packages/schema/src/interfaces.ts @@ -27,10 +27,32 @@ import { IJGISSource, IJGISSources, IJGISStoryMap, + LayerType, SourceType, } from './_interface/project/jgis'; -import { IRasterSource } from './_interface/project/sources/rasterSource'; -import { Modes } from './types'; + +import { + IGeoJSONSource, + IGeoParquetSource, + IGeoTiffSource, + IHeatmapLayer, + IHillshadeLayer, + IImageLayer, + IImageSource, + IMarkerSource, + IRasterDemSource, + IRasterLayer, + IRasterSource, + IShapefileSource, + IStacLayer, + IStorySegmentLayer, + IVectorLayer, + IVectorTileLayer, + IVectorTileSource, + IVideoSource, + IWebGlLayer, + Modes, +} from './types'; export { IGeoJSONSource } from './_interface/project/sources/geoJsonSource'; export interface IJGISStoryMaps { @@ -356,21 +378,44 @@ export interface IJGISExternalCommandRegistry { } /** - * Defines the structure for entries in a raster layer gallery. - * Each entry consists of a name, a thumbnail URL, and source information. - * The source information is expected to conform to the IRasterSource interface. + * Defines the structure for entries in a layer gallery. * - * @interface IRasterLayerGalleryEntry + * @interface ILayerGalleryEntry */ -export interface IRasterLayerGalleryEntry { + +export type ILayerGalleryEntry = { name: string; thumbnail: string; - source: IRasterSource; -} + layerType: LayerType; + layerParameters: + | IHeatmapLayer + | IHillshadeLayer + | IImageLayer + | IRasterLayer + | IStacLayer + | IStorySegmentLayer + | IVectorLayer + | IVectorTileLayer + | IWebGlLayer; + sourceType: SourceType; + sourceParameters: + | IGeoJSONSource + | IGeoParquetSource + | IGeoTiffSource + | IImageSource + | IMarkerSource + | IRasterDemSource + | IRasterSource + | IShapefileSource + | IVectorTileSource + | IVideoSource; + provider: string; + description: string; +}; export interface IJGISLayerBrowserRegistry { - getRegistryLayers(): IRasterLayerGalleryEntry[]; - addRegistryLayer(data: IRasterLayerGalleryEntry): void; + getRegistryLayers(): ILayerGalleryEntry[]; + addRegistryLayer(data: ILayerGalleryEntry): void; removeRegistryLayer(name: string): void; clearRegistry(): void; } diff --git a/python/jupytergis_core/src/layerBrowserRegistry.ts b/python/jupytergis_core/src/layerBrowserRegistry.ts index fdd08e7ac..4151ecdf4 100644 --- a/python/jupytergis_core/src/layerBrowserRegistry.ts +++ b/python/jupytergis_core/src/layerBrowserRegistry.ts @@ -1,6 +1,6 @@ import { IJGISLayerBrowserRegistry, - IRasterLayerGalleryEntry, + ILayerGalleryEntry, } from '@jupytergis/schema'; /** @@ -11,7 +11,7 @@ import { * @implements IJGISLayerBrowserRegistry */ export class JupyterGISLayerBrowserRegistry implements IJGISLayerBrowserRegistry { - private _registry: IRasterLayerGalleryEntry[]; + private _registry: ILayerGalleryEntry[]; constructor() { this._registry = []; @@ -22,7 +22,7 @@ export class JupyterGISLayerBrowserRegistry implements IJGISLayerBrowserRegistry * Returns a copy of the internal registry array to prevent external modifications. * @returns The current state of the registry layers. */ - getRegistryLayers(): IRasterLayerGalleryEntry[] { + getRegistryLayers(): ILayerGalleryEntry[] { return [...this._registry]; } @@ -30,7 +30,7 @@ export class JupyterGISLayerBrowserRegistry implements IJGISLayerBrowserRegistry * Adds a new raster layer gallery entry to the registry. * @param data - The raster layer gallery entry to add. */ - addRegistryLayer(data: IRasterLayerGalleryEntry): void { + addRegistryLayer(data: ILayerGalleryEntry): void { this._registry.push(data); }