rhamon-garcia commited on
Commit
ad53bcb
·
verified ·
1 Parent(s): e6bbff6

Upload 30 files

Browse files
.gitattributes CHANGED
@@ -1,35 +1,35 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.github/workflows/sync-hf.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+ lfs: true
17
+ - name: Push to hub
18
+ env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push --force https://giswqs:[email protected]/spaces/giswqs/solara-geemap main
.gitignore ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+ private/
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # poetry
99
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103
+ #poetry.lock
104
+
105
+ # pdm
106
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107
+ #pdm.lock
108
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109
+ # in version control.
110
+ # https://pdm.fming.dev/#use-with-ide
111
+ .pdm.toml
112
+
113
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114
+ __pypackages__/
115
+
116
+ # Celery stuff
117
+ celerybeat-schedule
118
+ celerybeat.pid
119
+
120
+ # SageMath parsed files
121
+ *.sage.py
122
+
123
+ # Environments
124
+ .env
125
+ .venv
126
+ env/
127
+ venv/
128
+ ENV/
129
+ env.bak/
130
+ venv.bak/
131
+
132
+ # Spyder project settings
133
+ .spyderproject
134
+ .spyproject
135
+
136
+ # Rope project settings
137
+ .ropeproject
138
+
139
+ # mkdocs documentation
140
+ /site
141
+
142
+ # mypy
143
+ .mypy_cache/
144
+ .dmypy.json
145
+ dmypy.json
146
+
147
+ # Pyre type checker
148
+ .pyre/
149
+
150
+ # pytype static type analyzer
151
+ .pytype/
152
+
153
+ # Cython debug symbols
154
+ cython_debug/
155
+
156
+ # PyCharm
157
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
160
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
161
+ #.idea/
.pre-commit-config.yaml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: check-toml
6
+ - id: check-yaml
7
+ - id: end-of-file-fixer
8
+ types: [python]
9
+ - id: trailing-whitespace
10
+ - id: requirements-txt-fixer
11
+ - id: check-added-large-files
12
+ args: ["--maxkb=500"]
13
+
14
+ - repo: https://github.com/psf/black
15
+ rev: 24.10.0
16
+ hooks:
17
+ - id: black-jupyter
18
+ language_version: python3
19
+
20
+ - repo: https://github.com/codespell-project/codespell
21
+ rev: v2.3.0
22
+ hooks:
23
+ - id: codespell
24
+ args:
25
+ [
26
+ "--ignore-words-list=gis,timeseries,sav,slowy",
27
+ "--skip=*.json,*.csv",
28
+ ]
29
+
30
+ - repo: https://github.com/kynan/nbstripout
31
+ rev: 0.7.1
32
+ hooks:
33
+ - id: nbstripout
CSVs/esa_stats_ucs_rj.csv ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Class_60,Class_50,Class_40,Class_95,Class_30,Class_20,Class_10,Class_90,Class_80,Class_sum,num_mapa_1,tipo,categoria,jurisdicao,nome,area_ha,criacao,shape_leng,amortecime,shape_area,plano_mane,num_mapa,rotulo,ogc_fid,escala,system:index
2
+ 0.0,0.0,0.0,0.0,0.3069725711356063,0.0,0.6930274288643938,0.0,0.0,78.02,3.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DA MARIA COMPRIDA,7803.43358398,2023,1.62790463007,N�O,0.00684311649,N�O,40,MONA DA SERRA DA MARIA COMPRIDA,39,1:25.000,00000000000000000026
3
+ 5.391804457225018E-4,0.007728253055355859,8.986340762041698E-4,0.0,0.34983824586628326,0.0,0.5125808770668584,0.0,0.12841480948957584,111.28,19.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL DO MEDIO PARAIBA,11137.1971838,2016,6.13493591535,N�O,0.00976335248,N�O,21,REVIS MEDIO PARAIBA,2,1:25.000,00000000000000000001
4
+ 8.026487408447877E-4,3.009932778167954E-4,0.0,0.00451489916725193,0.009832447075348649,0.0,0.9507374335306511,1.0033109260559847E-4,0.03371124711548108,99.67000000000002,24.0,PROTECAO INTEGRAL,RESEC,ESTADUAL,RESERVA ECOLOGICA ESTADUAL DA JUATINGA,9967.24995917,1992,0.71060414957,N�O,0.0087980555,N�O,4,RESEC DA JUATINGA,19,Sem Info,00000000000000000012
5
+ 0.0,0.0,0.0,0.0,0.0666211914506594,0.0,0.9333788085493406,0.0,0.0,43.98,16.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO MENDANHA,4399.10221912,2013,0.51140355655,N�O,0.00386942761,N�O,20,PE DO MENDANHA,28,1:25.000,0000000000000000001b
6
+ 0.020002424536307427,0.0018184022305734026,4.849072614862407E-4,0.0,0.31640198811977205,0.0,0.022426960843738634,0.47448175536428655,0.1643835616438356,82.49000000000001,9.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA LAGOA DO ACU,8249.12246907,2012,0.83549660297,N�O,0.0072137959,N�O,19,PE DA LAGOA DO ACU,29,Sem info,0000000000000000001c
7
+ 0.0,0.0,0.0,0.0,0.1919634703196347,0.0,0.8080365296803653,0.0,0.0,54.75,2.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DA BELEZA,5476.83546917,2017,1.13386248167,N�O,0.00480016717,N�O,2,MONA SERRA DA BELEZA,36,1:25.000,00000000000000000023
8
+ 0.0,0.0,0.0,0.0,0.38666666666666666,0.0,0.6133333333333333,0.0,0.0,6.75,4.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DOS MASCATES,675.057144348,2017,0.18707531907,N�O,5.9145591E-4,N�O,3,MONA SERRA DOS MASCATES,37,1:25.000,00000000000000000024
9
+ 0.0,6.238303181534621E-4,0.0,0.0,0.01517987107506758,0.0,0.98378041172801,0.0,4.158868787689748E-4,48.09,18.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL DA SERRA DA ESTRELA,4811.73100649,2017,1.19033062973,SIM,0.00422505577,N�O,23,REVIS SERRA DA ESTRELA,1,1:25.000,00000000000000000000
10
+ 0.0,0.007434944237918216,0.0,0.0,0.7323420074349443,0.0,0.13382899628252787,0.07806691449814127,0.048327137546468404,2.69,20.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL LAGOA DA TURFEIRA,269.493133194,2016,0.15745976676,SIM,2.3640802E-4,N�O,22,REVIS LAGOA DA TURFEIRA,18,1:25.000,00000000000000000011
11
+ 0.004228329809725159,0.0,0.0,0.0,0.0015101177891875567,0.0,0.9697976442162489,0.001812141347025068,0.02265176683781335,33.11,21.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DA PRAIA DO SUL,3311.84134657,2014,0.42874875901,SIM,0.00292054795,N�O,5,REBIO PRAIA DO SUL,20,1:50.000,00000000000000000013
12
+ 0.025290092234454033,0.005355548943766736,0.0,0.5474561142517108,0.054150550431419225,0.0,0.0559357334126748,0.13002082713478133,0.18179113359119312,33.61,23.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DE GUARATIBA,3361.18585618,1974,0.57256120811,SIM,0.00296089188,SIM,6,REBIO DE GUARATIBA,21,1:10.000,00000000000000000014
13
+ 0.0,0.0,0.0,0.0,0.1422615945805107,2.605523710265764E-4,0.8574778530484628,0.0,0.0,38.379999999999995,22.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DE ARARAS,3837.86536952,1977,0.46092656765,SIM,0.00336699397,SIM,7,REBIO DE ARARAS,22,1:50.000,00000000000000000015
14
+ 0.0,1.537066355154552E-5,1.537066355154552E-5,0.0,0.03269340137413732,0.0,0.9672604866352081,0.0,1.537066355154552E-5,650.5899999999999,17.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DOS TRES PICOS,65080.4867347,2002,9.10823446005,SIM,0.05708718834,SIM,12,PE DOS TRES PICOS,23,1:25.000 ; 1:50.000,00000000000000000016
15
+ 0.0023316817254444766,0.0026231419411250363,0.0,0.0,0.045176333430486736,0.0,0.8799183911396095,0.011075488195861264,0.058874963567473036,34.31,13.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA SERRA DA TIRIRICA,3433.85726444,1991,1.42936381133,SIM,0.00302301907,SIM,13,PE SERRA DA TIRIRICA,24,1:10.000,00000000000000000017
16
+ 0.0,3.3602150537634406E-4,1.6801075268817203E-4,0.0,0.13474462365591397,0.0,0.8644153225806451,0.0,3.3602150537634406E-4,59.52,12.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA SERRA DA CONCORDIA,5952.58474185,2016,1.45942906837,SIM,0.00521852499,N�O,11,PE SERRA DA CONCORDIA,25,1:25.000,00000000000000000018
17
+ 0.0,0.0,2.4872528292500936E-4,0.0,0.02636487999005099,2.4872528292500936E-4,0.9731376694440991,0.0,0.0,80.41,11.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA PEDRA SELADA,8041.49819897,2012,1.66658109283,SIM,0.00704996872,SIM,18,PE DA PEDRA SELADA,26,1:25.000,00000000000000000019
18
+ 0.0,8.005123278898497E-4,0.0,0.0,0.0866954851104707,0.0,0.9123439000960616,0.0,1.6010246557796991E-4,124.91999999999999,10.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA PEDRA BRANCA,12494.2417207,1974,1.8845293254,SIM,0.01100042314,SIM,10,PE DA PEDRA BRANCA,27,Sem Info,0000000000000000001a
19
+ 0.0,0.03636363636363636,0.0,0.0,0.03636363636363636,0.0,0.9272727272727272,0.0,0.0,0.55,15.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO GRAJAU,54.7290261485,1978,0.05699572081,SIM,4.817604E-5,SIM,14,PE DO GRAJAU,30,Sem Info,0000000000000000001d
20
+ 0.0,0.0,0.0,0.0,0.041082399287154715,0.0,0.9589176007128454,0.0,0.0,213.23,14.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO DESENGANO,21325.7388368,1970,1.75405439943,SIM,0.01863237605,SIM,16,PE DO DESENGANO,31,Sem info,0000000000000000001e
21
+ 0.0,0.0,0.0,0.0,0.033803482783074615,0.0,0.9576865495232841,0.0,0.008509967693641164,380.73,5.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL CUNHAMBEBE,38076.6666531,2008,4.36267236111,SIM,0.03351297978,SIM,8,PE CUNHAMBEBE,32,Sem info,0000000000000000001f
22
+ 0.04334995420779485,0.01424646382415793,3.052813676605271E-4,0.0,0.22499236796580846,4.070418235473695E-4,0.45110410094637216,0.14907906787422406,0.1165157219904345,98.27000000000001,7.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA COSTA DO SOL,9828.61554842,2011,3.29315109101,SIM,0.0086502762,SIM,17,PE DA COSTA DO SOL,33,1:25.000,00000000000000000020
23
+ 0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.04,6.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA CHACRINHA,3.71173380368,1969,0.00787836058,SIM,3.26827E-6,SIM,15,PE DA CHACRINHA,34,Sem Info,00000000000000000021
24
+ 0.0,0.0,0.01565377532228361,0.0,0.31491712707182323,0.0,0.5073664825046041,0.14763658686310618,0.014426028238182934,32.58,1.0,PROTECAO INTEGRAL,EEE,ESTADUAL,ESTACAO ECOLOGICA ESTADUAL DE GUAXINDIBA,3259.22390746,2002,0.47132646001,SIM,0.00283886233,SIM,1,EEE DE GUAXINDIBA,35,1:50.000,00000000000000000022
25
+ 0.0012407974191413682,4.1359913971378943E-4,0.0,0.0,0.0052113491603937466,0.0,0.9817189180246506,1.6543965588551577E-4,0.011249896600215073,120.89,8.0,PROTE��O INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA ILHA GRANDE,12083.7871718,1971,1.47283767448,SIM,0.01066040264,SIM,8,PE DA ILHA GRANDE,40,1:50.000 - IBGE,00000000000000000027
26
+ 0.001673375243091674,0.03821627244358012,0.001673375243091674,0.0,0.2827099633666501,0.0,0.6444303740219801,0.02374383790873321,0.00755280177287323,221.10999999999999,35.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO ALTO IGUACU,22111.9931221,2013,0.78497409664,N�O SE APLICA,0.01942446261,SIM,36,APA DO ALTO IGUACU,3,1:25.000,00000000000000000002
27
+ 2.0547593363127344E-4,0.015205219088714235,0.013664149586479685,0.008064930395027483,0.2561257512713824,0.0,0.6718549339908563,0.03333847023167412,0.0015410695022345508,194.67,25.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA BACIA DO RIO MACACU,19502.1400409,2002,33.798675024,N�O SE APLICA,0.01711874796,N�O,27,APA DA BACIA DO RIO MACACU,4,Sem Info,00000000000000000003
28
+ 0.0,0.0,0.004526462395543176,0.0,0.38753481894150416,0.0,0.6079387186629526,0.0,0.0,28.720000000000002,26.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA BACIA DOS FRADES,2871.72642178,1990,0.59921403936,N�O SE APLICA,0.0025174733,N�O,31,APA DOS FRADES,5,1:25.000 ; 1:50.000,00000000000000000004
29
+ 0.0,9.142595925830692E-4,5.714122453644182E-5,0.0,0.07208365475272135,0.0,0.9269449444301592,0.0,0.0,350.01,29.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MACAE DE CIMA,35003.0809078,2001,1.03394504309,N�O SE APLICA,0.03069270346,SIM,30,APA DE MACAE DE CIMA,6,1:50.000,00000000000000000005
30
+ 5.015673981191223E-4,6.269592476489029E-4,0.0,0.0,0.18432601880877741,0.0,0.814294670846395,0.0,2.5078369905956113E-4,79.75,28.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE GERICINO-MENDANHA,7974.14336908,2005,0.66988583505,N�O SE APLICA,0.00701359206,N�O,25,APA DE GERICINO-MENDANHA,7,Sem Info,00000000000000000006
31
+ 0.0,0.0013829072661898929,0.0,0.0039116519815085545,0.04125014816863566,0.0,0.9525860365877751,1.9755818088427042E-4,6.716978150065195E-4,253.09,30.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MANGARATIBA,25312.3537777,1987,2.73219986964,N�O SE APLICA,0.02228427968,SIM,24,APA DE MANGARATIBA,8,1:20.000,00000000000000000007
32
+ 0.1413828689370485,0.0371517027863777,0.0,0.0,0.30856553147574817,0.0010319917440660474,0.42414860681114547,0.04850361197110422,0.039215686274509796,9.690000000000001,31.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MARICA,969.239448931,1984,0.30140385146,N�O SE APLICA,8.5341915E-4,SIM,33,APA DE MARICA,9,Sem info,00000000000000000008
33
+ 0.006794520547945206,0.096,2.1917808219178083E-4,0.0,0.30224657534246574,0.0,0.2533698630136986,0.20076712328767124,0.1406027397260274,91.25,32.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MASSAMBABA,9124.45193908,2011,0.8822736963,N�O SE APLICA,0.00803179984,SIM,32,APA DE MASSAMBABA,10,1:50.000,00000000000000000009
34
+ 0.006665378670788253,0.022024729520865528,0.0,0.0,0.04028207109737248,0.0,0.17793663060278206,0.01642194744976816,0.7366692426584235,103.52000000000001,36.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO PAU-BRASIL,10353.1623171,2002,0.42686675166,N�O SE APLICA,0.00910866994,SIM,28,APA PAU BRASIL,11,1:50.000,0000000000000000000a
35
+ 0.0043668122270742364,0.11185757473967083,0.004702720859926101,0.0,0.5018474974806854,0.0,0.3574067853543837,0.008397715821296609,0.011420893516963388,59.53999999999999,27.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA SERRA DE SAPIATIBA,5955.22943195,1990,0.34376268569,N�O SE APLICA,0.00523829411,SIM,29,APA DA SERRA DE SAPIATIBA,12,1:50.000,0000000000000000000b
36
+ 1.8844812965231321E-4,0.017081476894913246,0.0017364149089391717,0.0,0.3553593302015049,0.0,0.6150408528623925,0.0010903070358455264,0.009503169966752366,742.91,37.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO RIO GUANDU,74295.2023405,2007,3.89480581005,N�O SE APLICA,0.06525411525,N�O,26,APA DO RIO GUANDU,13,1:50.000,0000000000000000000c
37
+ 0.0,0.0,0.0,0.0,0.034482758620689655,0.0,0.8620689655172413,0.0,0.10344827586206895,0.29000000000000004,38.0,USO SUSTENTAVEL,FLOR,ESTADUAL,FLORESTA ESTADUAL JOSE ZAGO,29.1364229911,2016,0.02136871955,N�O SE APLICA,2.549498E-5,N�O,37,FLOE JOSE ZAGO,14,1:25.000,0000000000000000000d
38
+ 0.017441860465116275,0.0697674418604651,0.0,0.0,0.3255813953488372,0.0,0.5581395348837208,0.029069767441860465,0.0,1.7200000000000002,33.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE SEPETIBA II,171.666213409,2004,0.05801156773,N�O SE APLICA,1.5116278E-4,N�O,34,APA DE SEPETIBA II,15,1:10.000,0000000000000000000e
39
+ 0.006845708267509216,0.0,0.0,0.0,0.0010531858873091102,0.0,0.061084781463928386,0.0,0.9310163243812534,18.99,39.0,USO SUSTENTAVEL,RDS,ESTADUAL,RESERVA DE DESENVOLVIMENTO SUSTENTAVEL DO AVENTUREIRO,1899.91188332,2014,0.21453857684,N�O SE APLICA,0.00167576192,N�O,39,RDS DO AVENTUREIRO,16,1:50.000,0000000000000000000f
40
+ 0.005580923389142567,2.536783358701167E-4,0.0,0.0,0.0025367833587011668,0.0,0.0025367833587011668,0.0010147133434804667,0.9880771182141046,39.42,40.0,USO SUSTENTAVEL,RESEX,ESTADUAL,RESERVA EXTRATIVISTA MARINHA DE ITAIPU,3942.53457822,2013,0.4358579572,N�O SE APLICA,0.00347203423,N�O,38,RESEX MARINHA DE ITAIPU,17,1:25.000,00000000000000000010
41
+ 0.0023963788053607887,0.026759563326528804,0.0,0.0176621993432147,0.014555782373302566,0.0,0.8882577438537322,0.0014200763291026895,0.04894825596875833,225.33999999999997,34.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE TAMOIOS,22545.1793314,1986,6.34858345439,N�O SE APLICA,0.01987470585,SIM,35,APA DE TAMOIOS,38,Sem info,00000000000000000025
CSVs/esa_stats_ucs_rj2 - esa_stats_ucs_rj2.csv.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Classes,MONUMENTO NATURAL DA SERRA DA MARIA COMPRIDA,REFUGIO DA VIDA SILVESTRE ESTADUAL DO MEDIO PARAIBA,RESERVA ECOLOGICA ESTADUAL DA JUATINGA,PARQUE ESTADUAL DO MENDANHA,PARQUE ESTADUAL DA LAGOA DO ACU,MONUMENTO NATURAL DA SERRA DA BELEZA,MONUMENTO NATURAL DA SERRA DOS MASCATES,REFUGIO DA VIDA SILVESTRE ESTADUAL DA SERRA DA ESTRELA,REFUGIO DA VIDA SILVESTRE ESTADUAL LAGOA DA TURFEIRA,RESERVA BIOLOGICA ESTADUAL DA PRAIA DO SUL,RESERVA BIOLOGICA ESTADUAL DE GUARATIBA,RESERVA BIOLOGICA ESTADUAL DE ARARAS,PARQUE ESTADUAL DOS TRES PICOS,PARQUE ESTADUAL DA SERRA DA TIRIRICA,PARQUE ESTADUAL DA SERRA DA CONCORDIA,PARQUE ESTADUAL DA PEDRA SELADA,PARQUE ESTADUAL DA PEDRA BRANCA,PARQUE ESTADUAL DO GRAJAU,PARQUE ESTADUAL DO DESENGANO,PARQUE ESTADUAL CUNHAMBEBE,PARQUE ESTADUAL DA COSTA DO SOL,PARQUE ESTADUAL DA CHACRINHA,ESTACAO ECOLOGICA ESTADUAL DE GUAXINDIBA,PARQUE ESTADUAL DA ILHA GRANDE,AREA DE PROTECAO AMBIENTAL DO ALTO IGUACU,AREA DE PROTECAO AMBIENTAL DA BACIA DO RIO MACACU,AREA DE PROTECAO AMBIENTAL DA BACIA DOS FRADES,AREA DE PROTECAO AMBIENTAL DE MACAE DE CIMA,AREA DE PROTECAO AMBIENTAL DE GERICINO-MENDANHA,AREA DE PROTECAO AMBIENTAL DE MANGARATIBA,AREA DE PROTECAO AMBIENTAL DE MARICA,AREA DE PROTECAO AMBIENTAL DE MASSAMBABA,AREA DE PROTECAO AMBIENTAL DO PAU-BRASIL,AREA DE PROTECAO AMBIENTAL DA SERRA DE SAPIATIBA,AREA DE PROTECAO AMBIENTAL DO RIO GUANDU,FLORESTA ESTADUAL JOSE ZAGO,AREA DE PROTECAO AMBIENTAL DE SEPETIBA II,RESERVA DE DESENVOLVIMENTO SUSTENTAVEL DO AVENTUREIRO,RESERVA EXTRATIVISTA MARINHA DE ITAIPU,AREA DE PROTECAO AMBIENTAL DE TAMOIOS
2
+ Área Degradada,0,0.06,0.08,0.0,1.65,0,0,0,0,0.14,0.85,0,0,0.08,0,0,0.0,0,0,0,4.26,0,0,0.15,0.37,0.04,0,0,0.04,0,1.37,0.62,0.69,0.26,0.14,0,0.03,0.13,0.22,0.54
3
+ Área Urbana,0,0.86,0.03,0,0.15,0,0.0,0.03,0.02,0.0,0.18,0,0.01,0.09,0.02,0.0,0.1,0.02,0,0,1.4,0.0,0.0,0.05,8.45,2.96,0,0.32,0.05,0.35,0.36,8.76,2.28,6.66,12.69,0.0,0.12,0,0.01,06.03
4
+ Agricultura,0,0.1,0,0,0.04,0,0,0,0,0,0,0,0.01,0,0.01,0.02,0,0,0,0,0.03,0,0.51,0,0.37,2.66,0.13,0.02,0,0,0,0.02,0,0.28,1.29,0,0,0,0,0
5
+ Manguezais,0,0,0.45,0,0,0,0,0,0,0,18.4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.57,0,0,0,0.99,0,0,0,0,0,0,0,0,0,3.98
6
+ Vegetação rasteira,23.95,38.93,0.98,2.93,26.1,10.51,2.61,0.73,1.97,0.05,1.82,5.46,21.27,1.55,08.02,2.12,10.83,0.02,8.76,12.87,22.11,0,10.26,0.63,62.51,49.86,11.13,25.23,14.7,10.44,2.99,27.58,4.17,29.88,264.0,0.01,0.56,0.02,0.1,3.28
7
+ Vegetação arbustiva,0,0,0,0,0,0,0,0,0,0,0,0.01,0,0,0,0.02,0,0,0,0,0.04,0,0,0,0,0,0,0,0,0,0.01,0,0,0,0,0,0,0,0,0
8
+ Floresta,54.07,57.04,94.76,41.05,1.85,44.24,4.14,47.31,0.36,32.11,1.88,32.91,629.29,30.19,51.45,78.25,113.97,0.51,204.47,364.62,44.33,0.04,16.53,118.68,142.49,130.79,17.46,324.44,64.94,241.09,4.11,23.12,18.42,21.28,456.92,0.25,0.96,1.16,0.1,200.16
9
+ Área Urbana,0,0,0.01,0,39.14,0,0,0,0.21,0.06,4.37,0,0,0.38,0,0,0,0,0,0,14.65,0,4.81,0.02,5.25,6.49,0,0,0,0.05,0.47,18.32,1.7,0.5,0.81,0,0.05,0,0.04,0.32
10
+ Água,0,14.29,3.36,0,13.56,0,0,0.02,0.13,0.75,6.11,0,0.01,02.02,0.02,0,0.02,0,0,3.24,11.45,0,0.47,1.36,1.67,0.3,0.0,0,0.02,0.17,0.38,12.83,76.26,0.68,07.06,0.03,0,17.68,38.95,11.03
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM jupyter/base-notebook:latest
2
+
3
+ RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
4
+ fix-permissions "${CONDA_DIR}" && \
5
+ fix-permissions "/home/${NB_USER}"
6
+
7
+ COPY requirements.txt .
8
+ RUN pip install -r requirements.txt
9
+
10
+ RUN mkdir ./pages
11
+ COPY /pages ./pages
12
+
13
+ ENV PROJ_LIB='/opt/conda/share/proj'
14
+
15
+ USER root
16
+ RUN chown -R ${NB_UID} ${HOME}
17
+ USER ${NB_USER}
18
+
19
+ EXPOSE 8765
20
+
21
+ CMD ["solara", "run", "./pages", "--host=0.0.0.0"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Open Geospatial Solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,12 +1,58 @@
1
- ---
2
- title: Solara Ucs
3
- emoji: 📚
4
- colorFrom: purple
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: cc-by-4.0
9
- short_description: Uso de solo em unidades de conservação estaduais
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Solara Geemap
3
+ emoji: 🏃
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ app_port: 8765
10
+ ---
11
+
12
+ ## Earth Engine Web Apps
13
+
14
+ ### Introduction
15
+
16
+ **A collection of Earth Engine web apps developed using [Solara](https://github.com/widgetti/solara) and geemap**
17
+
18
+ - Web App: <https://giswqs-solara-geemap.hf.space>
19
+ - GitHub: <https://github.com/opengeos/solara-geemap>
20
+ - Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geemap>
21
+
22
+ ### How to deploy this app on Hugging Face Spaces
23
+
24
+ 1. Go to <https://huggingface.co/spaces/giswqs/solara-geemap/tree/main> and duplicate the space to your own space.
25
+
26
+ ![](https://i.imgur.com/gTg4V2x.png)
27
+
28
+ 2. You need to set `EARTHENGINE_TOKEN` in order to use Earth Engine. The token value should be copied from the following file depending on your operating system:
29
+
30
+ ```text
31
+ Windows: C:\\Users\\USERNAME\\.config\\earthengine\\credentials
32
+ Linux: /home/USERNAME/.config/earthengine/credentials
33
+ MacOS: /Users/USERNAME/.config/earthengine/credentials
34
+ ```
35
+
36
+ Simply open the file and copy **ALL** the content to the `EARTHENGINE_TOKEN` environment variable.
37
+
38
+ ![](https://i.imgur.com/i04gzyH.png)
39
+
40
+ ![](https://i.imgur.com/Ex37Ut7.png)
41
+
42
+ Alternatively, you can run the following code to retrieve your Earth Engine token:
43
+
44
+ ```python
45
+ import geemap
46
+ geemap.get_ee_token()
47
+ ```
48
+
49
+ Copy all the content of the printed token and set it as the `EARTHENGINE_TOKEN` environment variable.
50
+
51
+ 3. After the space is built successfully, click the `Embed this Space` menu and find the `Direct URL` for the app, such as <https://giswqs-solara-geemap.hf.space>.
52
+
53
+ ![](https://i.imgur.com/DNM36sk.png)
54
+
55
+ ![](https://i.imgur.com/KX82lSf.png)
56
+
57
+ 4. Add your own apps (\*.py) to the `pages` folder.
58
+ 5. Commit and push your changes to the repository. Wait for the space to be built successfully.
notebooks/01_basic.ipynb ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/01_basic.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import geemap\n",
26
+ "import solara\n",
27
+ "\n",
28
+ "zoom = solara.reactive(4)\n",
29
+ "center = solara.reactive((40, -100))\n",
30
+ "bounds = solara.reactive(None)\n",
31
+ "\n",
32
+ "\n",
33
+ "@solara.component\n",
34
+ "def Page():\n",
35
+ " # Isolation is required to prevent the map from overlapping navigation (when screen width < 960px)\n",
36
+ " with solara.Column(\n",
37
+ " style={\"min-width\": \"500px\", \"height\": \"780px\", \"isolation\": \"isolate\"}\n",
38
+ " ):\n",
39
+ " # solara components support reactive variables\n",
40
+ " solara.SliderInt(label=\"Zoom level\", value=zoom, min=1, max=20)\n",
41
+ " # using 3rd party widget library require wiring up the events manually\n",
42
+ " # using zoom.value and zoom.set\n",
43
+ " geemap.Map.element( # type: ignore\n",
44
+ " zoom=zoom.value,\n",
45
+ " on_zoom=zoom.set,\n",
46
+ " center=center.value,\n",
47
+ " on_center=center.set,\n",
48
+ " on_bounds=bounds.set,\n",
49
+ " scroll_wheel_zoom=True,\n",
50
+ " height=\"600px\",\n",
51
+ " )\n",
52
+ " solara.Text(f\"Zoom: {zoom.value}\")\n",
53
+ " solara.Text(f\"Center: {center.value}\")\n",
54
+ " solara.Text(f\"Bounds: {bounds.value}\")"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "code",
59
+ "execution_count": null,
60
+ "metadata": {},
61
+ "outputs": [],
62
+ "source": [
63
+ "Page()"
64
+ ]
65
+ }
66
+ ],
67
+ "metadata": {
68
+ "kernelspec": {
69
+ "display_name": "geo",
70
+ "language": "python",
71
+ "name": "python3"
72
+ },
73
+ "language_info": {
74
+ "codemirror_mode": {
75
+ "name": "ipython",
76
+ "version": 3
77
+ },
78
+ "file_extension": ".py",
79
+ "mimetype": "text/x-python",
80
+ "name": "python",
81
+ "nbconvert_exporter": "python",
82
+ "pygments_lexer": "ipython3",
83
+ "version": "3.11.8"
84
+ }
85
+ },
86
+ "nbformat": 4,
87
+ "nbformat_minor": 2
88
+ }
notebooks/02_inspector.ipynb ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/02_inspector.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import ee\n",
26
+ "import geemap\n",
27
+ "import solara\n",
28
+ "\n",
29
+ "\n",
30
+ "class Map(geemap.Map):\n",
31
+ " def __init__(self, **kwargs):\n",
32
+ " super().__init__(**kwargs)\n",
33
+ " self.add_ee_data()\n",
34
+ " self.add(\"layer_manager\")\n",
35
+ " self.add(\"inspector\")\n",
36
+ "\n",
37
+ " def add_ee_data(self):\n",
38
+ " # Add Earth Engine dataset\n",
39
+ " dem = ee.Image(\"USGS/SRTMGL1_003\")\n",
40
+ " landsat7 = ee.Image(\"LANDSAT/LE7_TOA_5YEAR/1999_2003\").select(\n",
41
+ " [\"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B7\"]\n",
42
+ " )\n",
43
+ " states = ee.FeatureCollection(\"TIGER/2018/States\")\n",
44
+ "\n",
45
+ " # Set visualization parameters.\n",
46
+ " vis_params = {\n",
47
+ " \"min\": 0,\n",
48
+ " \"max\": 4000,\n",
49
+ " \"palette\": [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"],\n",
50
+ " }\n",
51
+ "\n",
52
+ " # Add Earth Engine layers to Map\n",
53
+ " self.addLayer(\n",
54
+ " landsat7,\n",
55
+ " {\"bands\": [\"B4\", \"B3\", \"B2\"], \"min\": 20, \"max\": 200, \"gamma\": 2.0},\n",
56
+ " \"Landsat 7\",\n",
57
+ " True,\n",
58
+ " )\n",
59
+ " self.addLayer(dem, vis_params, \"SRTM DEM\", True, 1)\n",
60
+ " self.addLayer(states, {}, \"US States\")\n",
61
+ "\n",
62
+ "\n",
63
+ "@solara.component\n",
64
+ "def Page():\n",
65
+ " with solara.Column(style={\"min-width\": \"500px\", \"isolation\": \"isolate\"}):\n",
66
+ " Map.element(\n",
67
+ " center=[40, -100],\n",
68
+ " zoom=4,\n",
69
+ " height=\"600px\",\n",
70
+ " )"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": null,
76
+ "metadata": {},
77
+ "outputs": [],
78
+ "source": [
79
+ "Page()"
80
+ ]
81
+ }
82
+ ],
83
+ "metadata": {
84
+ "kernelspec": {
85
+ "display_name": "geo",
86
+ "language": "python",
87
+ "name": "python3"
88
+ },
89
+ "language_info": {
90
+ "codemirror_mode": {
91
+ "name": "ipython",
92
+ "version": 3
93
+ },
94
+ "file_extension": ".py",
95
+ "mimetype": "text/x-python",
96
+ "name": "python",
97
+ "nbconvert_exporter": "python",
98
+ "pygments_lexer": "ipython3",
99
+ "version": "3.11.8"
100
+ }
101
+ },
102
+ "nbformat": 4,
103
+ "nbformat_minor": 2
104
+ }
notebooks/03_plotting.ipynb ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/03_plotting.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import ee\n",
26
+ "import geemap\n",
27
+ "import solara\n",
28
+ "\n",
29
+ "\n",
30
+ "class Map(geemap.Map):\n",
31
+ " def __init__(self, **kwargs):\n",
32
+ " super().__init__(**kwargs)\n",
33
+ " self.add_ee_data()\n",
34
+ " self.add_plot_gui()\n",
35
+ "\n",
36
+ " def add_ee_data(self):\n",
37
+ " landsat7 = ee.Image(\"LANDSAT/LE7_TOA_5YEAR/1999_2003\").select(\n",
38
+ " [\"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B7\"]\n",
39
+ " )\n",
40
+ "\n",
41
+ " landsat_vis = {\"bands\": [\"B4\", \"B3\", \"B2\"], \"gamma\": 1.4}\n",
42
+ " self.addLayer(landsat7, landsat_vis, \"Landsat\")\n",
43
+ "\n",
44
+ " hyperion = ee.ImageCollection(\"EO1/HYPERION\").filter(\n",
45
+ " ee.Filter.date(\"2016-01-01\", \"2017-03-01\")\n",
46
+ " )\n",
47
+ "\n",
48
+ " hyperion_vis = {\n",
49
+ " \"min\": 1000.0,\n",
50
+ " \"max\": 14000.0,\n",
51
+ " \"gamma\": 2.5,\n",
52
+ " }\n",
53
+ " self.addLayer(hyperion, hyperion_vis, \"Hyperion\")\n",
54
+ "\n",
55
+ "\n",
56
+ "@solara.component\n",
57
+ "def Page():\n",
58
+ " with solara.Column(style={\"min-width\": \"500px\", \"isolation\": \"isolate\"}):\n",
59
+ " Map.element(\n",
60
+ " center=[40, -100],\n",
61
+ " zoom=4,\n",
62
+ " height=\"600px\",\n",
63
+ " )"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "execution_count": null,
69
+ "metadata": {},
70
+ "outputs": [],
71
+ "source": [
72
+ "Page()"
73
+ ]
74
+ }
75
+ ],
76
+ "metadata": {
77
+ "kernelspec": {
78
+ "display_name": "geo",
79
+ "language": "python",
80
+ "name": "python3"
81
+ },
82
+ "language_info": {
83
+ "codemirror_mode": {
84
+ "name": "ipython",
85
+ "version": 3
86
+ },
87
+ "file_extension": ".py",
88
+ "mimetype": "text/x-python",
89
+ "name": "python",
90
+ "nbconvert_exporter": "python",
91
+ "pygments_lexer": "ipython3",
92
+ "version": "3.11.8"
93
+ }
94
+ },
95
+ "nbformat": 4,
96
+ "nbformat_minor": 2
97
+ }
notebooks/04_split_map.ipynb ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/04_split_map.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import ee\n",
26
+ "import geemap\n",
27
+ "import solara\n",
28
+ "\n",
29
+ "\n",
30
+ "class Map(geemap.Map):\n",
31
+ " def __init__(self, **kwargs):\n",
32
+ " super().__init__(**kwargs)\n",
33
+ " self.add_ee_data()\n",
34
+ "\n",
35
+ " def add_ee_data(self):\n",
36
+ " # Select the eight NLCD epochs after 2000.\n",
37
+ " years = [\"2001\", \"2004\", \"2006\", \"2008\", \"2011\", \"2013\", \"2016\", \"2019\"]\n",
38
+ "\n",
39
+ " # Get an NLCD image by year.\n",
40
+ " def getNLCD(year):\n",
41
+ " # Import the NLCD collection.\n",
42
+ " dataset = ee.ImageCollection(\"USGS/NLCD_RELEASES/2019_REL/NLCD\")\n",
43
+ "\n",
44
+ " # Filter the collection by year.\n",
45
+ " nlcd = dataset.filter(ee.Filter.eq(\"system:index\", year)).first()\n",
46
+ "\n",
47
+ " # Select the land cover band.\n",
48
+ " landcover = nlcd.select(\"landcover\")\n",
49
+ " return landcover\n",
50
+ "\n",
51
+ " ## Create an NLCD image collection for the selected years.\n",
52
+ " collection = ee.ImageCollection(ee.List(years).map(lambda year: getNLCD(year)))\n",
53
+ "\n",
54
+ " # Create a list of labels to populate the dropdown list.\n",
55
+ " labels = [f\"NLCD {year}\" for year in years]\n",
56
+ "\n",
57
+ " # Add a split-panel map for visualizing NLCD land cover change.\n",
58
+ " self.ts_inspector(\n",
59
+ " left_ts=collection,\n",
60
+ " right_ts=collection,\n",
61
+ " left_names=labels,\n",
62
+ " right_names=labels,\n",
63
+ " )\n",
64
+ "\n",
65
+ " # Add the NLCD legend to the map.\n",
66
+ " self.add_legend(\n",
67
+ " title=\"NLCD Land Cover Type\",\n",
68
+ " builtin_legend=\"NLCD\",\n",
69
+ " height=\"460px\",\n",
70
+ " add_header=False,\n",
71
+ " )\n",
72
+ "\n",
73
+ "\n",
74
+ "@solara.component\n",
75
+ "def Page():\n",
76
+ " with solara.Column(style={\"min-width\": \"500px\", \"isolation\": \"isolate\"}):\n",
77
+ " Map.element(\n",
78
+ " center=[40, -100],\n",
79
+ " zoom=4,\n",
80
+ " height=\"600px\",\n",
81
+ " )"
82
+ ]
83
+ },
84
+ {
85
+ "cell_type": "code",
86
+ "execution_count": null,
87
+ "metadata": {},
88
+ "outputs": [],
89
+ "source": [
90
+ "Page()"
91
+ ]
92
+ }
93
+ ],
94
+ "metadata": {
95
+ "kernelspec": {
96
+ "display_name": "geo",
97
+ "language": "python",
98
+ "name": "python3"
99
+ },
100
+ "language_info": {
101
+ "codemirror_mode": {
102
+ "name": "ipython",
103
+ "version": 3
104
+ },
105
+ "file_extension": ".py",
106
+ "mimetype": "text/x-python",
107
+ "name": "python",
108
+ "nbconvert_exporter": "python",
109
+ "pygments_lexer": "ipython3",
110
+ "version": "3.11.8"
111
+ }
112
+ },
113
+ "nbformat": 4,
114
+ "nbformat_minor": 2
115
+ }
notebooks/05_timelapse.ipynb ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/05_timelapse.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import geemap\n",
26
+ "import solara\n",
27
+ "\n",
28
+ "\n",
29
+ "class Map(geemap.Map):\n",
30
+ " def __init__(self, **kwargs):\n",
31
+ " super().__init__(**kwargs)\n",
32
+ " self.add_basemap(\"Esri.WorldImagery\")\n",
33
+ " self.add_gui(\"timelapse\", basemap=None)\n",
34
+ "\n",
35
+ "\n",
36
+ "@solara.component\n",
37
+ "def Page():\n",
38
+ " with solara.Column(style={\"min-width\": \"500px\", \"isolation\": \"isolate\"}):\n",
39
+ " Map.element(\n",
40
+ " center=[20, -0],\n",
41
+ " zoom=2,\n",
42
+ " height=\"750px\",\n",
43
+ " zoom_ctrl=False,\n",
44
+ " measure_ctrl=False,\n",
45
+ " )"
46
+ ]
47
+ },
48
+ {
49
+ "cell_type": "code",
50
+ "execution_count": null,
51
+ "metadata": {},
52
+ "outputs": [],
53
+ "source": [
54
+ "Page()"
55
+ ]
56
+ }
57
+ ],
58
+ "metadata": {
59
+ "kernelspec": {
60
+ "display_name": "geo",
61
+ "language": "python",
62
+ "name": "python3"
63
+ },
64
+ "language_info": {
65
+ "codemirror_mode": {
66
+ "name": "ipython",
67
+ "version": 3
68
+ },
69
+ "file_extension": ".py",
70
+ "mimetype": "text/x-python",
71
+ "name": "python",
72
+ "nbconvert_exporter": "python",
73
+ "pygments_lexer": "ipython3",
74
+ "version": "3.11.8"
75
+ }
76
+ },
77
+ "nbformat": 4,
78
+ "nbformat_minor": 2
79
+ }
notebooks/06_timeseries.ipynb ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/06_timeseries.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import geemap\n",
26
+ "import ipywidgets as widgets\n",
27
+ "import solara\n",
28
+ "from geemap import get_current_year, jslink_slider_label\n",
29
+ "\n",
30
+ "\n",
31
+ "class Map(geemap.Map):\n",
32
+ " def __init__(self, **kwargs):\n",
33
+ " super().__init__(**kwargs)\n",
34
+ " self.add_basemap(\"Esri.WorldImagery\")\n",
35
+ " self.add_ts_gui(position=\"topright\")\n",
36
+ "\n",
37
+ " def clean_up(self):\n",
38
+ " if hasattr(self, \"slider_ctrl\") and self.slider_ctrl is not None:\n",
39
+ " self.remove(self.slider_ctrl)\n",
40
+ " delattr(self, \"slider_ctrl\")\n",
41
+ "\n",
42
+ " layer = self.find_layer(\"Time series\")\n",
43
+ " if layer is not None:\n",
44
+ " self.remove(layer)\n",
45
+ " layer = self.find_layer(\"Image X\")\n",
46
+ " if layer is not None:\n",
47
+ " self.remove(layer)\n",
48
+ "\n",
49
+ " draw_layer = self.find_layer(\"Drawn Features\")\n",
50
+ " if draw_layer is not None:\n",
51
+ " self.remove(draw_layer)\n",
52
+ "\n",
53
+ " def add_ts_gui(self, position=\"topright\", **kwargs):\n",
54
+ "\n",
55
+ " widget_width = \"350px\"\n",
56
+ " padding = \"0px 0px 0px 5px\" # upper, right, bottom, left\n",
57
+ " style = {\"description_width\": \"initial\"}\n",
58
+ " current_year = get_current_year()\n",
59
+ "\n",
60
+ " collection = widgets.Dropdown(\n",
61
+ " options=[\n",
62
+ " \"Landsat TM-ETM-OLI Surface Reflectance\",\n",
63
+ " ],\n",
64
+ " value=\"Landsat TM-ETM-OLI Surface Reflectance\",\n",
65
+ " description=\"Collection:\",\n",
66
+ " layout=widgets.Layout(width=widget_width, padding=padding),\n",
67
+ " style=style,\n",
68
+ " )\n",
69
+ " bands = widgets.Dropdown(\n",
70
+ " description=\"Bands:\",\n",
71
+ " options=[\n",
72
+ " \"Red/Green/Blue\",\n",
73
+ " \"NIR/Red/Green\",\n",
74
+ " \"SWIR2/SWIR1/NIR\",\n",
75
+ " \"NIR/SWIR1/Red\",\n",
76
+ " \"SWIR2/NIR/Red\",\n",
77
+ " \"SWIR2/SWIR1/Red\",\n",
78
+ " \"SWIR1/NIR/Blue\",\n",
79
+ " \"NIR/SWIR1/Blue\",\n",
80
+ " \"SWIR2/NIR/Green\",\n",
81
+ " \"SWIR1/NIR/Red\",\n",
82
+ " ],\n",
83
+ " value=\"SWIR1/NIR/Red\",\n",
84
+ " style=style,\n",
85
+ " layout=widgets.Layout(width=\"195px\", padding=padding),\n",
86
+ " )\n",
87
+ "\n",
88
+ " frequency = widgets.Dropdown(\n",
89
+ " description=\"Frequency:\",\n",
90
+ " options=[\"year\", \"quarter\", \"month\"],\n",
91
+ " value=\"year\",\n",
92
+ " style=style,\n",
93
+ " layout=widgets.Layout(width=\"150px\", padding=padding),\n",
94
+ " )\n",
95
+ "\n",
96
+ " start_year = widgets.IntSlider(\n",
97
+ " description=\"Start Year:\",\n",
98
+ " value=1984,\n",
99
+ " min=1984,\n",
100
+ " max=current_year,\n",
101
+ " readout=False,\n",
102
+ " style=style,\n",
103
+ " layout=widgets.Layout(width=\"138px\", padding=padding),\n",
104
+ " )\n",
105
+ "\n",
106
+ " start_year_label = widgets.Label(\"1984\")\n",
107
+ " jslink_slider_label(start_year, start_year_label)\n",
108
+ "\n",
109
+ " end_year = widgets.IntSlider(\n",
110
+ " description=\"End Year:\",\n",
111
+ " value=current_year,\n",
112
+ " min=1984,\n",
113
+ " max=current_year,\n",
114
+ " readout=False,\n",
115
+ " style=style,\n",
116
+ " layout=widgets.Layout(width=\"138px\", padding=padding),\n",
117
+ " )\n",
118
+ " end_year_label = widgets.Label(str(current_year))\n",
119
+ " jslink_slider_label(end_year, end_year_label)\n",
120
+ "\n",
121
+ " start_month = widgets.IntSlider(\n",
122
+ " description=\"Start Month:\",\n",
123
+ " value=5,\n",
124
+ " min=1,\n",
125
+ " max=12,\n",
126
+ " readout=False,\n",
127
+ " style=style,\n",
128
+ " layout=widgets.Layout(width=\"145px\", padding=padding),\n",
129
+ " )\n",
130
+ "\n",
131
+ " start_month_label = widgets.Label(\n",
132
+ " \"5\",\n",
133
+ " layout=widgets.Layout(width=\"20px\", padding=padding),\n",
134
+ " )\n",
135
+ " jslink_slider_label(start_month, start_month_label)\n",
136
+ "\n",
137
+ " end_month = widgets.IntSlider(\n",
138
+ " description=\"End Month:\",\n",
139
+ " value=10,\n",
140
+ " min=1,\n",
141
+ " max=12,\n",
142
+ " readout=False,\n",
143
+ " style=style,\n",
144
+ " layout=widgets.Layout(width=\"155px\", padding=padding),\n",
145
+ " )\n",
146
+ "\n",
147
+ " end_month_label = widgets.Label(\"10\")\n",
148
+ " jslink_slider_label(end_month, end_month_label)\n",
149
+ "\n",
150
+ " output = widgets.Output()\n",
151
+ "\n",
152
+ " button_width = \"113px\"\n",
153
+ " apply_btn = widgets.Button(\n",
154
+ " description=\"Time slider\",\n",
155
+ " button_style=\"primary\",\n",
156
+ " tooltip=\"Click to create timeseries\",\n",
157
+ " style=style,\n",
158
+ " layout=widgets.Layout(padding=\"0px\", width=button_width),\n",
159
+ " )\n",
160
+ "\n",
161
+ " split_btn = widgets.Button(\n",
162
+ " description=\"Split map\",\n",
163
+ " button_style=\"primary\",\n",
164
+ " tooltip=\"Click to create timeseries\",\n",
165
+ " style=style,\n",
166
+ " layout=widgets.Layout(padding=\"0px\", width=button_width),\n",
167
+ " )\n",
168
+ "\n",
169
+ " reset_btn = widgets.Button(\n",
170
+ " description=\"Reset\",\n",
171
+ " button_style=\"primary\",\n",
172
+ " style=style,\n",
173
+ " layout=widgets.Layout(padding=\"0px\", width=button_width),\n",
174
+ " )\n",
175
+ "\n",
176
+ " vbox = widgets.VBox(\n",
177
+ " [\n",
178
+ " collection,\n",
179
+ " widgets.HBox([bands, frequency]),\n",
180
+ " widgets.HBox([start_year, start_year_label, end_year, end_year_label]),\n",
181
+ " widgets.HBox(\n",
182
+ " [start_month, start_month_label, end_month, end_month_label]\n",
183
+ " ),\n",
184
+ " widgets.HBox([apply_btn, split_btn, reset_btn]),\n",
185
+ " output,\n",
186
+ " ]\n",
187
+ " )\n",
188
+ " self.add_widget(vbox, position=position, add_header=True)\n",
189
+ "\n",
190
+ " def apply_btn_click(change):\n",
191
+ "\n",
192
+ " if hasattr(self, \"slider_ctrl\") and self.slider_ctrl is not None:\n",
193
+ " self.remove(self.slider_ctrl)\n",
194
+ " delattr(self, \"slider_ctrl\")\n",
195
+ "\n",
196
+ " with output:\n",
197
+ " output.clear_output()\n",
198
+ " if self.user_roi is None:\n",
199
+ " output.append_stdout(\"Please draw a ROI first.\")\n",
200
+ " else:\n",
201
+ " output.append_stdout(\"Creating time series...\")\n",
202
+ " collection = geemap.landsat_timeseries(\n",
203
+ " roi=self.user_roi,\n",
204
+ " start_year=start_year.value,\n",
205
+ " end_year=end_year.value,\n",
206
+ " start_date=str(start_month.value).zfill(2) + \"-01\",\n",
207
+ " end_date=str(end_month.value).zfill(2) + \"-01\",\n",
208
+ " frequency=frequency.value,\n",
209
+ " )\n",
210
+ " vis_params = {\n",
211
+ " \"bands\": bands.value.split(\"/\"),\n",
212
+ " \"min\": 0,\n",
213
+ " \"max\": 0.4,\n",
214
+ " }\n",
215
+ "\n",
216
+ " if frequency.value == \"year\":\n",
217
+ " date_format = \"YYYY\"\n",
218
+ " elif frequency.value == \"quarter\":\n",
219
+ " date_format = \"YYYY-MM\"\n",
220
+ " elif frequency.value == \"month\":\n",
221
+ " date_format = \"YYYY-MM\"\n",
222
+ "\n",
223
+ " self.add_time_slider(\n",
224
+ " collection,\n",
225
+ " region=self.user_roi,\n",
226
+ " vis_params=vis_params,\n",
227
+ " date_format=date_format,\n",
228
+ " )\n",
229
+ " self._draw_control.clear()\n",
230
+ " draw_layer = self.find_layer(\"Drawn Features\")\n",
231
+ " if draw_layer is not None:\n",
232
+ " self.remove(draw_layer)\n",
233
+ " output.clear_output()\n",
234
+ "\n",
235
+ " apply_btn.on_click(apply_btn_click)\n",
236
+ "\n",
237
+ " def split_btn_click(change):\n",
238
+ "\n",
239
+ " if hasattr(self, \"slider_ctrl\") and self.slider_ctrl is not None:\n",
240
+ " self.remove(self.slider_ctrl)\n",
241
+ " delattr(self, \"slider_ctrl\")\n",
242
+ "\n",
243
+ " with output:\n",
244
+ " output.clear_output()\n",
245
+ " if self.user_roi is None:\n",
246
+ " output.append_stdout(\"Please draw a ROI first.\")\n",
247
+ " else:\n",
248
+ " output.append_stdout(\"Creating time series...\")\n",
249
+ " collection = geemap.landsat_timeseries(\n",
250
+ " roi=self.user_roi,\n",
251
+ " start_year=start_year.value,\n",
252
+ " end_year=end_year.value,\n",
253
+ " start_date=str(start_month.value).zfill(2) + \"-01\",\n",
254
+ " end_date=str(end_month.value).zfill(2) + \"-01\",\n",
255
+ " frequency=frequency.value,\n",
256
+ " )\n",
257
+ " vis_params = {\n",
258
+ " \"bands\": bands.value.split(\"/\"),\n",
259
+ " \"min\": 0,\n",
260
+ " \"max\": 0.4,\n",
261
+ " }\n",
262
+ "\n",
263
+ " if frequency.value == \"year\":\n",
264
+ " date_format = \"YYYY\"\n",
265
+ " dates = geemap.image_dates(collection, date_format).getInfo()\n",
266
+ " elif frequency.value == \"quarter\":\n",
267
+ " date_format = \"YYYY-MM\"\n",
268
+ " dates = geemap.image_dates(collection, date_format).getInfo()\n",
269
+ " elif frequency.value == \"month\":\n",
270
+ " date_format = \"YYYY-MM\"\n",
271
+ " dates = geemap.image_dates(collection, date_format).getInfo()\n",
272
+ "\n",
273
+ " self.ts_inspector(\n",
274
+ " collection,\n",
275
+ " left_names=dates,\n",
276
+ " left_vis=vis_params,\n",
277
+ " add_close_button=True,\n",
278
+ " )\n",
279
+ " output.clear_output()\n",
280
+ "\n",
281
+ " try:\n",
282
+ " self._draw_control.clear()\n",
283
+ " draw_layer = self.find_layer(\"Drawn Features\")\n",
284
+ " if draw_layer is not None:\n",
285
+ " self.remove(draw_layer)\n",
286
+ " except Exception as e:\n",
287
+ " print(e)\n",
288
+ "\n",
289
+ " split_btn.on_click(split_btn_click)\n",
290
+ "\n",
291
+ " def reset_btn_click(change):\n",
292
+ " output.clear_output()\n",
293
+ " self.clean_up()\n",
294
+ "\n",
295
+ " reset_btn.on_click(reset_btn_click)\n",
296
+ "\n",
297
+ "\n",
298
+ "@solara.component\n",
299
+ "def Page():\n",
300
+ " with solara.Column(style={\"min-width\": \"500px\"}):\n",
301
+ " Map.element(\n",
302
+ " center=[20, -0],\n",
303
+ " zoom=2,\n",
304
+ " height=\"750px\",\n",
305
+ " zoom_ctrl=False,\n",
306
+ " measure_ctrl=False,\n",
307
+ " )"
308
+ ]
309
+ },
310
+ {
311
+ "cell_type": "code",
312
+ "execution_count": null,
313
+ "metadata": {},
314
+ "outputs": [],
315
+ "source": [
316
+ "Page()"
317
+ ]
318
+ },
319
+ {
320
+ "cell_type": "code",
321
+ "execution_count": null,
322
+ "metadata": {},
323
+ "outputs": [],
324
+ "source": []
325
+ }
326
+ ],
327
+ "metadata": {
328
+ "kernelspec": {
329
+ "display_name": "geo",
330
+ "language": "python",
331
+ "name": "python3"
332
+ },
333
+ "language_info": {
334
+ "codemirror_mode": {
335
+ "name": "ipython",
336
+ "version": 3
337
+ },
338
+ "file_extension": ".py",
339
+ "mimetype": "text/x-python",
340
+ "name": "python",
341
+ "nbconvert_exporter": "python",
342
+ "pygments_lexer": "ipython3",
343
+ "version": "3.11.8"
344
+ }
345
+ },
346
+ "nbformat": 4,
347
+ "nbformat_minor": 2
348
+ }
notebooks/07_jrc.ipynb ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/07_jrc.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import ee\n",
26
+ "import geemap\n",
27
+ "import ipywidgets as widgets\n",
28
+ "from IPython.display import display\n",
29
+ "import solara\n",
30
+ "\n",
31
+ "\n",
32
+ "class Map(geemap.Map):\n",
33
+ " def __init__(self, **kwargs):\n",
34
+ " super().__init__(**kwargs)\n",
35
+ " self.add_basemap(\"Esri.WorldImagery\")\n",
36
+ " self.add_ee_data()\n",
37
+ " self.add_buttons(add_header=True)\n",
38
+ "\n",
39
+ " def add_ee_data(self):\n",
40
+ "\n",
41
+ " dataset = ee.Image(\"JRC/GSW1_4/GlobalSurfaceWater\")\n",
42
+ " image = dataset.select([\"occurrence\"])\n",
43
+ " vis_params = {\n",
44
+ " \"min\": 0.0,\n",
45
+ " \"max\": 100.0,\n",
46
+ " \"palette\": [\"ffffff\", \"ffbbbb\", \"0000ff\"],\n",
47
+ " }\n",
48
+ " self.addLayer(image, vis_params, \"Occurrence\")\n",
49
+ " self.add_colorbar(\n",
50
+ " vis_params, label=\"Water occurrence (%)\", layer_name=\"Occurrence\"\n",
51
+ " )\n",
52
+ "\n",
53
+ " def add_buttons(self, position=\"topright\", **kwargs):\n",
54
+ " padding = \"0px 5px 0px 5px\"\n",
55
+ " widget = widgets.VBox(layout=widgets.Layout(padding=padding))\n",
56
+ " layout = widgets.Layout(width=\"auto\")\n",
57
+ " style = {\"description_width\": \"initial\"}\n",
58
+ " hist_btn = widgets.Button(description=\"Occurrence\", layout=layout)\n",
59
+ " bar_btn = widgets.Button(description=\"Monthly history\", layout=layout)\n",
60
+ " reset_btn = widgets.Button(description=\"Reset\", layout=layout)\n",
61
+ " scale = widgets.IntSlider(\n",
62
+ " min=30, max=1000, value=90, description=\"Scale\", layout=layout, style=style\n",
63
+ " )\n",
64
+ " month_slider = widgets.IntRangeSlider(\n",
65
+ " description=\"Months\",\n",
66
+ " value=[5, 10],\n",
67
+ " min=1,\n",
68
+ " max=12,\n",
69
+ " step=1,\n",
70
+ " layout=layout,\n",
71
+ " style=style,\n",
72
+ " )\n",
73
+ " widget.children = [\n",
74
+ " widgets.HBox([hist_btn, bar_btn, reset_btn]),\n",
75
+ " month_slider,\n",
76
+ " scale,\n",
77
+ " ]\n",
78
+ " self.add_widget(widget, position=position, **kwargs)\n",
79
+ " output = widgets.Output()\n",
80
+ " self.add_widget(output, position=\"bottomleft\", add_header=False)\n",
81
+ "\n",
82
+ " def hist_btn_click(b):\n",
83
+ " region = self.user_roi\n",
84
+ " if region is not None:\n",
85
+ " output.clear_output()\n",
86
+ " output.append_stdout(\"Computing histogram...\")\n",
87
+ " image = ee.Image(\"JRC/GSW1_4/GlobalSurfaceWater\").select([\"occurrence\"])\n",
88
+ " self.default_style = {\"cursor\": \"wait\"}\n",
89
+ " hist = geemap.image_histogram(\n",
90
+ " image,\n",
91
+ " region,\n",
92
+ " scale=scale.value,\n",
93
+ " height=350,\n",
94
+ " width=550,\n",
95
+ " x_label=\"Water Occurrence (%)\",\n",
96
+ " y_label=\"Pixel Count\",\n",
97
+ " layout_args={\n",
98
+ " \"title\": dict(x=0.5),\n",
99
+ " \"margin\": dict(l=0, r=0, t=10, b=0),\n",
100
+ " },\n",
101
+ " return_df=False,\n",
102
+ " )\n",
103
+ "\n",
104
+ " with output:\n",
105
+ " output.clear_output()\n",
106
+ " display(hist)\n",
107
+ " self.default_style = {\"cursor\": \"default\"}\n",
108
+ " else:\n",
109
+ " output.clear_output()\n",
110
+ " with output:\n",
111
+ " output.append_stdout(\"Please draw a region of interest first.\")\n",
112
+ "\n",
113
+ " hist_btn.on_click(hist_btn_click)\n",
114
+ "\n",
115
+ " def bar_btn_click(b):\n",
116
+ " region = self.user_roi\n",
117
+ " if region is not None:\n",
118
+ " self.default_style = {\"cursor\": \"wait\"}\n",
119
+ " output.clear_output()\n",
120
+ " output.append_stdout(\"Computing monthly history...\")\n",
121
+ " bar = geemap.jrc_hist_monthly_history(\n",
122
+ " region=region,\n",
123
+ " scale=scale.value,\n",
124
+ " height=350,\n",
125
+ " width=550,\n",
126
+ " layout_args={\n",
127
+ " \"title\": dict(x=0.5),\n",
128
+ " \"margin\": dict(l=0, r=0, t=10, b=0),\n",
129
+ " },\n",
130
+ " frequency=\"month\",\n",
131
+ " start_month=month_slider.value[0],\n",
132
+ " end_month=month_slider.value[1],\n",
133
+ " denominator=1e4,\n",
134
+ " y_label=\"Area (ha)\",\n",
135
+ " )\n",
136
+ "\n",
137
+ " with output:\n",
138
+ " output.clear_output()\n",
139
+ " display(bar)\n",
140
+ " self.default_style = {\"cursor\": \"default\"}\n",
141
+ " else:\n",
142
+ " output.clear_output()\n",
143
+ " with output:\n",
144
+ " output.append_stdout(\"Please draw a region of interest first.\")\n",
145
+ "\n",
146
+ " bar_btn.on_click(bar_btn_click)\n",
147
+ "\n",
148
+ " def reset_btn_click(b):\n",
149
+ " self._draw_control.clear()\n",
150
+ " output.clear_output()\n",
151
+ "\n",
152
+ " reset_btn.on_click(reset_btn_click)\n",
153
+ "\n",
154
+ "\n",
155
+ "@solara.component\n",
156
+ "def Page():\n",
157
+ " with solara.Column(style={\"min-width\": \"500px\"}):\n",
158
+ " Map.element(\n",
159
+ " center=[20, -0],\n",
160
+ " zoom=2,\n",
161
+ " height=\"750px\",\n",
162
+ " zoom_ctrl=False,\n",
163
+ " measure_ctrl=False,\n",
164
+ " )"
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": null,
170
+ "metadata": {},
171
+ "outputs": [],
172
+ "source": [
173
+ "Page()"
174
+ ]
175
+ },
176
+ {
177
+ "cell_type": "code",
178
+ "execution_count": null,
179
+ "metadata": {},
180
+ "outputs": [],
181
+ "source": []
182
+ }
183
+ ],
184
+ "metadata": {
185
+ "kernelspec": {
186
+ "display_name": "geo",
187
+ "language": "python",
188
+ "name": "python3"
189
+ },
190
+ "language_info": {
191
+ "codemirror_mode": {
192
+ "name": "ipython",
193
+ "version": 3
194
+ },
195
+ "file_extension": ".py",
196
+ "mimetype": "text/x-python",
197
+ "name": "python",
198
+ "nbconvert_exporter": "python",
199
+ "pygments_lexer": "ipython3",
200
+ "version": "3.11.8"
201
+ }
202
+ },
203
+ "nbformat": 4,
204
+ "nbformat_minor": 2
205
+ }
notebooks/08_compare.ipynb ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/solara-geemap/blob/main/notebooks/08_compare.ipynb)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "# %pip install -U geemap solara"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "metadata": {},
23
+ "outputs": [],
24
+ "source": [
25
+ "import ee\n",
26
+ "import geemap\n",
27
+ "import ipywidgets as widgets\n",
28
+ "import solara\n",
29
+ "from datetime import date\n",
30
+ "\n",
31
+ "\n",
32
+ "class Map(geemap.Map):\n",
33
+ " def __init__(self, **kwargs):\n",
34
+ " super().__init__(**kwargs)\n",
35
+ " self.add_basemap(\"Esri.WorldImagery\")\n",
36
+ " self.add_gui_widget(add_header=True)\n",
37
+ "\n",
38
+ " def clean_up(self):\n",
39
+ "\n",
40
+ " layers = [\n",
41
+ " \"Pre-event Image\",\n",
42
+ " \"Post-event Image\",\n",
43
+ " \"Pre-event NDWI\",\n",
44
+ " \"Post-event NDWI\",\n",
45
+ " \"Pre-event Water\",\n",
46
+ " \"Post-event Water\",\n",
47
+ " \"Disappeared Water\",\n",
48
+ " \"New Water\",\n",
49
+ " ]\n",
50
+ " for layer_name in layers:\n",
51
+ " layer = self.find_layer(layer_name)\n",
52
+ " if layer is not None:\n",
53
+ " self.remove(layer)\n",
54
+ "\n",
55
+ " def add_gui_widget(self, position=\"topright\", **kwargs):\n",
56
+ "\n",
57
+ " widget = widgets.VBox(layout=widgets.Layout(padding=\"0px 5px 0px 5px\"))\n",
58
+ " pre_widget = widgets.HBox()\n",
59
+ " post_widget = widgets.HBox()\n",
60
+ " layout = widgets.Layout(width=\"auto\")\n",
61
+ " style = {\"description_width\": \"initial\"}\n",
62
+ " padding = \"0px 5px 0px 5px\"\n",
63
+ " pre_start_date = widgets.DatePicker(\n",
64
+ " description=\"Start\",\n",
65
+ " value=date(2014, 1, 1),\n",
66
+ " style=style,\n",
67
+ " layout=widgets.Layout(padding=padding, width=\"160px\"),\n",
68
+ " )\n",
69
+ " pre_end_date = widgets.DatePicker(\n",
70
+ " description=\"End\",\n",
71
+ " value=date(2014, 12, 31),\n",
72
+ " style=style,\n",
73
+ " layout=widgets.Layout(padding=padding, width=\"160px\"),\n",
74
+ " )\n",
75
+ " pre_cloud_cover = widgets.IntSlider(\n",
76
+ " description=\"Cloud\",\n",
77
+ " min=0,\n",
78
+ " max=100,\n",
79
+ " value=25,\n",
80
+ " step=1,\n",
81
+ " readout=False,\n",
82
+ " style=style,\n",
83
+ " layout=widgets.Layout(padding=padding, width=\"130px\"),\n",
84
+ " )\n",
85
+ " pre_cloud_label = widgets.Label(value=str(pre_cloud_cover.value))\n",
86
+ " geemap.jslink_slider_label(pre_cloud_cover, pre_cloud_label)\n",
87
+ " pre_widget.children = [\n",
88
+ " pre_start_date,\n",
89
+ " pre_end_date,\n",
90
+ " pre_cloud_cover,\n",
91
+ " pre_cloud_label,\n",
92
+ " ]\n",
93
+ " post_start_date = widgets.DatePicker(\n",
94
+ " description=\"Start\",\n",
95
+ " value=date(2024, 1, 1),\n",
96
+ " style=style,\n",
97
+ " layout=widgets.Layout(padding=padding, width=\"160px\"),\n",
98
+ " )\n",
99
+ " post_end_date = widgets.DatePicker(\n",
100
+ " description=\"End\",\n",
101
+ " value=date(2024, 12, 31),\n",
102
+ " style=style,\n",
103
+ " layout=widgets.Layout(padding=padding, width=\"160px\"),\n",
104
+ " )\n",
105
+ " post_cloud_cover = widgets.IntSlider(\n",
106
+ " description=\"Cloud\",\n",
107
+ " min=0,\n",
108
+ " max=100,\n",
109
+ " value=30,\n",
110
+ " step=1,\n",
111
+ " readout=False,\n",
112
+ " style=style,\n",
113
+ " layout=widgets.Layout(padding=padding, width=\"130px\"),\n",
114
+ " )\n",
115
+ " post_cloud_label = widgets.Label(value=str(post_cloud_cover.value))\n",
116
+ " geemap.jslink_slider_label(post_cloud_cover, post_cloud_label)\n",
117
+ " post_widget.children = [\n",
118
+ " post_start_date,\n",
119
+ " post_end_date,\n",
120
+ " post_cloud_cover,\n",
121
+ " post_cloud_label,\n",
122
+ " ]\n",
123
+ "\n",
124
+ " apply_btn = widgets.Button(description=\"Apply\", layout=layout)\n",
125
+ " reset_btn = widgets.Button(description=\"Reset\", layout=layout)\n",
126
+ " buttons = widgets.HBox([apply_btn, reset_btn])\n",
127
+ " output = widgets.Output()\n",
128
+ "\n",
129
+ " use_split = widgets.Checkbox(\n",
130
+ " value=False,\n",
131
+ " description=\"Split map\",\n",
132
+ " style=style,\n",
133
+ " layout=widgets.Layout(padding=padding, width=\"100px\"),\n",
134
+ " )\n",
135
+ "\n",
136
+ " use_ndwi = widgets.Checkbox(\n",
137
+ " value=False,\n",
138
+ " description=\"Compute NDWI\",\n",
139
+ " style=style,\n",
140
+ " layout=widgets.Layout(padding=padding, width=\"160px\"),\n",
141
+ " )\n",
142
+ "\n",
143
+ " ndwi_threhold = widgets.FloatSlider(\n",
144
+ " description=\"Threshold\",\n",
145
+ " min=-1,\n",
146
+ " max=1,\n",
147
+ " value=0,\n",
148
+ " step=0.05,\n",
149
+ " readout=True,\n",
150
+ " style=style,\n",
151
+ " layout=widgets.Layout(padding=padding, width=\"230px\"),\n",
152
+ " )\n",
153
+ "\n",
154
+ " options = widgets.HBox(\n",
155
+ " [\n",
156
+ " use_split,\n",
157
+ " use_ndwi,\n",
158
+ " ndwi_threhold,\n",
159
+ " ]\n",
160
+ " )\n",
161
+ "\n",
162
+ " widget.children = [pre_widget, post_widget, options, buttons, output]\n",
163
+ " self.add_widget(widget, position=position, **kwargs)\n",
164
+ "\n",
165
+ " def apply_btn_click(b):\n",
166
+ "\n",
167
+ " marker_layer = self.find_layer(\"Search location\")\n",
168
+ " if marker_layer is not None:\n",
169
+ " self.remove(marker_layer)\n",
170
+ " self.clean_up()\n",
171
+ "\n",
172
+ " if self.user_roi is None:\n",
173
+ " output.clear_output()\n",
174
+ " output.append_stdout(\"Please draw a ROI first.\")\n",
175
+ " elif (\n",
176
+ " pre_start_date.value is None\n",
177
+ " or pre_end_date.value is None\n",
178
+ " or post_start_date.value is None\n",
179
+ " or post_end_date.value is None\n",
180
+ " ):\n",
181
+ " output.clear_output()\n",
182
+ " output.append_stdout(\"Please select start and end dates.\")\n",
183
+ "\n",
184
+ " elif self.user_roi is not None:\n",
185
+ " output.clear_output()\n",
186
+ " output.append_stdout(\"Computing... Please wait.\")\n",
187
+ " roi = ee.FeatureCollection(self.user_roi)\n",
188
+ " vis_params = {\"bands\": [\"B6\", \"B5\", \"B4\"], \"min\": 0, \"max\": 0.4}\n",
189
+ " if pre_start_date.value.strftime(\"%Y-%m-%d\") < \"2013-04-11\":\n",
190
+ " pre_col = geemap.landsat_timeseries(\n",
191
+ " roi,\n",
192
+ " start_year=pre_start_date.value.year,\n",
193
+ " end_year=pre_end_date.value.year,\n",
194
+ " ).select([\"SWIR1\", \"NIR\", \"Red\", \"Green\"], [\"B6\", \"B5\", \"B4\", \"B3\"])\n",
195
+ " else:\n",
196
+ " pre_col = (\n",
197
+ " ee.ImageCollection(\"NASA/HLS/HLSL30/v002\")\n",
198
+ " .filterBounds(roi)\n",
199
+ " .filterDate(\n",
200
+ " pre_start_date.value.strftime(\"%Y-%m-%d\"),\n",
201
+ " pre_end_date.value.strftime(\"%Y-%m-%d\"),\n",
202
+ " )\n",
203
+ " .filter(ee.Filter.lt(\"CLOUD_COVERAGE\", pre_cloud_cover.value))\n",
204
+ " )\n",
205
+ "\n",
206
+ " if post_start_date.value.strftime(\"%Y-%m-%d\") < \"2013-04-11\":\n",
207
+ " post_col = geemap.landsat_timeseries(\n",
208
+ " roi,\n",
209
+ " start_year=post_start_date.value.year,\n",
210
+ " end_year=post_end_date.value.year,\n",
211
+ " ).select([\"SWIR1\", \"NIR\", \"Red\", \"Green\"], [\"B6\", \"B5\", \"B4\", \"B3\"])\n",
212
+ " else:\n",
213
+ " post_col = (\n",
214
+ " ee.ImageCollection(\"NASA/HLS/HLSL30/v002\")\n",
215
+ " .filterBounds(roi)\n",
216
+ " .filterDate(\n",
217
+ " post_start_date.value.strftime(\"%Y-%m-%d\"),\n",
218
+ " post_end_date.value.strftime(\"%Y-%m-%d\"),\n",
219
+ " )\n",
220
+ " .filter(ee.Filter.lt(\"CLOUD_COVERAGE\", post_cloud_cover.value))\n",
221
+ " )\n",
222
+ "\n",
223
+ " pre_img = pre_col.median().clip(roi)\n",
224
+ " post_img = post_col.median().clip(roi)\n",
225
+ "\n",
226
+ " if use_split.value:\n",
227
+ " left_layer = geemap.ee_tile_layer(\n",
228
+ " pre_img, vis_params, \"Pre-event Image\"\n",
229
+ " )\n",
230
+ " right_layer = geemap.ee_tile_layer(\n",
231
+ " post_img, vis_params, \"Post-event Image\"\n",
232
+ " )\n",
233
+ " self.split_map(\n",
234
+ " left_layer,\n",
235
+ " right_layer,\n",
236
+ " add_close_button=True,\n",
237
+ " left_label=\"Pre-event\",\n",
238
+ " right_label=\"Post-event\",\n",
239
+ " )\n",
240
+ " else:\n",
241
+ " pre_img = pre_col.median().clip(roi)\n",
242
+ " post_img = post_col.median().clip(roi)\n",
243
+ " self.add_layer(pre_img, vis_params, \"Pre-event Image\")\n",
244
+ " self.add_layer(post_img, vis_params, \"Post-event Image\")\n",
245
+ "\n",
246
+ " if use_ndwi.value and (not use_split.value):\n",
247
+ " pre_ndwi = pre_img.normalizedDifference([\"B3\", \"B6\"]).rename(\"NDWI\")\n",
248
+ " post_ndwi = post_img.normalizedDifference([\"B3\", \"B6\"]).rename(\n",
249
+ " \"NDWI\"\n",
250
+ " )\n",
251
+ " ndwi_vis = {\"min\": -1, \"max\": 1, \"palette\": \"ndwi\"}\n",
252
+ " self.add_layer(pre_ndwi, ndwi_vis, \"Pre-event NDWI\", False)\n",
253
+ " self.add_layer(post_ndwi, ndwi_vis, \"Post-event NDWI\", False)\n",
254
+ "\n",
255
+ " pre_water = pre_ndwi.gt(ndwi_threhold.value)\n",
256
+ " post_water = post_ndwi.gt(ndwi_threhold.value)\n",
257
+ " self.add_layer(\n",
258
+ " pre_water.selfMask(), {\"palette\": \"blue\"}, \"Pre-event Water\"\n",
259
+ " )\n",
260
+ " self.add_layer(\n",
261
+ " post_water.selfMask(), {\"palette\": \"red\"}, \"Post-event Water\"\n",
262
+ " )\n",
263
+ " new_water = post_water.subtract(pre_water).gt(0)\n",
264
+ " disappear_water = pre_water.subtract(post_water).gt(0)\n",
265
+ " self.add_layer(\n",
266
+ " disappear_water.selfMask(),\n",
267
+ " {\"palette\": \"brown\"},\n",
268
+ " \"Disappeared Water\",\n",
269
+ " )\n",
270
+ " self.add_layer(\n",
271
+ " new_water.selfMask(), {\"palette\": \"cyan\"}, \"New Water\"\n",
272
+ " )\n",
273
+ "\n",
274
+ " with output:\n",
275
+ " output.clear_output()\n",
276
+ "\n",
277
+ " output.clear_output()\n",
278
+ "\n",
279
+ " apply_btn.on_click(apply_btn_click)\n",
280
+ "\n",
281
+ " def reset_btn_click(b):\n",
282
+ " self.clean_up()\n",
283
+ " self._draw_control.clear()\n",
284
+ " draw_layer = self.find_layer(\"Drawn Features\")\n",
285
+ " if draw_layer is not None:\n",
286
+ " self.remove(draw_layer)\n",
287
+ " output.clear_output()\n",
288
+ "\n",
289
+ " reset_btn.on_click(reset_btn_click)\n",
290
+ "\n",
291
+ "\n",
292
+ "@solara.component\n",
293
+ "def Page():\n",
294
+ " with solara.Column(style={\"min-width\": \"500px\"}):\n",
295
+ " Map.element(\n",
296
+ " center=[20, -0],\n",
297
+ " zoom=2,\n",
298
+ " height=\"750px\",\n",
299
+ " zoom_ctrl=False,\n",
300
+ " measure_ctrl=False,\n",
301
+ " )"
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "code",
306
+ "execution_count": null,
307
+ "metadata": {},
308
+ "outputs": [],
309
+ "source": [
310
+ "Page()"
311
+ ]
312
+ }
313
+ ],
314
+ "metadata": {
315
+ "kernelspec": {
316
+ "display_name": "geo",
317
+ "language": "python",
318
+ "name": "python3"
319
+ },
320
+ "language_info": {
321
+ "codemirror_mode": {
322
+ "name": "ipython",
323
+ "version": 3
324
+ },
325
+ "file_extension": ".py",
326
+ "mimetype": "text/x-python",
327
+ "name": "python",
328
+ "nbconvert_exporter": "python",
329
+ "pygments_lexer": "ipython3",
330
+ "version": "3.11.8"
331
+ }
332
+ },
333
+ "nbformat": 4,
334
+ "nbformat_minor": 2
335
+ }
notebooks/09_teste.ipynb ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 11,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "text/html": [
11
+ "\n",
12
+ " <style>\n",
13
+ " .geemap-dark {\n",
14
+ " --jp-widgets-color: white;\n",
15
+ " --jp-widgets-label-color: white;\n",
16
+ " --jp-ui-font-color1: white;\n",
17
+ " --jp-layout-color2: #454545;\n",
18
+ " background-color: #383838;\n",
19
+ " }\n",
20
+ "\n",
21
+ " .geemap-dark .jupyter-button {\n",
22
+ " --jp-layout-color3: #383838;\n",
23
+ " }\n",
24
+ "\n",
25
+ " .geemap-colab {\n",
26
+ " background-color: var(--colab-primary-surface-color, white);\n",
27
+ " }\n",
28
+ "\n",
29
+ " .geemap-colab .jupyter-button {\n",
30
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
31
+ " }\n",
32
+ " </style>\n",
33
+ " "
34
+ ],
35
+ "text/plain": [
36
+ "<IPython.core.display.HTML object>"
37
+ ]
38
+ },
39
+ "metadata": {},
40
+ "output_type": "display_data"
41
+ }
42
+ ],
43
+ "source": [
44
+ "import geemap\n",
45
+ "import ee\n",
46
+ "import plotly.express as px"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": 3,
52
+ "metadata": {},
53
+ "outputs": [
54
+ {
55
+ "data": {
56
+ "text/html": [
57
+ "\n",
58
+ " <style>\n",
59
+ " .geemap-dark {\n",
60
+ " --jp-widgets-color: white;\n",
61
+ " --jp-widgets-label-color: white;\n",
62
+ " --jp-ui-font-color1: white;\n",
63
+ " --jp-layout-color2: #454545;\n",
64
+ " background-color: #383838;\n",
65
+ " }\n",
66
+ "\n",
67
+ " .geemap-dark .jupyter-button {\n",
68
+ " --jp-layout-color3: #383838;\n",
69
+ " }\n",
70
+ "\n",
71
+ " .geemap-colab {\n",
72
+ " background-color: var(--colab-primary-surface-color, white);\n",
73
+ " }\n",
74
+ "\n",
75
+ " .geemap-colab .jupyter-button {\n",
76
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
77
+ " }\n",
78
+ " </style>\n",
79
+ " "
80
+ ],
81
+ "text/plain": [
82
+ "<IPython.core.display.HTML object>"
83
+ ]
84
+ },
85
+ "metadata": {},
86
+ "output_type": "display_data"
87
+ }
88
+ ],
89
+ "source": [
90
+ "geemap.ee_initialize()"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": 6,
96
+ "metadata": {},
97
+ "outputs": [
98
+ {
99
+ "data": {
100
+ "text/html": [
101
+ "\n",
102
+ " <style>\n",
103
+ " .geemap-dark {\n",
104
+ " --jp-widgets-color: white;\n",
105
+ " --jp-widgets-label-color: white;\n",
106
+ " --jp-ui-font-color1: white;\n",
107
+ " --jp-layout-color2: #454545;\n",
108
+ " background-color: #383838;\n",
109
+ " }\n",
110
+ "\n",
111
+ " .geemap-dark .jupyter-button {\n",
112
+ " --jp-layout-color3: #383838;\n",
113
+ " }\n",
114
+ "\n",
115
+ " .geemap-colab {\n",
116
+ " background-color: var(--colab-primary-surface-color, white);\n",
117
+ " }\n",
118
+ "\n",
119
+ " .geemap-colab .jupyter-button {\n",
120
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
121
+ " }\n",
122
+ " </style>\n",
123
+ " "
124
+ ],
125
+ "text/plain": [
126
+ "<IPython.core.display.HTML object>"
127
+ ]
128
+ },
129
+ "metadata": {},
130
+ "output_type": "display_data"
131
+ }
132
+ ],
133
+ "source": [
134
+ "esa = ee.ImageCollection('ESA/WorldCover/v200').first()\n",
135
+ "\n",
136
+ "ucs = ee.FeatureCollection(\"projects/ee-curso-gee-rhamon/assets/ucs_estaduais_rj\")\n",
137
+ "\n",
138
+ " \n",
139
+ "esa = esa.clipToCollection(ucs)"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": 7,
145
+ "metadata": {},
146
+ "outputs": [
147
+ {
148
+ "data": {
149
+ "text/html": [
150
+ "\n",
151
+ " <style>\n",
152
+ " .geemap-dark {\n",
153
+ " --jp-widgets-color: white;\n",
154
+ " --jp-widgets-label-color: white;\n",
155
+ " --jp-ui-font-color1: white;\n",
156
+ " --jp-layout-color2: #454545;\n",
157
+ " background-color: #383838;\n",
158
+ " }\n",
159
+ "\n",
160
+ " .geemap-dark .jupyter-button {\n",
161
+ " --jp-layout-color3: #383838;\n",
162
+ " }\n",
163
+ "\n",
164
+ " .geemap-colab {\n",
165
+ " background-color: var(--colab-primary-surface-color, white);\n",
166
+ " }\n",
167
+ "\n",
168
+ " .geemap-colab .jupyter-button {\n",
169
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
170
+ " }\n",
171
+ " </style>\n",
172
+ " "
173
+ ],
174
+ "text/plain": [
175
+ "<IPython.core.display.HTML object>"
176
+ ]
177
+ },
178
+ "metadata": {},
179
+ "output_type": "display_data"
180
+ },
181
+ {
182
+ "name": "stdout",
183
+ "output_type": "stream",
184
+ "text": [
185
+ "Computing ... \n",
186
+ "Generating URL ...\n",
187
+ "Downloading data from https://earthengine.googleapis.com/v1/projects/346107197273/tables/60f4e2523a74ad9da945ec21ae745a37-75ffe80c0d13be48ca8789157bb6c245:getFeatures\n",
188
+ "Please wait ...\n",
189
+ "Data downloaded to c:\\Users\\Rhamon\\Desktop\\Solara\\solara-geemap\\notebooks\\esa_stats_ucs_rj.csv\n"
190
+ ]
191
+ }
192
+ ],
193
+ "source": [
194
+ "esa_stats = 'esa_stats_ucs_rj.csv'\n",
195
+ "\n",
196
+ "geemap.zonal_stats_by_group(\n",
197
+ " esa,\n",
198
+ " ucs,\n",
199
+ " esa_stats,\n",
200
+ " statistics_type='PERCENTAGE',\n",
201
+ " denominator=1e6,\n",
202
+ " decimal_places=2,\n",
203
+ ")"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type": "code",
208
+ "execution_count": 9,
209
+ "metadata": {},
210
+ "outputs": [
211
+ {
212
+ "name": "stderr",
213
+ "output_type": "stream",
214
+ "text": [
215
+ "<>:1: SyntaxWarning: invalid escape sequence '\\e'\n",
216
+ "<>:1: SyntaxWarning: invalid escape sequence '\\e'\n"
217
+ ]
218
+ },
219
+ {
220
+ "data": {
221
+ "text/html": [
222
+ "\n",
223
+ " <style>\n",
224
+ " .geemap-dark {\n",
225
+ " --jp-widgets-color: white;\n",
226
+ " --jp-widgets-label-color: white;\n",
227
+ " --jp-ui-font-color1: white;\n",
228
+ " --jp-layout-color2: #454545;\n",
229
+ " background-color: #383838;\n",
230
+ " }\n",
231
+ "\n",
232
+ " .geemap-dark .jupyter-button {\n",
233
+ " --jp-layout-color3: #383838;\n",
234
+ " }\n",
235
+ "\n",
236
+ " .geemap-colab {\n",
237
+ " background-color: var(--colab-primary-surface-color, white);\n",
238
+ " }\n",
239
+ "\n",
240
+ " .geemap-colab .jupyter-button {\n",
241
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
242
+ " }\n",
243
+ " </style>\n",
244
+ " "
245
+ ],
246
+ "text/plain": [
247
+ "<IPython.core.display.HTML object>"
248
+ ]
249
+ },
250
+ "metadata": {},
251
+ "output_type": "display_data"
252
+ },
253
+ {
254
+ "name": "stderr",
255
+ "output_type": "stream",
256
+ "text": [
257
+ "C:\\Users\\Rhamon\\AppData\\Local\\Temp\\ipykernel_21848\\2857369937.py:1: SyntaxWarning: invalid escape sequence '\\e'\n",
258
+ " df = 'CSVs\\esa_stats_ucs_rj.csv'\n"
259
+ ]
260
+ }
261
+ ],
262
+ "source": [
263
+ "df = 'CSVs\\esa_stats_ucs_rj.csv'"
264
+ ]
265
+ },
266
+ {
267
+ "cell_type": "code",
268
+ "execution_count": 13,
269
+ "metadata": {},
270
+ "outputs": [
271
+ {
272
+ "data": {
273
+ "text/html": [
274
+ "\n",
275
+ " <style>\n",
276
+ " .geemap-dark {\n",
277
+ " --jp-widgets-color: white;\n",
278
+ " --jp-widgets-label-color: white;\n",
279
+ " --jp-ui-font-color1: white;\n",
280
+ " --jp-layout-color2: #454545;\n",
281
+ " background-color: #383838;\n",
282
+ " }\n",
283
+ "\n",
284
+ " .geemap-dark .jupyter-button {\n",
285
+ " --jp-layout-color3: #383838;\n",
286
+ " }\n",
287
+ "\n",
288
+ " .geemap-colab {\n",
289
+ " background-color: var(--colab-primary-surface-color, white);\n",
290
+ " }\n",
291
+ "\n",
292
+ " .geemap-colab .jupyter-button {\n",
293
+ " --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
294
+ " }\n",
295
+ " </style>\n",
296
+ " "
297
+ ],
298
+ "text/plain": [
299
+ "<IPython.core.display.HTML object>"
300
+ ]
301
+ },
302
+ "metadata": {},
303
+ "output_type": "display_data"
304
+ },
305
+ {
306
+ "ename": "ValueError",
307
+ "evalue": "DataFrame constructor not properly called!",
308
+ "output_type": "error",
309
+ "traceback": [
310
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
311
+ "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
312
+ "\u001b[1;32m~\\AppData\\Local\\Temp\\ipykernel_21848\\385931256.py\u001b[0m in \u001b[0;36m?\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mfig\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpie\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'Class_10'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolor\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"nome\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtitle\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'Cobertura Florestal UCs Estaduais RJ'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mfig\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
313
+ "\u001b[1;32mc:\\Users\\Rhamon\\miniconda3\\envs\\geo\\Lib\\site-packages\\plotly\\express\\_chart_types.py\u001b[0m in \u001b[0;36m?\u001b[1;34m(data_frame, names, values, color, facet_row, facet_col, facet_col_wrap, facet_row_spacing, facet_col_spacing, color_discrete_sequence, color_discrete_map, hover_name, hover_data, custom_data, category_orders, labels, title, template, width, height, opacity, hole)\u001b[0m\n\u001b[0;32m 1478\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcolor_discrete_sequence\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1479\u001b[0m \u001b[0mlayout_patch\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;34m\"piecolorway\"\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mcolor_discrete_sequence\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1480\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1481\u001b[0m \u001b[0mlayout_patch\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1482\u001b[1;33m return make_figure(\n\u001b[0m\u001b[0;32m 1483\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mlocals\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1484\u001b[0m \u001b[0mconstructor\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mgo\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mPie\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1485\u001b[0m \u001b[0mtrace_patch\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdict\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mshowlegend\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnames\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mhole\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mhole\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
314
+ "\u001b[1;32mc:\\Users\\Rhamon\\miniconda3\\envs\\geo\\Lib\\site-packages\\plotly\\express\\_core.py\u001b[0m in \u001b[0;36m?\u001b[1;34m(args, constructor, trace_patch, layout_patch)\u001b[0m\n\u001b[0;32m 2086\u001b[0m \u001b[0mtrace_patch\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtrace_patch\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2087\u001b[0m \u001b[0mlayout_patch\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlayout_patch\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2088\u001b[0m \u001b[0mapply_default_cascade\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2089\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2090\u001b[1;33m \u001b[0margs\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mbuild_dataframe\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mconstructor\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2091\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mconstructor\u001b[0m \u001b[1;32min\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mgo\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTreemap\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mgo\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mSunburst\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mgo\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mIcicle\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"path\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2092\u001b[0m \u001b[0margs\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mprocess_dataframe_hierarchy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2093\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mconstructor\u001b[0m \u001b[1;32min\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mgo\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mPie\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
315
+ "\u001b[1;32mc:\\Users\\Rhamon\\miniconda3\\envs\\geo\\Lib\\site-packages\\plotly\\express\\_core.py\u001b[0m in \u001b[0;36m?\u001b[1;34m(args, constructor)\u001b[0m\n\u001b[0;32m 1344\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"to_pandas_df\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1345\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mto_pandas_df\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1346\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1347\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1348\u001b[1;33m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1349\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1350\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mdf_provided\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1351\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"data_frame\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
316
+ "\u001b[1;32mc:\\Users\\Rhamon\\miniconda3\\envs\\geo\\Lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36m?\u001b[1;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m 882\u001b[0m \u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 883\u001b[0m \u001b[1;31m# For data is scalar\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 884\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 885\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 886\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"DataFrame constructor not properly called!\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 887\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 888\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mensure_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindex\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 889\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mensure_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
317
+ "\u001b[1;31mValueError\u001b[0m: DataFrame constructor not properly called!"
318
+ ]
319
+ }
320
+ ],
321
+ "source": []
322
+ },
323
+ {
324
+ "cell_type": "code",
325
+ "execution_count": null,
326
+ "metadata": {},
327
+ "outputs": [],
328
+ "source": []
329
+ }
330
+ ],
331
+ "metadata": {
332
+ "kernelspec": {
333
+ "display_name": "geo",
334
+ "language": "python",
335
+ "name": "python3"
336
+ },
337
+ "language_info": {
338
+ "codemirror_mode": {
339
+ "name": "ipython",
340
+ "version": 3
341
+ },
342
+ "file_extension": ".py",
343
+ "mimetype": "text/x-python",
344
+ "name": "python",
345
+ "nbconvert_exporter": "python",
346
+ "pygments_lexer": "ipython3",
347
+ "version": "3.12.3"
348
+ }
349
+ },
350
+ "nbformat": 4,
351
+ "nbformat_minor": 2
352
+ }
notebooks/esa_stats_ucs_rj2.csv ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Class_60,Class_50,Class_40,Class_95,Class_30,Class_20,Class_10,Class_sum,Class_90,Class_80,num_mapa_1,tipo,categoria,jurisdicao,nome,area_ha,criacao,shape_leng,amortecime,shape_area,plano_mane,num_mapa,rotulo,ogc_fid,escala,system:index
2
+ 0,0,0,0,23.95,0,54.07,78.02,0,0,3.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DA MARIA COMPRIDA,7803.43358398,2023,1.62790463007,N�O,0.00684311649,N�O,40,MONA DA SERRA DA MARIA COMPRIDA,39,1:25.000,00000000000000000026
3
+ 0.06,0.86,0.1,0,38.93,0,57.04,111.28,0,14.29,19.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL DO MEDIO PARAIBA,11137.1971838,2016,6.13493591535,N�O,0.00976335248,N�O,21,REVIS MEDIO PARAIBA,2,1:25.000,00000000000000000001
4
+ 0.08,0.03,0,0.45,0.98,0,94.76,99.67000000000002,0.01,3.36,24.0,PROTECAO INTEGRAL,RESEC,ESTADUAL,RESERVA ECOLOGICA ESTADUAL DA JUATINGA,9967.24995917,1992,0.71060414957,N�O,0.0087980555,N�O,4,RESEC DA JUATINGA,19,Sem Info,00000000000000000012
5
+ 0.0,0,0,0,2.93,0,41.05,43.98,0,0,16.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO MENDANHA,4399.10221912,2013,0.51140355655,N�O,0.00386942761,N�O,20,PE DO MENDANHA,28,1:25.000,0000000000000000001b
6
+ 1.65,0.15,0.04,0,26.1,0,1.85,82.49000000000001,39.14,13.56,9.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA LAGOA DO ACU,8249.12246907,2012,0.83549660297,N�O,0.0072137959,N�O,19,PE DA LAGOA DO ACU,29,Sem info,0000000000000000001c
7
+ 0,0,0,0,10.51,0,44.24,54.75,0,0,2.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DA BELEZA,5476.83546917,2017,1.13386248167,N�O,0.00480016717,N�O,2,MONA SERRA DA BELEZA,36,1:25.000,00000000000000000023
8
+ 0,0.0,0,0,2.61,0,4.14,6.75,0,0,4.0,PROTECAO INTEGRAL,MONA,ESTADUAL,MONUMENTO NATURAL DA SERRA DOS MASCATES,675.057144348,2017,0.18707531907,N�O,5.9145591E-4,N�O,3,MONA SERRA DOS MASCATES,37,1:25.000,00000000000000000024
9
+ 0,0.03,0,0,0.73,0,47.31,48.09,0,0.02,18.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL DA SERRA DA ESTRELA,4811.73100649,2017,1.19033062973,SIM,0.00422505577,N�O,23,REVIS SERRA DA ESTRELA,1,1:25.000,00000000000000000000
10
+ 0,0.02,0,0,1.97,0,0.36,2.69,0.21,0.13,20.0,PROTECAO INTEGRAL,REVIS,ESTADUAL,REFUGIO DA VIDA SILVESTRE ESTADUAL LAGOA DA TURFEIRA,269.493133194,2016,0.15745976676,SIM,2.3640802E-4,N�O,22,REVIS LAGOA DA TURFEIRA,18,1:25.000,00000000000000000011
11
+ 0.14,0.0,0,0,0.05,0,32.11,33.11,0.06,0.75,21.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DA PRAIA DO SUL,3311.84134657,2014,0.42874875901,SIM,0.00292054795,N�O,5,REBIO PRAIA DO SUL,20,1:50.000,00000000000000000013
12
+ 0.85,0.18,0,18.4,1.82,0,1.88,33.61,4.37,6.11,23.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DE GUARATIBA,3361.18585618,1974,0.57256120811,SIM,0.00296089188,SIM,6,REBIO DE GUARATIBA,21,1:10.000,00000000000000000014
13
+ 0,0,0,0,5.46,0.01,32.91,38.379999999999995,0,0,22.0,PROTECAO INTEGRAL,REBIO,ESTADUAL,RESERVA BIOLOGICA ESTADUAL DE ARARAS,3837.86536952,1977,0.46092656765,SIM,0.00336699397,SIM,7,REBIO DE ARARAS,22,1:50.000,00000000000000000015
14
+ 0,0.01,0.01,0,21.27,0,629.29,650.5899999999999,0,0.01,17.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DOS TRES PICOS,65080.4867347,2002,9.10823446005,SIM,0.05708718834,SIM,12,PE DOS TRES PICOS,23,1:25.000 ; 1:50.000,00000000000000000016
15
+ 0.08,0.09,0,0,1.55,0,30.19,34.31,0.38,2.02,13.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA SERRA DA TIRIRICA,3433.85726444,1991,1.42936381133,SIM,0.00302301907,SIM,13,PE SERRA DA TIRIRICA,24,1:10.000,00000000000000000017
16
+ 0,0.02,0.01,0,8.02,0,51.45,59.52,0,0.02,12.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA SERRA DA CONCORDIA,5952.58474185,2016,1.45942906837,SIM,0.00521852499,N�O,11,PE SERRA DA CONCORDIA,25,1:25.000,00000000000000000018
17
+ 0,0.0,0.02,0,2.12,0.02,78.25,80.41,0,0,11.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA PEDRA SELADA,8041.49819897,2012,1.66658109283,SIM,0.00704996872,SIM,18,PE DA PEDRA SELADA,26,1:25.000,00000000000000000019
18
+ 0.0,0.1,0,0,10.83,0,113.97,124.91999999999999,0,0.02,10.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA PEDRA BRANCA,12494.2417207,1974,1.8845293254,SIM,0.01100042314,SIM,10,PE DA PEDRA BRANCA,27,Sem Info,0000000000000000001a
19
+ 0,0.02,0,0,0.02,0,0.51,0.55,0,0,15.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO GRAJAU,54.7290261485,1978,0.05699572081,SIM,4.817604E-5,SIM,14,PE DO GRAJAU,30,Sem Info,0000000000000000001d
20
+ 0,0,0,0,8.76,0,204.47,213.23,0,0,14.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DO DESENGANO,21325.7388368,1970,1.75405439943,SIM,0.01863237605,SIM,16,PE DO DESENGANO,31,Sem info,0000000000000000001e
21
+ 0,0,0,0,12.87,0,364.62,380.73,0,3.24,5.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL CUNHAMBEBE,38076.6666531,2008,4.36267236111,SIM,0.03351297978,SIM,8,PE CUNHAMBEBE,32,Sem info,0000000000000000001f
22
+ 4.26,1.4,0.03,0,22.11,0.04,44.33,98.27000000000001,14.65,11.45,7.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA COSTA DO SOL,9828.61554842,2011,3.29315109101,SIM,0.0086502762,SIM,17,PE DA COSTA DO SOL,33,1:25.000,00000000000000000020
23
+ 0,0.0,0,0,0,0,0.04,0.04,0,0,6.0,PROTECAO INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA CHACRINHA,3.71173380368,1969,0.00787836058,SIM,3.26827E-6,SIM,15,PE DA CHACRINHA,34,Sem Info,00000000000000000021
24
+ 0,0.0,0.51,0,10.26,0,16.53,32.58,4.81,0.47,1.0,PROTECAO INTEGRAL,EEE,ESTADUAL,ESTACAO ECOLOGICA ESTADUAL DE GUAXINDIBA,3259.22390746,2002,0.47132646001,SIM,0.00283886233,SIM,1,EEE DE GUAXINDIBA,35,1:50.000,00000000000000000022
25
+ 0.15,0.05,0,0,0.63,0,118.68,120.89,0.02,1.36,8.0,PROTE��O INTEGRAL,PARQUE,ESTADUAL,PARQUE ESTADUAL DA ILHA GRANDE,12083.7871718,1971,1.47283767448,SIM,0.01066040264,SIM,8,PE DA ILHA GRANDE,40,1:50.000 - IBGE,00000000000000000027
26
+ 0.37,8.45,0.37,0,62.51,0,142.49,221.10999999999999,5.25,1.67,35.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO ALTO IGUACU,22111.9931221,2013,0.78497409664,N�O SE APLICA,0.01942446261,SIM,36,APA DO ALTO IGUACU,3,1:25.000,00000000000000000002
27
+ 0.04,2.96,2.66,1.57,49.86,0,130.79,194.67,6.49,0.3,25.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA BACIA DO RIO MACACU,19502.1400409,2002,33.798675024,N�O SE APLICA,0.01711874796,N�O,27,APA DA BACIA DO RIO MACACU,4,Sem Info,00000000000000000003
28
+ 0,0,0.13,0,11.13,0,17.46,28.720000000000002,0,0.0,26.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA BACIA DOS FRADES,2871.72642178,1990,0.59921403936,N�O SE APLICA,0.0025174733,N�O,31,APA DOS FRADES,5,1:25.000 ; 1:50.000,00000000000000000004
29
+ 0,0.32,0.02,0,25.23,0,324.44,350.01,0,0,29.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MACAE DE CIMA,35003.0809078,2001,1.03394504309,N�O SE APLICA,0.03069270346,SIM,30,APA DE MACAE DE CIMA,6,1:50.000,00000000000000000005
30
+ 0.04,0.05,0,0,14.7,0,64.94,79.75,0,0.02,28.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE GERICINO-MENDANHA,7974.14336908,2005,0.66988583505,N�O SE APLICA,0.00701359206,N�O,25,APA DE GERICINO-MENDANHA,7,Sem Info,00000000000000000006
31
+ 0,0.35,0,0.99,10.44,0,241.09,253.09,0.05,0.17,30.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MANGARATIBA,25312.3537777,1987,2.73219986964,N�O SE APLICA,0.02228427968,SIM,24,APA DE MANGARATIBA,8,1:20.000,00000000000000000007
32
+ 1.37,0.36,0,0,2.99,0.01,4.11,9.690000000000001,0.47,0.38,31.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MARICA,969.239448931,1984,0.30140385146,N�O SE APLICA,8.5341915E-4,SIM,33,APA DE MARICA,9,Sem info,00000000000000000008
33
+ 0.62,8.76,0.02,0,27.58,0,23.12,91.25,18.32,12.83,32.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE MASSAMBABA,9124.45193908,2011,0.8822736963,N�O SE APLICA,0.00803179984,SIM,32,APA DE MASSAMBABA,10,1:50.000,00000000000000000009
34
+ 0.69,2.28,0,0,4.17,0,18.42,103.52000000000001,1.7,76.26,36.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO PAU-BRASIL,10353.1623171,2002,0.42686675166,N�O SE APLICA,0.00910866994,SIM,28,APA PAU BRASIL,11,1:50.000,0000000000000000000a
35
+ 0.26,6.66,0.28,0,29.88,0,21.28,59.53999999999999,0.5,0.68,27.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DA SERRA DE SAPIATIBA,5955.22943195,1990,0.34376268569,N�O SE APLICA,0.00523829411,SIM,29,APA DA SERRA DE SAPIATIBA,12,1:50.000,0000000000000000000b
36
+ 0.14,12.69,1.29,0,264.0,0,456.92,742.91,0.81,7.06,37.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DO RIO GUANDU,74295.2023405,2007,3.89480581005,N�O SE APLICA,0.06525411525,N�O,26,APA DO RIO GUANDU,13,1:50.000,0000000000000000000c
37
+ 0,0.0,0,0,0.01,0,0.25,0.29000000000000004,0,0.03,38.0,USO SUSTENTAVEL,FLOR,ESTADUAL,FLORESTA ESTADUAL JOSE ZAGO,29.1364229911,2016,0.02136871955,N�O SE APLICA,2.549498E-5,N�O,37,FLOE JOSE ZAGO,14,1:25.000,0000000000000000000d
38
+ 0.03,0.12,0,0,0.56,0,0.96,1.7200000000000002,0.05,0,33.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE SEPETIBA II,171.666213409,2004,0.05801156773,N�O SE APLICA,1.5116278E-4,N�O,34,APA DE SEPETIBA II,15,1:10.000,0000000000000000000e
39
+ 0.13,0,0,0,0.02,0,1.16,18.99,0,17.68,39.0,USO SUSTENTAVEL,RDS,ESTADUAL,RESERVA DE DESENVOLVIMENTO SUSTENTAVEL DO AVENTUREIRO,1899.91188332,2014,0.21453857684,N�O SE APLICA,0.00167576192,N�O,39,RDS DO AVENTUREIRO,16,1:50.000,0000000000000000000f
40
+ 0.22,0.01,0,0,0.1,0,0.1,39.42,0.04,38.95,40.0,USO SUSTENTAVEL,RESEX,ESTADUAL,RESERVA EXTRATIVISTA MARINHA DE ITAIPU,3942.53457822,2013,0.4358579572,N�O SE APLICA,0.00347203423,N�O,38,RESEX MARINHA DE ITAIPU,17,1:25.000,00000000000000000010
41
+ 0.54,6.03,0,3.98,3.28,0,200.16,225.33999999999997,0.32,11.03,34.0,USO SUSTENTAVEL,APA,ESTADUAL,AREA DE PROTECAO AMBIENTAL DE TAMOIOS,22545.1793314,1986,6.34858345439,N�O SE APLICA,0.01987470585,SIM,35,APA DE TAMOIOS,38,Sem info,00000000000000000025
pages/00_home.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+
3
+
4
+ @solara.component
5
+ 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**
13
+
14
+ - Web App: <https://giswqs-solara-geemap.hf.space>
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.
22
+
23
+ ![](https://i.imgur.com/gTg4V2x.png)
24
+
25
+ 2. You need to set `EARTHENGINE_TOKEN` in order to use Earth Engine. The token value should be copied from the following file depending on your operating system:
26
+
27
+ ```text
28
+ Windows: C:\\Users\\USERNAME\\.config\\earthengine\\credentials
29
+ Linux: /home/USERNAME/.config/earthengine/credentials
30
+ MacOS: /Users/USERNAME/.config/earthengine/credentials
31
+ ```
32
+
33
+ Simply open the file and copy **ALL** the content to the `EARTHENGINE_TOKEN` environment variable.
34
+
35
+ ![](https://i.imgur.com/i04gzyH.png)
36
+
37
+ ![](https://i.imgur.com/Ex37Ut7.png)
38
+
39
+
40
+ ```python
41
+ import geemap
42
+ geemap.get_ee_token()
43
+ ```
44
+
45
+ Copy all the content of the printed token and set it as the `EARTHENGINE_TOKEN` environment variable.
46
+
47
+ 3. After the space is built successfully, click the `Embed this Space` menu and find the `Direct URL` for the app, such as <https://giswqs-solara-geemap.hf.space>.
48
+
49
+ ![](https://i.imgur.com/DNM36sk.png)
50
+
51
+ ![](https://i.imgur.com/KX82lSf.png)
52
+
53
+ 4. Add your own apps (*.py) to the `pages` folder.
54
+
55
+ 5. Commit and push your changes to the repository. Wait for the space to be built successfully.
56
+
57
+ """
58
+
59
+ solara.Markdown(markdown)
pages/01_basic.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import geemap
2
+ import solara
3
+
4
+ zoom = solara.reactive(4)
5
+ center = solara.reactive((40, -100))
6
+ bounds = solara.reactive(None)
7
+
8
+
9
+ @solara.component
10
+ def Page():
11
+ # Isolation is required to prevent the map from overlapping navigation (when screen width < 960px)
12
+ with solara.Column(
13
+ style={"min-width": "500px", "height": "780px", "isolation": "isolate"}
14
+ ):
15
+ # solara components support reactive variables
16
+ solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
17
+ # using 3rd party widget library require wiring up the events manually
18
+ # using zoom.value and zoom.set
19
+ geemap.Map.element( # type: ignore
20
+ zoom=zoom.value,
21
+ on_zoom=zoom.set,
22
+ center=center.value,
23
+ on_center=center.set,
24
+ on_bounds=bounds.set,
25
+ scroll_wheel_zoom=True,
26
+ height="600px",
27
+ )
28
+ solara.Text(f"Zoom: {zoom.value}")
29
+ solara.Text(f"Center: {center.value}")
30
+ solara.Text(f"Bounds: {bounds.value}")
pages/02_inspector.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+
4
+ import solara
5
+
6
+
7
+ class Map(geemap.Map):
8
+ def __init__(self, **kwargs):
9
+ super().__init__(**kwargs)
10
+ self.add_ee_data()
11
+ self.add("layer_manager")
12
+ self.add("inspector")
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
+
40
+ @solara.component
41
+ def Page():
42
+ with solara.Column(style={"min-width": "500px"}):
43
+ Map.element(
44
+ center=[40, -100],
45
+ zoom=4,
46
+ height="600px",
47
+ )
pages/03_plotting.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+
4
+ import solara
5
+
6
+
7
+ class Map(geemap.Map):
8
+ def __init__(self, **kwargs):
9
+ super().__init__(**kwargs)
10
+ self.add_ee_data()
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
34
+ def Page():
35
+ with solara.Column(style={"min-width": "500px"}):
36
+ Map.element(
37
+ center=[40, -100],
38
+ zoom=4,
39
+ height="600px",
40
+ )
pages/04_split_map.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+
4
+ import solara
5
+
6
+
7
+ class Map(geemap.Map):
8
+ def __init__(self, **kwargs):
9
+ super().__init__(**kwargs)
10
+ self.add_ee_data()
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(
36
+ left_ts=collection,
37
+ right_ts=collection,
38
+ left_names=labels,
39
+ right_names=labels,
40
+ )
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
+
51
+ @solara.component
52
+ def Page():
53
+ with solara.Column(style={"min-width": "500px"}):
54
+ Map.element(
55
+ center=[40, -100],
56
+ zoom=4,
57
+ height="600px",
58
+ )
pages/05_timelapse.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import geemap
2
+ import solara
3
+
4
+
5
+ class Map(geemap.Map):
6
+ def __init__(self, **kwargs):
7
+ super().__init__(**kwargs)
8
+ self.add_basemap("Esri.WorldImagery")
9
+ self.add_gui("timelapse", basemap=None)
10
+
11
+
12
+ @solara.component
13
+ def Page():
14
+ with solara.Column(style={"min-width": "500px", "isolation": "isolate"}):
15
+ Map.element(
16
+ center=[20, -0],
17
+ zoom=2,
18
+ height="750px",
19
+ zoom_ctrl=False,
20
+ measure_ctrl=False,
21
+ )
pages/06_timeseries.py ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import geemap
2
+ import ipywidgets as widgets
3
+ import solara
4
+ from geemap import get_current_year, jslink_slider_label
5
+
6
+
7
+ class Map(geemap.Map):
8
+ def __init__(self, **kwargs):
9
+ super().__init__(**kwargs)
10
+ self.add_basemap("Esri.WorldImagery")
11
+ self.add_ts_gui(position="topright")
12
+
13
+ def clean_up(self):
14
+ if hasattr(self, "slider_ctrl") and self.slider_ctrl is not None:
15
+ self.remove(self.slider_ctrl)
16
+ delattr(self, "slider_ctrl")
17
+
18
+ layer = self.find_layer("Time series")
19
+ if layer is not None:
20
+ self.remove(layer)
21
+ layer = self.find_layer("Image X")
22
+ if layer is not None:
23
+ self.remove(layer)
24
+
25
+ draw_layer = self.find_layer("Drawn Features")
26
+ if draw_layer is not None:
27
+ self.remove(draw_layer)
28
+
29
+ def add_ts_gui(self, position="topright", **kwargs):
30
+
31
+ widget_width = "350px"
32
+ padding = "0px 0px 0px 5px" # upper, right, bottom, left
33
+ style = {"description_width": "initial"}
34
+ current_year = get_current_year()
35
+
36
+ collection = widgets.Dropdown(
37
+ options=[
38
+ "Landsat TM-ETM-OLI Surface Reflectance",
39
+ ],
40
+ value="Landsat TM-ETM-OLI Surface Reflectance",
41
+ description="Collection:",
42
+ layout=widgets.Layout(width=widget_width, padding=padding),
43
+ style=style,
44
+ )
45
+ bands = widgets.Dropdown(
46
+ description="Bands:",
47
+ options=[
48
+ "Red/Green/Blue",
49
+ "NIR/Red/Green",
50
+ "SWIR2/SWIR1/NIR",
51
+ "NIR/SWIR1/Red",
52
+ "SWIR2/NIR/Red",
53
+ "SWIR2/SWIR1/Red",
54
+ "SWIR1/NIR/Blue",
55
+ "NIR/SWIR1/Blue",
56
+ "SWIR2/NIR/Green",
57
+ "SWIR1/NIR/Red",
58
+ ],
59
+ value="SWIR1/NIR/Red",
60
+ style=style,
61
+ layout=widgets.Layout(width="195px", padding=padding),
62
+ )
63
+
64
+ frequency = widgets.Dropdown(
65
+ description="Frequency:",
66
+ options=["year", "quarter", "month"],
67
+ value="year",
68
+ style=style,
69
+ layout=widgets.Layout(width="150px", padding=padding),
70
+ )
71
+
72
+ start_year = widgets.IntSlider(
73
+ description="Start Year:",
74
+ value=1984,
75
+ min=1984,
76
+ max=current_year,
77
+ readout=False,
78
+ style=style,
79
+ layout=widgets.Layout(width="138px", padding=padding),
80
+ )
81
+
82
+ start_year_label = widgets.Label("1984")
83
+ jslink_slider_label(start_year, start_year_label)
84
+
85
+ end_year = widgets.IntSlider(
86
+ description="End Year:",
87
+ value=current_year,
88
+ min=1984,
89
+ max=current_year,
90
+ readout=False,
91
+ style=style,
92
+ layout=widgets.Layout(width="138px", padding=padding),
93
+ )
94
+ end_year_label = widgets.Label(str(current_year))
95
+ jslink_slider_label(end_year, end_year_label)
96
+
97
+ start_month = widgets.IntSlider(
98
+ description="Start Month:",
99
+ value=5,
100
+ min=1,
101
+ max=12,
102
+ readout=False,
103
+ style=style,
104
+ layout=widgets.Layout(width="145px", padding=padding),
105
+ )
106
+
107
+ start_month_label = widgets.Label(
108
+ "5",
109
+ layout=widgets.Layout(width="20px", padding=padding),
110
+ )
111
+ jslink_slider_label(start_month, start_month_label)
112
+
113
+ end_month = widgets.IntSlider(
114
+ description="End Month:",
115
+ value=10,
116
+ min=1,
117
+ max=12,
118
+ readout=False,
119
+ style=style,
120
+ layout=widgets.Layout(width="155px", padding=padding),
121
+ )
122
+
123
+ end_month_label = widgets.Label("10")
124
+ jslink_slider_label(end_month, end_month_label)
125
+
126
+ output = widgets.Output()
127
+
128
+ button_width = "113px"
129
+ apply_btn = widgets.Button(
130
+ description="Time slider",
131
+ button_style="primary",
132
+ tooltip="Click to create timeseries",
133
+ style=style,
134
+ layout=widgets.Layout(padding="0px", width=button_width),
135
+ )
136
+
137
+ split_btn = widgets.Button(
138
+ description="Split map",
139
+ button_style="primary",
140
+ tooltip="Click to create timeseries",
141
+ style=style,
142
+ layout=widgets.Layout(padding="0px", width=button_width),
143
+ )
144
+
145
+ reset_btn = widgets.Button(
146
+ description="Reset",
147
+ button_style="primary",
148
+ style=style,
149
+ layout=widgets.Layout(padding="0px", width=button_width),
150
+ )
151
+
152
+ vbox = widgets.VBox(
153
+ [
154
+ collection,
155
+ widgets.HBox([bands, frequency]),
156
+ widgets.HBox([start_year, start_year_label, end_year, end_year_label]),
157
+ widgets.HBox(
158
+ [start_month, start_month_label, end_month, end_month_label]
159
+ ),
160
+ widgets.HBox([apply_btn, split_btn, reset_btn]),
161
+ output,
162
+ ]
163
+ )
164
+ self.add_widget(vbox, position=position, add_header=True)
165
+
166
+ def apply_btn_click(change):
167
+
168
+ if hasattr(self, "slider_ctrl") and self.slider_ctrl is not None:
169
+ self.remove(self.slider_ctrl)
170
+ delattr(self, "slider_ctrl")
171
+
172
+ with output:
173
+ output.clear_output()
174
+ if self.user_roi is None:
175
+ output.append_stdout("Please draw a ROI first.")
176
+ else:
177
+ output.append_stdout("Creating time series...")
178
+ collection = geemap.landsat_timeseries(
179
+ roi=self.user_roi,
180
+ start_year=start_year.value,
181
+ end_year=end_year.value,
182
+ start_date=str(start_month.value).zfill(2) + "-01",
183
+ end_date=str(end_month.value).zfill(2) + "-01",
184
+ frequency=frequency.value,
185
+ )
186
+ vis_params = {
187
+ "bands": bands.value.split("/"),
188
+ "min": 0,
189
+ "max": 0.4,
190
+ }
191
+
192
+ if frequency.value == "year":
193
+ date_format = "YYYY"
194
+ elif frequency.value == "quarter":
195
+ date_format = "YYYY-MM"
196
+ elif frequency.value == "month":
197
+ date_format = "YYYY-MM"
198
+
199
+ self.add_time_slider(
200
+ collection,
201
+ region=self.user_roi,
202
+ vis_params=vis_params,
203
+ date_format=date_format,
204
+ )
205
+ self._draw_control.clear()
206
+ draw_layer = self.find_layer("Drawn Features")
207
+ if draw_layer is not None:
208
+ self.remove(draw_layer)
209
+ output.clear_output()
210
+
211
+ apply_btn.on_click(apply_btn_click)
212
+
213
+ def split_btn_click(change):
214
+
215
+ if hasattr(self, "slider_ctrl") and self.slider_ctrl is not None:
216
+ self.remove(self.slider_ctrl)
217
+ delattr(self, "slider_ctrl")
218
+
219
+ with output:
220
+ output.clear_output()
221
+ if self.user_roi is None:
222
+ output.append_stdout("Please draw a ROI first.")
223
+ else:
224
+ output.append_stdout("Creating time series...")
225
+ collection = geemap.landsat_timeseries(
226
+ roi=self.user_roi,
227
+ start_year=start_year.value,
228
+ end_year=end_year.value,
229
+ start_date=str(start_month.value).zfill(2) + "-01",
230
+ end_date=str(end_month.value).zfill(2) + "-01",
231
+ frequency=frequency.value,
232
+ )
233
+ vis_params = {
234
+ "bands": bands.value.split("/"),
235
+ "min": 0,
236
+ "max": 0.4,
237
+ }
238
+
239
+ if frequency.value == "year":
240
+ date_format = "YYYY"
241
+ dates = geemap.image_dates(collection, date_format).getInfo()
242
+ elif frequency.value == "quarter":
243
+ date_format = "YYYY-MM"
244
+ dates = geemap.image_dates(collection, date_format).getInfo()
245
+ elif frequency.value == "month":
246
+ date_format = "YYYY-MM"
247
+ dates = geemap.image_dates(collection, date_format).getInfo()
248
+
249
+ self.ts_inspector(
250
+ collection,
251
+ left_names=dates,
252
+ left_vis=vis_params,
253
+ add_close_button=True,
254
+ )
255
+ output.clear_output()
256
+
257
+ try:
258
+ self._draw_control.clear()
259
+ draw_layer = self.find_layer("Drawn Features")
260
+ if draw_layer is not None:
261
+ self.remove(draw_layer)
262
+ except Exception as e:
263
+ print(e)
264
+
265
+ split_btn.on_click(split_btn_click)
266
+
267
+ def reset_btn_click(change):
268
+ output.clear_output()
269
+ self.clean_up()
270
+
271
+ reset_btn.on_click(reset_btn_click)
272
+
273
+
274
+ @solara.component
275
+ def Page():
276
+ with solara.Column(style={"min-width": "500px"}):
277
+ Map.element(
278
+ center=[20, -0],
279
+ zoom=2,
280
+ height="750px",
281
+ zoom_ctrl=False,
282
+ measure_ctrl=False,
283
+ )
pages/07_jrc.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+ import ipywidgets as widgets
4
+ from IPython.display import display
5
+ import solara
6
+
7
+
8
+ class Map(geemap.Map):
9
+ def __init__(self, **kwargs):
10
+ super().__init__(**kwargs)
11
+ self.add_basemap("Esri.WorldImagery")
12
+ self.add_ee_data()
13
+ self.add_buttons(add_header=True)
14
+
15
+ def add_ee_data(self):
16
+
17
+ dataset = ee.Image("JRC/GSW1_4/GlobalSurfaceWater")
18
+ image = dataset.select(["occurrence"])
19
+ vis_params = {
20
+ "min": 0.0,
21
+ "max": 100.0,
22
+ "palette": ["ffffff", "ffbbbb", "0000ff"],
23
+ }
24
+ self.addLayer(image, vis_params, "Occurrence")
25
+ self.add_colorbar(
26
+ vis_params, label="Water occurrence (%)", layer_name="Occurrence"
27
+ )
28
+
29
+ def add_buttons(self, position="topright", **kwargs):
30
+ padding = "0px 5px 0px 5px"
31
+ widget = widgets.VBox(layout=widgets.Layout(padding=padding))
32
+ layout = widgets.Layout(width="auto")
33
+ style = {"description_width": "initial"}
34
+ hist_btn = widgets.Button(description="Occurrence", layout=layout)
35
+ bar_btn = widgets.Button(description="Monthly history", layout=layout)
36
+ reset_btn = widgets.Button(description="Reset", layout=layout)
37
+ scale = widgets.IntSlider(
38
+ min=30, max=1000, value=90, description="Scale", layout=layout, style=style
39
+ )
40
+ month_slider = widgets.IntRangeSlider(
41
+ description="Months",
42
+ value=[5, 10],
43
+ min=1,
44
+ max=12,
45
+ step=1,
46
+ layout=layout,
47
+ style=style,
48
+ )
49
+ widget.children = [
50
+ widgets.HBox([hist_btn, bar_btn, reset_btn]),
51
+ month_slider,
52
+ scale,
53
+ ]
54
+ self.add_widget(widget, position=position, **kwargs)
55
+ output = widgets.Output()
56
+ self.add_widget(output, position="bottomleft", add_header=False)
57
+
58
+ def hist_btn_click(b):
59
+ region = self.user_roi
60
+ if region is not None:
61
+ output.clear_output()
62
+ output.append_stdout("Computing histogram...")
63
+ image = ee.Image("JRC/GSW1_4/GlobalSurfaceWater").select(["occurrence"])
64
+ self.default_style = {"cursor": "wait"}
65
+ hist = geemap.image_histogram(
66
+ image,
67
+ region,
68
+ scale=scale.value,
69
+ height=350,
70
+ width=550,
71
+ x_label="Water Occurrence (%)",
72
+ y_label="Pixel Count",
73
+ layout_args={
74
+ "title": dict(x=0.5),
75
+ "margin": dict(l=0, r=0, t=10, b=0),
76
+ },
77
+ return_df=False,
78
+ )
79
+
80
+ with output:
81
+ output.clear_output()
82
+ display(hist)
83
+ self.default_style = {"cursor": "default"}
84
+ else:
85
+ output.clear_output()
86
+ with output:
87
+ output.append_stdout("Please draw a region of interest first.")
88
+
89
+ hist_btn.on_click(hist_btn_click)
90
+
91
+ def bar_btn_click(b):
92
+ region = self.user_roi
93
+ if region is not None:
94
+ self.default_style = {"cursor": "wait"}
95
+ output.clear_output()
96
+ output.append_stdout("Computing monthly history...")
97
+ bar = geemap.jrc_hist_monthly_history(
98
+ region=region,
99
+ scale=scale.value,
100
+ height=350,
101
+ width=550,
102
+ layout_args={
103
+ "title": dict(x=0.5),
104
+ "margin": dict(l=0, r=0, t=10, b=0),
105
+ },
106
+ frequency="month",
107
+ start_month=month_slider.value[0],
108
+ end_month=month_slider.value[1],
109
+ denominator=1e4,
110
+ y_label="Area (ha)",
111
+ )
112
+
113
+ with output:
114
+ output.clear_output()
115
+ display(bar)
116
+ self.default_style = {"cursor": "default"}
117
+ else:
118
+ output.clear_output()
119
+ with output:
120
+ output.append_stdout("Please draw a region of interest first.")
121
+
122
+ bar_btn.on_click(bar_btn_click)
123
+
124
+ def reset_btn_click(b):
125
+ self._draw_control.clear()
126
+ output.clear_output()
127
+
128
+ reset_btn.on_click(reset_btn_click)
129
+
130
+
131
+ @solara.component
132
+ def Page():
133
+ with solara.Column(style={"min-width": "500px"}):
134
+ Map.element(
135
+ center=[20, -0],
136
+ zoom=2,
137
+ height="750px",
138
+ zoom_ctrl=False,
139
+ measure_ctrl=False,
140
+ )
pages/08_compare.py ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+ import ipywidgets as widgets
4
+ import solara
5
+ from datetime import date
6
+
7
+
8
+ class Map(geemap.Map):
9
+ def __init__(self, **kwargs):
10
+ super().__init__(**kwargs)
11
+ self.add_basemap("Esri.WorldImagery")
12
+ self.add_gui_widget(add_header=True)
13
+
14
+ def clean_up(self):
15
+
16
+ layers = [
17
+ "Pre-event Image",
18
+ "Post-event Image",
19
+ "Pre-event NDWI",
20
+ "Post-event NDWI",
21
+ "Pre-event Water",
22
+ "Post-event Water",
23
+ "Disappeared Water",
24
+ "New Water",
25
+ ]
26
+ for layer_name in layers:
27
+ layer = self.find_layer(layer_name)
28
+ if layer is not None:
29
+ self.remove(layer)
30
+
31
+ def add_gui_widget(self, position="topright", **kwargs):
32
+
33
+ widget = widgets.VBox(layout=widgets.Layout(padding="0px 5px 0px 5px"))
34
+ pre_widget = widgets.HBox()
35
+ post_widget = widgets.HBox()
36
+ layout = widgets.Layout(width="auto")
37
+ style = {"description_width": "initial"}
38
+ padding = "0px 5px 0px 5px"
39
+ pre_start_date = widgets.DatePicker(
40
+ description="Start",
41
+ value=date(2014, 1, 1),
42
+ style=style,
43
+ layout=widgets.Layout(padding=padding, width="160px"),
44
+ )
45
+ pre_end_date = widgets.DatePicker(
46
+ description="End",
47
+ value=date(2014, 12, 31),
48
+ style=style,
49
+ layout=widgets.Layout(padding=padding, width="160px"),
50
+ )
51
+ pre_cloud_cover = widgets.IntSlider(
52
+ description="Cloud",
53
+ min=0,
54
+ max=100,
55
+ value=25,
56
+ step=1,
57
+ readout=False,
58
+ style=style,
59
+ layout=widgets.Layout(padding=padding, width="130px"),
60
+ )
61
+ pre_cloud_label = widgets.Label(value=str(pre_cloud_cover.value))
62
+ geemap.jslink_slider_label(pre_cloud_cover, pre_cloud_label)
63
+ pre_widget.children = [
64
+ pre_start_date,
65
+ pre_end_date,
66
+ pre_cloud_cover,
67
+ pre_cloud_label,
68
+ ]
69
+ post_start_date = widgets.DatePicker(
70
+ description="Start",
71
+ value=date(2024, 1, 1),
72
+ style=style,
73
+ layout=widgets.Layout(padding=padding, width="160px"),
74
+ )
75
+ post_end_date = widgets.DatePicker(
76
+ description="End",
77
+ value=date(2024, 12, 31),
78
+ style=style,
79
+ layout=widgets.Layout(padding=padding, width="160px"),
80
+ )
81
+ post_cloud_cover = widgets.IntSlider(
82
+ description="Cloud",
83
+ min=0,
84
+ max=100,
85
+ value=30,
86
+ step=1,
87
+ readout=False,
88
+ style=style,
89
+ layout=widgets.Layout(padding=padding, width="130px"),
90
+ )
91
+ post_cloud_label = widgets.Label(value=str(post_cloud_cover.value))
92
+ geemap.jslink_slider_label(post_cloud_cover, post_cloud_label)
93
+ post_widget.children = [
94
+ post_start_date,
95
+ post_end_date,
96
+ post_cloud_cover,
97
+ post_cloud_label,
98
+ ]
99
+
100
+ apply_btn = widgets.Button(description="Apply", layout=layout)
101
+ reset_btn = widgets.Button(description="Reset", layout=layout)
102
+ buttons = widgets.HBox([apply_btn, reset_btn])
103
+ output = widgets.Output()
104
+
105
+ use_split = widgets.Checkbox(
106
+ value=False,
107
+ description="Split map",
108
+ style=style,
109
+ layout=widgets.Layout(padding=padding, width="100px"),
110
+ )
111
+
112
+ use_ndwi = widgets.Checkbox(
113
+ value=False,
114
+ description="Compute NDWI",
115
+ style=style,
116
+ layout=widgets.Layout(padding=padding, width="160px"),
117
+ )
118
+
119
+ ndwi_threhold = widgets.FloatSlider(
120
+ description="Threshold",
121
+ min=-1,
122
+ max=1,
123
+ value=0,
124
+ step=0.05,
125
+ readout=True,
126
+ style=style,
127
+ layout=widgets.Layout(padding=padding, width="230px"),
128
+ )
129
+
130
+ options = widgets.HBox(
131
+ [
132
+ use_split,
133
+ use_ndwi,
134
+ ndwi_threhold,
135
+ ]
136
+ )
137
+
138
+ widget.children = [pre_widget, post_widget, options, buttons, output]
139
+ self.add_widget(widget, position=position, **kwargs)
140
+
141
+ def apply_btn_click(b):
142
+
143
+ marker_layer = self.find_layer("Search location")
144
+ if marker_layer is not None:
145
+ self.remove(marker_layer)
146
+ self.clean_up()
147
+
148
+ if self.user_roi is None:
149
+ output.clear_output()
150
+ output.append_stdout("Please draw a ROI first.")
151
+ elif (
152
+ pre_start_date.value is None
153
+ or pre_end_date.value is None
154
+ or post_start_date.value is None
155
+ or post_end_date.value is None
156
+ ):
157
+ output.clear_output()
158
+ output.append_stdout("Please select start and end dates.")
159
+
160
+ elif self.user_roi is not None:
161
+ output.clear_output()
162
+ output.append_stdout("Computing... Please wait.")
163
+ roi = ee.FeatureCollection(self.user_roi)
164
+ vis_params = {"bands": ["B6", "B5", "B4"], "min": 0, "max": 0.4}
165
+ if pre_start_date.value.strftime("%Y-%m-%d") < "2013-04-11":
166
+ pre_col = geemap.landsat_timeseries(
167
+ roi,
168
+ start_year=pre_start_date.value.year,
169
+ end_year=pre_end_date.value.year,
170
+ ).select(["SWIR1", "NIR", "Red", "Green"], ["B6", "B5", "B4", "B3"])
171
+ else:
172
+ pre_col = (
173
+ ee.ImageCollection("NASA/HLS/HLSL30/v002")
174
+ .filterBounds(roi)
175
+ .filterDate(
176
+ pre_start_date.value.strftime("%Y-%m-%d"),
177
+ pre_end_date.value.strftime("%Y-%m-%d"),
178
+ )
179
+ .filter(ee.Filter.lt("CLOUD_COVERAGE", pre_cloud_cover.value))
180
+ )
181
+
182
+ if post_start_date.value.strftime("%Y-%m-%d") < "2013-04-11":
183
+ post_col = geemap.landsat_timeseries(
184
+ roi,
185
+ start_year=post_start_date.value.year,
186
+ end_year=post_end_date.value.year,
187
+ ).select(["SWIR1", "NIR", "Red", "Green"], ["B6", "B5", "B4", "B3"])
188
+ else:
189
+ post_col = (
190
+ ee.ImageCollection("NASA/HLS/HLSL30/v002")
191
+ .filterBounds(roi)
192
+ .filterDate(
193
+ post_start_date.value.strftime("%Y-%m-%d"),
194
+ post_end_date.value.strftime("%Y-%m-%d"),
195
+ )
196
+ .filter(ee.Filter.lt("CLOUD_COVERAGE", post_cloud_cover.value))
197
+ )
198
+
199
+ pre_img = pre_col.median().clip(roi)
200
+ post_img = post_col.median().clip(roi)
201
+
202
+ if use_split.value:
203
+ left_layer = geemap.ee_tile_layer(
204
+ pre_img, vis_params, "Pre-event Image"
205
+ )
206
+ right_layer = geemap.ee_tile_layer(
207
+ post_img, vis_params, "Post-event Image"
208
+ )
209
+ self.split_map(
210
+ left_layer,
211
+ right_layer,
212
+ add_close_button=True,
213
+ left_label="Pre-event",
214
+ right_label="Post-event",
215
+ )
216
+ else:
217
+ pre_img = pre_col.median().clip(roi)
218
+ post_img = post_col.median().clip(roi)
219
+ self.add_layer(pre_img, vis_params, "Pre-event Image")
220
+ self.add_layer(post_img, vis_params, "Post-event Image")
221
+
222
+ if use_ndwi.value and (not use_split.value):
223
+ pre_ndwi = pre_img.normalizedDifference(["B3", "B6"]).rename("NDWI")
224
+ post_ndwi = post_img.normalizedDifference(["B3", "B6"]).rename(
225
+ "NDWI"
226
+ )
227
+ ndwi_vis = {"min": -1, "max": 1, "palette": "ndwi"}
228
+ self.add_layer(pre_ndwi, ndwi_vis, "Pre-event NDWI", False)
229
+ self.add_layer(post_ndwi, ndwi_vis, "Post-event NDWI", False)
230
+
231
+ pre_water = pre_ndwi.gt(ndwi_threhold.value)
232
+ post_water = post_ndwi.gt(ndwi_threhold.value)
233
+ self.add_layer(
234
+ pre_water.selfMask(), {"palette": "blue"}, "Pre-event Water"
235
+ )
236
+ self.add_layer(
237
+ post_water.selfMask(), {"palette": "red"}, "Post-event Water"
238
+ )
239
+ new_water = post_water.subtract(pre_water).gt(0)
240
+ disappear_water = pre_water.subtract(post_water).gt(0)
241
+ self.add_layer(
242
+ disappear_water.selfMask(),
243
+ {"palette": "brown"},
244
+ "Disappeared Water",
245
+ )
246
+ self.add_layer(
247
+ new_water.selfMask(), {"palette": "cyan"}, "New Water"
248
+ )
249
+
250
+ with output:
251
+ output.clear_output()
252
+
253
+ output.clear_output()
254
+
255
+ apply_btn.on_click(apply_btn_click)
256
+
257
+ def reset_btn_click(b):
258
+ self.clean_up()
259
+ self._draw_control.clear()
260
+ draw_layer = self.find_layer("Drawn Features")
261
+ if draw_layer is not None:
262
+ self.remove(draw_layer)
263
+ output.clear_output()
264
+
265
+ reset_btn.on_click(reset_btn_click)
266
+
267
+
268
+ @solara.component
269
+ def Page():
270
+ with solara.Column(style={"min-width": "500px"}):
271
+ Map.element(
272
+ center=[20, -0],
273
+ zoom=2,
274
+ height="750px",
275
+ zoom_ctrl=False,
276
+ measure_ctrl=False,
277
+ )
pages/09_teste.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap
3
+ import plotly.express as px
4
+ import pandas as pd
5
+ import solara
6
+ import dataclasses
7
+ from typing import Callable, cast
8
+
9
+ df = pd.read_csv('CSVs\esa_stats_ucs_rj2 - esa_stats_ucs_rj2.csv.csv')
10
+ columns = list(df.columns)
11
+ #df = px.data.iris()
12
+
13
+ @dataclasses.dataclass
14
+ class ClickPoint:
15
+ row_index: int
16
+ x_column: str
17
+ y_column: str
18
+
19
+ def find_row_index(fig, click_data):
20
+ # goes from trace index and point index to row index in a dataframe
21
+ # requires passing df.index as to custom_data
22
+ trace_index = click_data["points"]["trace_indexes"][0]
23
+ point_index = click_data["points"]["point_indexes"][0]
24
+ trace = fig.data[trace_index]
25
+ return trace.customdata[point_index][0]
26
+
27
+
28
+
29
+
30
+ class Map(geemap.Map):
31
+ def __init__(self, **kwargs):
32
+ super().__init__(**kwargs)
33
+ self.add_ee_data()
34
+ self.add("layer_manager")
35
+ self.add("inspector")
36
+
37
+ def add_ee_data(self):
38
+ # Add Earth Engine dataset
39
+
40
+ esa = ee.ImageCollection('ESA/WorldCover/v200').first()
41
+
42
+ ucs = ee.FeatureCollection("projects/ee-curso-gee-rhamon/assets/ucs_estaduais_rj")
43
+
44
+
45
+ esa = esa.clipToCollection(ucs)
46
+
47
+
48
+
49
+ # Set visualization parameters.
50
+
51
+ visualization = {
52
+ "bands": ['Map'],
53
+ }
54
+
55
+
56
+ fc_vis_params = {
57
+ "color": "000000",
58
+ "width": 1,
59
+ "Opacity": 0.8,
60
+ }
61
+
62
+ # Add Earth Engine layers to Map
63
+
64
+ self.centerObject(ucs, zoom=8)
65
+ self.addLayer(ucs, fc_vis_params, "UCs Estaduais RJ")
66
+ self.addLayer(esa, visualization, "Landcover")
67
+ self.add_legend(title="Land Cover Type", builtin_legend='ESA_WorldCover', position="bottomright")
68
+
69
+
70
+ @solara.component
71
+ def Page():
72
+ with solara.Column(style={"min-width": "500px"}):
73
+ Map.element(
74
+ center=[40, -100],
75
+ zoom=4,
76
+ height="600px",
77
+ )
78
+ fig = px.pie(df,values= x, names="Classes", title='Cobertura Florestal UCs Estaduais RJ')
79
+ #fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
80
+ #solara.FigurePlotly(fig)
81
+
82
+ @solara.component
83
+ def ClickScatter(df, x, click_row, on_click: Callable[[ClickPoint], None]):
84
+ x, set_x = solara.use_state(x)
85
+ #y, set_y = solara.use_state(y)
86
+ #fig = px.scatter(df, x, y, color=color, custom_data=[df.index])
87
+ fig = px.pie(df,values= x , names='Classes', title='Cobertura Florestal UCs Estaduais RJ')
88
+
89
+ def on_click_trace(click_data):
90
+ # sanity checks
91
+ assert click_data["event_type"] == "plotly_click"
92
+ row_index = find_row_index(fig, click_data)
93
+ on_click(ClickPoint(row_index, x))
94
+
95
+ if click_row:
96
+ click_x = df[x].values[click_row]
97
+ #fig.add_trace(px.scatter(x=, y=[click_y], text=["⭐️"]).data[0])
98
+ fig.add_trace(px.pie(values= [click_x], names='Classes', title='Cobertura Florestal UCs Estaduais RJ').data[0])
99
+ # make the figure a bit smaller
100
+ fig.update_layout(width=1340,height=800)
101
+ with solara.Column(style={"width": "1540px"}) as main:
102
+ solara.FigurePlotly(fig, on_click=on_click_trace)
103
+ solara.Select(label="X-axis", value=x, values=columns, on_value=set_x)
104
+ return main
105
+
106
+ @solara.component
107
+ def Page():
108
+ with solara.Column(style={"min-width": "500px"}):
109
+ Map.element(
110
+ center=[-22, -43],
111
+ zoom=8,
112
+ height="600px",
113
+ )
114
+
115
+
116
+ click_point, set_click_point = solara.use_state(cast(ClickPoint, None))
117
+ if click_point:
118
+ clicked_row = click_point.row_index
119
+ else:
120
+ clicked_row = None
121
+
122
+ with solara.Row(justify="center", style={"flex-wrap": "wrap"}):
123
+ ClickScatter(df, 'nome', clicked_row, on_click=set_click_point)
124
+ if click_point is not None:
125
+ clicked_row = click_point.row_index
126
+ solara.Success(f"Clicked on row {clicked_row}. Which is highlighted in the both plots.")
127
+ solara.Markdown(
128
+ f"""
129
+ ```python
130
+ row_data = {df.iloc[clicked_row].to_dict()}
131
+ ```"""
132
+ )
133
+ else:
134
+ solara.Info("Click to select a point")
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ geemap
2
+ geopandas
3
+ pydantic< 2.0
4
+ solara
5
+ plotly