Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Removed typing in layers model

Mike McGannc6e8fa7af6b7
diff --git a/bin/gibs2wv b/bin/gibs2wv
index 5af10026a..d48fe1318 100755
--- a/bin/gibs2wv
+++ b/bin/gibs2wv
@@ -47,6 +47,7 @@ for filename in args:
wv_layers[id] = {}
wv_layer = wv_layers[id]
+ wv_layer["id"] = id
wv_layer["type"] = "wmts"
wv_layer["tileSize"] = [512, 512]
wv_layer["format"] = gc_layer["Format"]
diff --git a/src/data/config.json b/src/data/config.json
index 18c050e1d..9c12e31b5 100644
--- a/src/data/config.json
+++ b/src/data/config.json
@@ -14,7 +14,8 @@
"matrixSet": "GIBS:EPSG4326_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_SurfaceReflectance_Bands121"
},
"MLS_O3_46hPa_Day": {
"startDate": "2013-05-09",
@@ -30,7 +31,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_O3_46hPa_Day"
},
"Sea_Surface_Temp_Infrared": {
"startDate": "2013-04-13",
@@ -47,7 +49,8 @@
"matrixSet": "GIBS:EPSG4326_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "Sea_Surface_Temp_Infrared"
},
"MLS_H2O_46hPa_Night": {
"startDate": "2013-05-09",
@@ -63,7 +66,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_H2O_46hPa_Night"
},
"MLS_Temperature_46hPa_Day": {
"startDate": "2013-05-09",
@@ -79,7 +83,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_Temperature_46hPa_Day"
},
"MODIS_Terra_SurfaceReflectance_Bands143": {
"startDate": "2012-05-08",
@@ -95,7 +100,8 @@
"matrixSet": "GIBS:EPSG4326_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_SurfaceReflectance_Bands143"
},
"MODIS_Terra_Water_Vapor_5km_Day": {
"startDate": "2012-05-08",
@@ -111,7 +117,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Water_Vapor_5km_Day"
},
"MODIS_Aqua_Snow_Cover": {
"startDate": "2012-05-08",
@@ -135,7 +142,8 @@
"matrixSet": "GIBS:EPSG3413_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Snow_Cover"
},
"MODIS_Terra_CorrectedReflectance_Bands721": {
"startDate": "2012-05-08",
@@ -159,7 +167,8 @@
"matrixSet": "GIBS:EPSG3413_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_CorrectedReflectance_Bands721"
},
"MODIS_Combined_Value_Added_AOD": {
"startDate": "2013-01-31",
@@ -175,7 +184,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Combined_Value_Added_AOD"
},
"MODIS_Terra_Brightness_Temp_Band31_Night": {
"startDate": "2012-05-08",
@@ -199,17 +209,19 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Brightness_Temp_Band31_Night"
},
"MODIS_Water_Mask": {
- "format": "image/png",
- "type": "wmts",
"projections": {
"geographic": {
"source": "GIBS:geographic",
"matrixSet": "GIBS:EPSG4326_250m"
}
},
+ "format": "image/png",
+ "type": "wmts",
+ "id": "MODIS_Water_Mask",
"tileSize": [
512,
512
@@ -229,7 +241,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Cloud_Top_Pressure_Night"
},
"MODIS_Terra_Chlorophyll_A": {
"startDate": "2013-07-02",
@@ -245,7 +258,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Chlorophyll_A"
},
"MODIS_Aqua_Brightness_Temp_Band31_Day": {
"startDate": "2012-05-08",
@@ -269,7 +283,8 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Brightness_Temp_Band31_Day"
},
"MODIS_Terra_Water_Vapor_5km_Night": {
"startDate": "2012-05-08",
@@ -285,7 +300,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Water_Vapor_5km_Night"
},
"AMSRE_Brightness_Temp_89H_Day": {
"startDate": "2002-06-01",
@@ -348,7 +364,8 @@
"matrixSet": "GIBS:EPSG4326_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_SurfaceReflectance_Bands721"
},
"MODIS_Aqua_Land_Surface_Temp_Day": {
"startDate": "2012-05-08",
@@ -364,7 +381,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Land_Surface_Temp_Day"
},
"MODIS_Aqua_Aerosol": {
"startDate": "2012-05-08",
@@ -380,7 +398,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Aerosol"
},
"MODIS_Aqua_Chlorophyll_A": {
"startDate": "2013-07-02",
@@ -396,7 +415,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Chlorophyll_A"
},
"MLS_O3_46hPa_Night": {
"startDate": "2013-05-09",
@@ -412,7 +432,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_O3_46hPa_Night"
},
"Sea_Surface_Temp_Blended": {
"startDate": "2013-04-13",
@@ -429,7 +450,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "Sea_Surface_Temp_Blended"
},
"MODIS_Terra_Cloud_Top_Pressure_Night": {
"startDate": "2012-05-08",
@@ -445,7 +467,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Cloud_Top_Pressure_Night"
},
"AIRS_Prata_SO2_Index_Day": {
"startDate": "2012-05-08",
@@ -461,7 +484,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_Prata_SO2_Index_Day"
},
"MODIS_Terra_Sea_Ice": {
"startDate": "2012-05-08",
@@ -485,7 +509,8 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Sea_Ice"
},
"OMI_Cloud_Pressure": {
"startDate": "2012-05-08",
@@ -501,7 +526,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_Cloud_Pressure"
},
"MODIS_Aqua_CorrectedReflectance_TrueColor": {
"startDate": "2012-05-08",
@@ -546,7 +572,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_HNO3_46hPa_Night"
},
"OMI_Aerosol_Optical_Depth": {
"startDate": "2012-05-08",
@@ -562,7 +589,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_Aerosol_Optical_Depth"
},
"OMI_Aerosol_Index": {
"startDate": "2012-05-08",
@@ -578,7 +606,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_Aerosol_Index"
},
"MLS_CO_215hPa_Night": {
"startDate": "2013-05-09",
@@ -594,7 +623,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_CO_215hPa_Night"
},
"MODIS_Terra_Aerosol": {
"startDate": "2012-05-08",
@@ -610,7 +640,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Aerosol"
},
"MODIS_Terra_CorrectedReflectance_Bands367": {
"startDate": "2012-05-08",
@@ -634,7 +665,8 @@
"matrixSet": "GIBS:EPSG3413_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_CorrectedReflectance_Bands367"
},
"OMI_SO2_Planetary_Boundary_Layer": {
"startDate": "2012-05-08",
@@ -650,7 +682,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_SO2_Planetary_Boundary_Layer"
},
"MODIS_Terra_SurfaceReflectance_Bands121": {
"startDate": "2012-05-08",
@@ -666,7 +699,8 @@
"matrixSet": "GIBS:EPSG4326_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_SurfaceReflectance_Bands121"
},
"AMSRE_Brightness_Temp_89H_Night": {
"startDate": "2002-06-01",
@@ -702,7 +736,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_CO_Total_Column_Night"
},
"MLS_CO_215hPa_Day": {
"startDate": "2013-05-09",
@@ -718,7 +753,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_CO_215hPa_Day"
},
"MODIS_Aqua_Water_Vapor_5km_Day": {
"startDate": "2012-05-08",
@@ -734,7 +770,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Water_Vapor_5km_Day"
},
"AIRS_Dust_Score": {
"startDate": "2012-05-08",
@@ -750,7 +787,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_Dust_Score"
},
"MODIS_Terra_Data_No_Data": {
"startDate": "2012-05-08",
@@ -766,7 +804,8 @@
"matrixSet": "GIBS:EPSG4326_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Data_No_Data"
},
"OMI_SO2_Upper_Troposphere_and_Stratosphere": {
"startDate": "2012-05-08",
@@ -782,7 +821,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_SO2_Upper_Troposphere_and_Stratosphere"
},
"Sea_Surface_Temp_Microwave": {
"startDate": "2013-04-13",
@@ -799,7 +839,8 @@
"matrixSet": "GIBS:EPSG4326_16km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "Sea_Surface_Temp_Microwave"
},
"MODIS_Terra_Brightness_Temp_Band31_Day": {
"startDate": "2012-05-08",
@@ -823,7 +864,8 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Brightness_Temp_Band31_Day"
},
"AIRS_Precipitation_Night": {
"startDate": "2012-05-08",
@@ -839,7 +881,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_Precipitation_Night"
},
"MODIS_Terra_Cloud_Top_Pressure_Day": {
"startDate": "2012-05-08",
@@ -855,7 +898,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Cloud_Top_Pressure_Day"
},
"arctic_coastlines_3413": {
"group": "overlays",
@@ -890,7 +934,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Land_Surface_Temp_Day"
},
"MODIS_Terra_Cloud_Top_Temp_Night": {
"startDate": "2012-05-08",
@@ -906,7 +951,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Cloud_Top_Temp_Night"
},
"MLS_N2O_46hPa_Night": {
"startDate": "2013-05-09",
@@ -922,7 +968,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_N2O_46hPa_Night"
},
"antarctic_coastlines": {
"group": "overlays",
@@ -957,7 +1004,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Cloud_Top_Temp_Night"
},
"MODIS_Aqua_Brightness_Temp_Band31_Night": {
"startDate": "2012-05-08",
@@ -981,7 +1029,8 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Brightness_Temp_Band31_Night"
},
"AIRS_CO_Total_Column_Day": {
"startDate": "2012-05-08",
@@ -997,7 +1046,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_CO_Total_Column_Day"
},
"MODIS_Terra_SurfaceReflectance_Bands721": {
"startDate": "2012-05-08",
@@ -1013,7 +1063,8 @@
"matrixSet": "GIBS:EPSG4326_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_SurfaceReflectance_Bands721"
},
"MODIS_Terra_Cloud_Top_Temp_Day": {
"startDate": "2012-05-08",
@@ -1029,7 +1080,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Cloud_Top_Temp_Day"
},
"AIRS_Precipitation_Day": {
"startDate": "2012-05-08",
@@ -1045,7 +1097,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_Precipitation_Day"
},
"MODIS_Terra_CorrectedReflectance_TrueColor": {
"startDate": "2012-05-08",
@@ -1110,7 +1163,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_HNO3_46hPa_Day"
},
"MLS_N2O_46hPa_Day": {
"startDate": "2013-05-09",
@@ -1126,7 +1180,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_N2O_46hPa_Day"
},
"MODIS_Terra_Snow_Cover": {
"startDate": "2012-05-08",
@@ -1150,7 +1205,8 @@
"matrixSet": "GIBS:EPSG3413_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Snow_Cover"
},
"MODIS_Terra_Land_Surface_Temp_Night": {
"startDate": "2012-05-08",
@@ -1166,7 +1222,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Terra_Land_Surface_Temp_Night"
},
"MLS_Temperature_46hPa_Night": {
"startDate": "2013-05-09",
@@ -1182,7 +1239,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_Temperature_46hPa_Night"
},
"MODIS_Aqua_Cloud_Top_Temp_Day": {
"startDate": "2012-05-08",
@@ -1198,17 +1256,19 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Cloud_Top_Temp_Day"
},
"VIIRS_CityLights_2012": {
- "format": "image/jpeg",
- "type": "wmts",
"projections": {
"geographic": {
"source": "GIBS:geographic",
"matrixSet": "GIBS:EPSG4326_500m"
}
},
+ "format": "image/jpeg",
+ "type": "wmts",
+ "id": "VIIRS_CityLights_2012",
"tileSize": [
512,
512
@@ -1249,7 +1309,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_Absorbing_Aerosol_Optical_Depth"
},
"OMI_SO2_Middle_Troposphere": {
"startDate": "2012-05-08",
@@ -1265,7 +1326,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_SO2_Middle_Troposphere"
},
"MLS_SO2_147hPa_Night": {
"startDate": "2013-05-09",
@@ -1281,7 +1343,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_SO2_147hPa_Night"
},
"OMI_SO2_Lower_Troposphere": {
"startDate": "2012-05-08",
@@ -1297,7 +1360,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "OMI_SO2_Lower_Troposphere"
},
"AIRS_Prata_SO2_Index_Night": {
"startDate": "2012-05-08",
@@ -1313,7 +1377,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "AIRS_Prata_SO2_Index_Night"
},
"MEaSUREs_Daily_Landscape_Freeze_Thaw": {
"startDate": "2002-06-19",
@@ -1350,7 +1415,8 @@
"matrixSet": "GIBS:EPSG4326_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Land_Surface_Temp_Night"
},
"MLS_SO2_147hPa_Day": {
"startDate": "2013-05-09",
@@ -1366,7 +1432,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_SO2_147hPa_Day"
},
"MODIS_Aqua_SurfaceReflectance_Bands143": {
"startDate": "2012-05-08",
@@ -1382,7 +1449,8 @@
"matrixSet": "GIBS:EPSG4326_500m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_SurfaceReflectance_Bands143"
},
"AMSRE_Brightness_Temp_89V_Night": {
"startDate": "2002-06-01",
@@ -1426,7 +1494,8 @@
"matrixSet": "GIBS:EPSG3413_1km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Sea_Ice"
},
"MODIS_Aqua_CorrectedReflectance_Bands721": {
"startDate": "2012-05-08",
@@ -1450,7 +1519,8 @@
"matrixSet": "GIBS:EPSG3413_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_CorrectedReflectance_Bands721"
},
"MODIS_Aqua_Cloud_Top_Pressure_Day": {
"startDate": "2012-05-08",
@@ -1466,7 +1536,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Cloud_Top_Pressure_Day"
},
"MODIS_Aqua_Data_No_Data": {
"startDate": "2012-05-08",
@@ -1482,7 +1553,8 @@
"matrixSet": "GIBS:EPSG4326_250m"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Data_No_Data"
},
"MLS_H2O_46hPa_Day": {
"startDate": "2013-05-09",
@@ -1498,7 +1570,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MLS_H2O_46hPa_Day"
},
"MODIS_Aqua_Water_Vapor_5km_Night": {
"startDate": "2012-05-08",
@@ -1514,7 +1587,8 @@
"matrixSet": "GIBS:EPSG4326_2km"
}
},
- "type": "wmts"
+ "type": "wmts",
+ "id": "MODIS_Aqua_Water_Vapor_5km_Night"
}
},
"redirects": {
diff --git a/src/js/Worldview.js b/src/js/Worldview.js
index 4d7954ba7..99b2e70a9 100644
--- a/src/js/Worldview.js
+++ b/src/js/Worldview.js
@@ -7,18 +7,7 @@
// Width boundary in pixels where desktop mode switches to mobile.
ns.TRANSITION_WIDTH = 720;
- ns.LAYER_TYPES = {
- baselayers: {
- id: "baselayers",
- camel: "BaseLayers",
- description: "Base Layers"
- },
- overlays: {
- id: "overlays",
- camel: "Overlays",
- description: "Overlays"
- }
- };
+
/**
* Defines a namespace under Worldview. Each argument is an object path
diff --git a/src/js/layers/wv.layers.active.js b/src/js/layers/wv.layers.active.js
index 53d8c9280..857683fc1 100644
--- a/src/js/layers/wv.layers.active.js
+++ b/src/js/layers/wv.layers.active.js
@@ -23,7 +23,7 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
var aoi = config.aoi;
var model = models.layers;
var paletteWidget = spec.paletteWidget;
- var types = Worldview.LAYER_TYPES;
+ var groups = wv.util.LAYER_GROUPS;
var jsp;
var ICON_VISIBLE = "images/visible.png";
@@ -57,8 +57,8 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
$(self.selector).parent().outerHeight() - tabs_height
);
- $.each(types, function(index, type) {
- renderType($container, type);
+ _.each(groups, function(group) {
+ renderType($container, group);
});
$(self.selector).undelegate(".close" ,'click');
@@ -86,22 +86,22 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
setTimeout(resize, 1);
};
- var renderType = function($parent, type) {
+ var renderType = function($parent, group) {
var $container = $("<div></div>")
- .attr("id", self.id + type.camel)
+ .attr("id", self.id + group.camel)
.addClass("categoryContainer");
var $header = $("<h3></h3>")
.addClass("head")
- .html(type.description);
+ .html(group.description);
var $layers = $("<ul></ul>")
- .attr("id", type.id)
+ .attr("id", group.id)
.addClass(self.id + "category")
.addClass("category");
- $.each(model.forProjection()[type.id], function(index, layer) {
- renderLayer($layers, type, layer);
+ $.each(model.forProjection()[group.id], function(index, layer) {
+ renderLayer($layers, group, layer);
});
$container.append($header);
@@ -110,21 +110,19 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
$parent.append($container);
};
- var renderLayer = function($parent, type, layer, top) {
+ var renderLayer = function($parent, group, layer, top) {
var $layer = $("<li></li>")
- .attr("id", type.id + "-" + Worldview.id(layer.id))
+ .attr("id", group.id + "-" + Worldview.id(layer.id))
.addClass(self.id + "item")
.addClass("item")
- .attr("data-layer", layer.id)
- .attr("data-layer-type", type.id);
+ .attr("data-layer", layer.id);
var $removeButton = $("<a></a>");
var $removeImage = $("<img></img>")
- .attr("id", "close" + type.id + Worldview.id(layer.id))
+ .attr("id", "close" + group.id + Worldview.id(layer.id))
.addClass("close")
.addClass("bank-item-img")
.attr("data-layer", layer.id)
- .attr("data-layer-type", type.id)
.attr("title", "Remove Layer")
.attr("src", "images/close-x.png");
$removeButton.append($removeImage);
@@ -156,7 +154,7 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
$layer.append($("<p></p>").html(layer.subtitle));
if ( layer.rendered ) {
- renderLegend($layer, type, layer);
+ renderLegend($layer, group, layer);
}
if ( top ) {
$parent.prepend($layer);
@@ -165,7 +163,7 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
}
};
- var renderLegend = function($parent, type, layer) {
+ var renderLegend = function($parent, group, layer) {
var $div = $("<div></div>");
var $container = $("<span></span>")
.addClass("palette");
@@ -220,17 +218,16 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
labelHeight += $(this).outerHeight(true);
});
container_height -= labelHeight;
- var types = ["baselayers", "overlays"];
- $.each(types, function(i, type) {
+ $.each(["baselayers", "overlays"], function(i, group) {
var actual_height = 0;
var count = 0;
- $('#' + type + ' li').each(function() {
+ $('#' + group + ' li').each(function() {
actual_height += $(this).outerHeight(true);
count++;
});
heights.push({
- name: type,
+ name: group,
height: actual_height,
count: count
});
@@ -280,23 +277,22 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
var removeLayer = function(event) {
var $target = $(event.target);
- model.remove($target.attr("data-layer-type"),
- $target.attr("data-layer"));
+ model.remove($target.attr("data-layer"));
};
- var onLayerRemoved = function(layer, type) {
- var layerSelector = "#" + type + "-" + Worldview.id(layer.id);
+ var onLayerRemoved = function(layer) {
+ var layerSelector = "#" + layer.group + "-" + Worldview.id(layer.id);
$(layerSelector).remove();
adjustCategoryHeights();
};
- var onLayerAdded = function(layer, type) {
- var $container = $("#" + type);
+ var onLayerAdded = function(layer) {
+ var $container = $("#" + layer.group);
var api = $container.data("jsp");
if ( api ) {
$container = api.getContentPane();
}
- renderLayer($container, types[type], layer, "top");
+ renderLayer($container, groups[layer.group], layer, "top");
if ( layer.rendered ) {
renderLegendCanvas(layer);
}
@@ -316,15 +312,14 @@ wv.layers.active = wv.layers.active || function(models, config, spec) {
var $target = ui.item;
var $next = $target.next();
if ( $next.length ) {
- model.moveBefore($target.attr("data-layer-type"),
- $target.attr("data-layer"), $next.attr("data-layer"));
+ model.moveBefore($target.attr("data-layer"),
+ $next.attr("data-layer"));
} else {
- model.pushToBottom($target.attr("data-layer-type"),
- $target.attr("data-layer"));
+ model.pushToBottom($target.attr("data-layer"));
}
};
- var onLayerUpdate = function(type, layer, newIndex) {
+ var onLayerUpdate = function(group, layer, newIndex) {
// Scroll pane can be kind of glitchy, so just show what the
// current state is.
// Timeout prevents redraw artifacts
diff --git a/src/js/layers/wv.layers.add.js b/src/js/layers/wv.layers.add.js
index 3504f6f84..4ca1ff241 100644
--- a/src/js/layers/wv.layers.add.js
+++ b/src/js/layers/wv.layers.add.js
@@ -82,7 +82,7 @@ wv.layers.add = wv.layers.add || function(models, config) {
setTimeout(resize, 1);
};
- var renderType = function($parent, type, header, camelCase) {
+ var renderType = function($parent, group, header, camelCase) {
var $container = $("<div></div>")
.attr("id", self.id + camelCase)
.addClass("categoryContainer");
@@ -92,13 +92,13 @@ wv.layers.add = wv.layers.add || function(models, config) {
.html(header);
var $element = $("<ul></ul>")
- .attr("id", self.id + type)
+ .attr("id", self.id + group)
.addClass(self.id + "category")
.addClass("category")
.addClass("scroll-pane");
- $.each(config.layerOrder[type], function(index, layerId) {
- renderLayer($element, type, layerId);
+ $.each(config.layerOrder[group], function(index, layerId) {
+ renderLayer($element, group, layerId);
});
$container.append($header);
@@ -106,7 +106,7 @@ wv.layers.add = wv.layers.add || function(models, config) {
$parent.append($container);
};
- var renderLayer = function($parent, type, layerId) {
+ var renderLayer = function($parent, group, layerId) {
var layer = config.layers[layerId];
if ( !layer ) {
console.warn("Skipping unknown layer", layerId);
@@ -135,12 +135,11 @@ wv.layers.add = wv.layers.add || function(models, config) {
.attr("id", Worldview.id(layer.id))
.attr("value", layer.id)
.attr("type", "checkbox")
- .attr("data-layer", layer.id)
- .attr("data-layer-type", type);
- if ( type === "baselayers" ) {
- $checkbox.attr("name", type);
+ .attr("data-layer", layer.id);
+ if ( group === "baselayers" ) {
+ $checkbox.attr("name", group);
}
- if ( model.isActive(type, layer.id) ) {
+ if ( model.isActive(layer.id) ) {
$checkbox.attr("checked", "checked");
}
@@ -164,10 +163,10 @@ wv.layers.add = wv.layers.add || function(models, config) {
});
container_height -= labelHeight;
- $.each(["baselayers", "overlays"], function(i, type) {
+ $.each(["baselayers", "overlays"], function(i, group) {
var actual_height = 0;
var count = 0;
- $(self.selector + type + ' li').each(function() {
+ $(self.selector + group + ' li').each(function() {
if ( $(this).is(":visible") ) {
actual_height += $(this).outerHeight(true);
count++;
@@ -175,7 +174,7 @@ wv.layers.add = wv.layers.add || function(models, config) {
});
heights.push({
- name: self.id + type,
+ name: self.id + group,
height: actual_height,
count: count
});
@@ -234,13 +233,11 @@ wv.layers.add = wv.layers.add || function(models, config) {
if ( $target.is(':checked') ) {
$target.attr('checked', false);
- model.remove($target.attr("data-layer-type"),
- $target.attr("data-layer"));
+ model.remove($target.attr("data-layer"));
} else {
$target.attr('checked', true);
- model.add($target.attr("data-layer-type"),
- $target.attr("data-layer"));
- }
+ model.add($target.attr("data-layer"));
+ }
};
var onLayerAdded = function(layer) {
diff --git a/src/js/layers/wv.layers.model.js b/src/js/layers/wv.layers.model.js
index ad9654ddf..352569dd6 100644
--- a/src/js/layers/wv.layers.model.js
+++ b/src/js/layers/wv.layers.model.js
@@ -31,14 +31,21 @@ wv.layers.model = wv.layers.model || function(models, config) {
self.visible = {};
var init = function() {
- $.each(config.defaults.startingLayers, function(type, layers) {
- $.each(layers, function(index, layer) {
- self.add(type, layer.id, layer.hidden);
- });
- });
- $.each(config.layers, function(id, layer) {
- layer.id = id;
+ // FIXME: Prune out incomplete layers for now
+ var layers = _.cloneDeep(config.layers);
+ _.each(layers, function(layer) {
+ if ( !layer.group ) {
+ delete config.layers[layer.id];
+ }
});
+
+ if ( config.defaults && config.defaults.startingLayers ) {
+ _.each(config.defaults.startingLayers, function(layers, type) {
+ _.each(layers, function(layer) {
+ self.add(layer.id, layer.hidden);
+ });
+ });
+ }
};
self.forProjection = function(proj) {
@@ -57,6 +64,33 @@ wv.layers.model = wv.layers.model || function(models, config) {
return results;
};
+ self.dateRange = function(proj) {
+ proj = proj || models.proj.selected.id;
+ var min = Number.MAX_VALUE;
+ var max = 0;
+ var range = false;
+ _.each(self.active, function(layers, type) {
+ _.each(layers, function(layer) {
+ if ( layer.startDate ) {
+ range = true;
+ var start = wv.util.parseDateUTC(layer.startDate).getTime();
+ min = Math.min(min, start);
+ }
+ if ( layer.endDate ) {
+ range = true;
+ var end = wv.util.parseDateUTC(layer.endDate).getTime();
+ max = Math.max(max, end);
+ }
+ });
+ });
+ if ( range ) {
+ return {
+ min: new Date(min),
+ max: new Date(max)
+ };
+ };
+ };
+
self.count = function(type, proj) {
proj = proj || models.proj.selected.id;
var layers = self.forProjection(proj);
@@ -69,35 +103,36 @@ wv.layers.model = wv.layers.model || function(models, config) {
self.count("overlays", proj);
};
- self.add = function(type, id, hidden) {
+ self.add = function(id, hidden) {
var layer = getLayer(id);
- if ( $.inArray(layer, self.active[type]) >= 0 ) {
+ if ( $.inArray(layer, self.active[layer.group]) >= 0 ) {
return;
}
- self.active[type].unshift(layer);
+ self.active[layer.group].unshift(layer);
hidden = hidden || false;
self.visible[id] = !hidden;
- self.events.trigger("add", layer, type);
+ self.events.trigger("add", layer);
};
- self.remove = function(type, id) {
+ self.remove = function(id) {
var layer = getLayer(id);
- var index = $.inArray(layer, self.active[type]);
+ var index = $.inArray(layer, self.active[layer.group]);
if ( index >= 0 ) {
- self.active[type].splice(index, 1);
+ self.active[layer.group].splice(index, 1);
delete self.visible[id];
- self.events.trigger("remove", layer, type);
+ self.events.trigger("remove", layer);
}
};
- self.replace = function(type, idOld, idNew) {
+ self.replace = function(idOld, idNew) {
var oldLayer = getLayer(idOld);
- var index = $.inArray(oldLayer, self.active[type]);
+ var group = oldLayer.group;
+ var index = $.inArray(oldLayer, self.active[group]);
if ( index < 0 ) {
return;
}
var newLayer = getLayer(idNew);
- self.active[type][index] = newLayer;
+ self.active[group][index] = newLayer;
delete self.visible[idOld];
self.visible[idNew] = true;
self.events.trigger("update");
@@ -115,35 +150,36 @@ wv.layers.model = wv.layers.model || function(models, config) {
});
};
- self.pushToBottom = function(type, id) {
+ self.pushToBottom = function(id) {
var layer = getLayer(id);
- var oldIndex = $.inArray(layer, self.active[type]);
+ var oldIndex = $.inArray(layer, self.active[layer.group]);
if ( oldIndex < 0 ) {
throw new Error("Layer is not active: " + id);
}
self.active[type].splice(oldIndex, 1);
self.active[type].push(layer);
- self.events.trigger("move", type, layer, self.active[type].length - 1);
+ self.events.trigger("update", layer, self.active[layer.group].length - 1);
};
- self.moveBefore = function(type, source, target) {
+ self.moveBefore = function(source, target) {
var sourceLayer = getLayer(source);
var targetLayer = getLayer(target);
- var sourceIndex = $.inArray(sourceLayer, self.active[type]);
+ var group = sourceLayer.group;
+ var sourceIndex = $.inArray(sourceLayer, self.active[group]);
if ( sourceIndex < 0 ) {
throw new Error("Layer is not active: " + source);
}
- var targetIndex = $.inArray(targetLayer, self.active[type]);
+ var targetIndex = $.inArray(targetLayer, self.active[group]);
if ( targetIndex < 0 ) {
throw new Error("Layer is not active: " + target);
}
- self.active[type].splice(targetIndex, 0, sourceLayer);
+ self.active[group].splice(targetIndex, 0, sourceLayer);
if ( sourceIndex > targetIndex ) {
sourceIndex++;
}
- self.active[type].splice(sourceIndex, 1);
- self.events.trigger("move", type, sourceLayer, targetIndex);
+ self.active[group].splice(sourceIndex, 1);
+ self.events.trigger("update", sourceLayer, targetIndex);
};
self.setVisibility = function(id, visible) {
@@ -154,10 +190,11 @@ wv.layers.model = wv.layers.model || function(models, config) {
}
};
- self.isActive = function(type, id) {
+ self.isActive = function(id) {
var answer = false;
- $.each(self.active[type], function(index, layer) {
- if ( id === layer.id ) {
+ var layer = getLayer(id);
+ $.each(self.active[layer.group], function(index, l) {
+ if ( id === l.id ) {
answer = true;
return false;
}
diff --git a/src/js/proj/wv.proj.model.js b/src/js/proj/wv.proj.model.js
index 2a706a2f5..3874e8bee 100644
--- a/src/js/proj/wv.proj.model.js
+++ b/src/js/proj/wv.proj.model.js
@@ -25,7 +25,9 @@ wv.proj.model = wv.proj.model || function(config) {
self.events = wv.util.events();
var init = function() {
- self.select(config.defaults.projection);
+ if ( config.defaults && config.defaults.projection ) {
+ self.select(config.defaults.projection);
+ }
_.each(config.projections, function(proj) {
self.register(proj.crs, proj.proj4);
});
diff --git a/src/js/util/wv.util.js b/src/js/util/wv.util.js
index f649e623a..0c81f17e2 100644
--- a/src/js/util/wv.util.js
+++ b/src/js/util/wv.util.js
@@ -22,6 +22,24 @@ var wv = wv || {};
*/
wv.util = (function(self) {
+ /**
+ * Layer groups: baselayers and overlays
+ *
+ * @attribute LAYER_GROUPS
+ */
+ self.LAYER_GROUPS = {
+ baselayers: {
+ id: "baselayers",
+ camel: "BaseLayers",
+ description: "Base Layers"
+ },
+ overlays: {
+ id: "overlays",
+ camel: "Overlays",
+ description: "Overlays"
+ }
+ };
+
/**
* Creates an object representation of a query string.
*
diff --git a/test/layers/wv.layers.model-test.js b/test/layers/wv.layers.model-test.js
new file mode 100644
index 000000000..834406e4a
--- /dev/null
+++ b/test/layers/wv.layers.model-test.js
@@ -0,0 +1,76 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 - 2014 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+
+buster.testCase("wv.layers.model", {
+
+ config: null,
+ models: null,
+ model: null,
+
+ setUp: function() {
+ this.config = {
+ defaults: {
+ projection: "geographic"
+ },
+ projections: {
+ "arctic": {},
+ "geographic": {}
+ },
+ layers: {
+ "layer1": {
+ id: "layer1",
+ startDate: "2000-01-01",
+ endDate: "2002-01-01",
+ group: "overlays"
+ },
+ "layer2": {
+ id: "layer2",
+ startDate: "2001-01-01",
+ endDate: "2003-01-01",
+ group: "overlays"
+ },
+ "static: {
+ id: "static",
+ group: "overlays"
+ }
+ }
+ };
+ this.models = {};
+ this.models.proj = wv.proj.model(this.config);
+ this.models.layers = wv.layers.model(this.models, this.config);
+ this.model = this.models.layers;
+ },
+
+ "Date range with one layer": function() {
+ this.model.add("layer1");
+ var range = this.model.dateRange();
+ buster.assert.equals(range.min.getTime(),
+ new Date(Date.UTC(2000, 0, 1)).getTime());
+ buster.assert.equals(range.max.getTime(),
+ new Date(Date.UTC(2002, 0, 1)).getTime());
+ },
+
+ "Date range with two layers": function() {
+ this.model.add("layer1");
+ this.model.add("layer2");
+ var range = this.model.dateRange();
+ buster.assert.equals(range.min.getTime(),
+ new Date(Date.UTC(2000, 0, 1)).getTime());
+ buster.assert.equals(range.max.getTime(),
+ new Date(Date.UTC(2003, 0, 1)).getTime());
+ },
+
+ "No date range with static": function() {
+ this.model.add("static");
+ buster.refute(this.model.dateRange());
+ }
+
+});
diff --git a/test/proj/wv.proj.change-test.js b/test/proj/wv.proj.change-test.js
index 62760cf02..f7f78e28a 100644
--- a/test/proj/wv.proj.change-test.js
+++ b/test/proj/wv.proj.change-test.js
@@ -47,6 +47,15 @@ buster.testCase("wv.proj.change", {
};
this.stub(wv.ui, "notify");
this.stub(window, "$").returns({ on: this.stub() });
+
+ // FIXME: Remove this once refactoring is complete
+ window.Worldview = {};
+ window.Worldview.Map = {};
+ window.Worldview.Map.COORDINATE_CONTROLS = {
+ arctic: {},
+ antarctic: {},
+ geographic: {}
+ };
},
"Initializes with new projection": function() {