giswqs commited on
Commit
1ba1782
1 Parent(s): 2cd1e07

Fix pre-commit error

Browse files
pages/00_home.py CHANGED
@@ -6,7 +6,7 @@ def Page():
6
  with solara.Column(align="center"):
7
  markdown = """
8
  ## Earth Engine Web Apps
9
-
10
  ### Introduction
11
 
12
  **A collection of Earth Engine web apps developed using [Solara](https://github.com/widgetti/solara) and geemap**
@@ -15,7 +15,7 @@ def Page():
15
  - GitHub: <https://github.com/opengeos/solara-geemap>
16
  - Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geemap>
17
 
18
-
19
  ### How to deploy this app on Hugging Face Spaces
20
 
21
  1. Go to <https://huggingface.co/spaces/giswqs/solara-geemap/tree/main> and duplicate the space to your own space.
 
6
  with solara.Column(align="center"):
7
  markdown = """
8
  ## Earth Engine Web Apps
9
+
10
  ### Introduction
11
 
12
  **A collection of Earth Engine web apps developed using [Solara](https://github.com/widgetti/solara) and geemap**
 
15
  - GitHub: <https://github.com/opengeos/solara-geemap>
16
  - Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geemap>
17
 
18
+
19
  ### How to deploy this app on Hugging Face Spaces
20
 
21
  1. Go to <https://huggingface.co/spaces/giswqs/solara-geemap/tree/main> and duplicate the space to your own space.
pages/02_inspector.py CHANGED
@@ -13,27 +13,27 @@ class Map(geemap.Map):
13
 
14
  def add_ee_data(self):
15
  # Add Earth Engine dataset
16
- dem = ee.Image('USGS/SRTMGL1_003')
17
- landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003').select(
18
- ['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
19
  )
20
  states = ee.FeatureCollection("TIGER/2018/States")
21
 
22
  # Set visualization parameters.
23
  vis_params = {
24
- 'min': 0,
25
- 'max': 4000,
26
- 'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],
27
  }
28
 
29
  # Add Earth Engine layers to Map
30
  self.addLayer(
31
  landsat7,
32
- {'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200, 'gamma': 2.0},
33
- 'Landsat 7',
34
  True,
35
  )
36
- self.addLayer(dem, vis_params, 'SRTM DEM', True, 1)
37
  self.addLayer(states, {}, "US States")
38
 
39
 
 
13
 
14
  def add_ee_data(self):
15
  # Add Earth Engine dataset
16
+ dem = ee.Image("USGS/SRTMGL1_003")
17
+ landsat7 = ee.Image("LANDSAT/LE7_TOA_5YEAR/1999_2003").select(
18
+ ["B1", "B2", "B3", "B4", "B5", "B7"]
19
  )
20
  states = ee.FeatureCollection("TIGER/2018/States")
21
 
22
  # Set visualization parameters.
23
  vis_params = {
24
+ "min": 0,
25
+ "max": 4000,
26
+ "palette": ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"],
27
  }
28
 
29
  # Add Earth Engine layers to Map
30
  self.addLayer(
31
  landsat7,
32
+ {"bands": ["B4", "B3", "B2"], "min": 20, "max": 200, "gamma": 2.0},
33
+ "Landsat 7",
34
  True,
35
  )
36
+ self.addLayer(dem, vis_params, "SRTM DEM", True, 1)
37
  self.addLayer(states, {}, "US States")
38
 
39
 
pages/03_plotting.py CHANGED
@@ -11,23 +11,23 @@ class Map(geemap.Map):
11
  self.add_plot_gui()
12
 
13
  def add_ee_data(self):
14
- landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003').select(
15
- ['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
16
  )
17
 
18
- landsat_vis = {'bands': ['B4', 'B3', 'B2'], 'gamma': 1.4}
19
  self.addLayer(landsat7, landsat_vis, "Landsat")
20
 
21
- hyperion = ee.ImageCollection('EO1/HYPERION').filter(
22
- ee.Filter.date('2016-01-01', '2017-03-01')
23
  )
24
 
25
  hyperion_vis = {
26
- 'min': 1000.0,
27
- 'max': 14000.0,
28
- 'gamma': 2.5,
29
  }
30
- self.addLayer(hyperion, hyperion_vis, 'Hyperion')
31
 
32
 
33
  @solara.component
 
11
  self.add_plot_gui()
12
 
13
  def add_ee_data(self):
14
+ landsat7 = ee.Image("LANDSAT/LE7_TOA_5YEAR/1999_2003").select(
15
+ ["B1", "B2", "B3", "B4", "B5", "B7"]
16
  )
17
 
18
+ landsat_vis = {"bands": ["B4", "B3", "B2"], "gamma": 1.4}
19
  self.addLayer(landsat7, landsat_vis, "Landsat")
20
 
21
+ hyperion = ee.ImageCollection("EO1/HYPERION").filter(
22
+ ee.Filter.date("2016-01-01", "2017-03-01")
23
  )
24
 
25
  hyperion_vis = {
26
+ "min": 1000.0,
27
+ "max": 14000.0,
28
+ "gamma": 2.5,
29
  }
30
+ self.addLayer(hyperion, hyperion_vis, "Hyperion")
31
 
32
 
33
  @solara.component
pages/04_split_map.py CHANGED
@@ -11,25 +11,25 @@ class Map(geemap.Map):
11
 
12
  def add_ee_data(self):
13
  # Select the eight NLCD epochs after 2000.
14
- years = ['2001', '2004', '2006', '2008', '2011', '2013', '2016', '2019']
15
 
16
  # Get an NLCD image by year.
17
  def getNLCD(year):
18
  # Import the NLCD collection.
19
- dataset = ee.ImageCollection('USGS/NLCD_RELEASES/2019_REL/NLCD')
20
 
21
  # Filter the collection by year.
22
- nlcd = dataset.filter(ee.Filter.eq('system:index', year)).first()
23
 
24
  # Select the land cover band.
25
- landcover = nlcd.select('landcover')
26
  return landcover
27
 
28
  ## Create an NLCD image collection for the selected years.
29
  collection = ee.ImageCollection(ee.List(years).map(lambda year: getNLCD(year)))
30
 
31
  # Create a list of labels to populate the dropdown list.
32
- labels = [f'NLCD {year}' for year in years]
33
 
34
  # Add a split-panel map for visualizing NLCD land cover change.
35
  self.ts_inspector(
@@ -41,7 +41,10 @@ class Map(geemap.Map):
41
 
42
  # Add the NLCD legend to the map.
43
  self.add_legend(
44
- title='NLCD Land Cover Type', builtin_legend='NLCD', height="460px", add_header=False
 
 
 
45
  )
46
 
47
 
 
11
 
12
  def add_ee_data(self):
13
  # Select the eight NLCD epochs after 2000.
14
+ years = ["2001", "2004", "2006", "2008", "2011", "2013", "2016", "2019"]
15
 
16
  # Get an NLCD image by year.
17
  def getNLCD(year):
18
  # Import the NLCD collection.
19
+ dataset = ee.ImageCollection("USGS/NLCD_RELEASES/2019_REL/NLCD")
20
 
21
  # Filter the collection by year.
22
+ nlcd = dataset.filter(ee.Filter.eq("system:index", year)).first()
23
 
24
  # Select the land cover band.
25
+ landcover = nlcd.select("landcover")
26
  return landcover
27
 
28
  ## Create an NLCD image collection for the selected years.
29
  collection = ee.ImageCollection(ee.List(years).map(lambda year: getNLCD(year)))
30
 
31
  # Create a list of labels to populate the dropdown list.
32
+ labels = [f"NLCD {year}" for year in years]
33
 
34
  # Add a split-panel map for visualizing NLCD land cover change.
35
  self.ts_inspector(
 
41
 
42
  # Add the NLCD legend to the map.
43
  self.add_legend(
44
+ title="NLCD Land Cover Type",
45
+ builtin_legend="NLCD",
46
+ height="460px",
47
+ add_header=False,
48
  )
49
 
50
 
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  geemap
2
- solara
3
  geopandas
4
- pydantic< 2.0
 
 
1
  geemap
 
2
  geopandas
3
+ pydantic< 2.0
4
+ solara