cboettig commited on
Commit
2b3c092
·
1 Parent(s): c89fcc1
Files changed (1) hide show
  1. app.py +51 -6
app.py CHANGED
@@ -132,14 +132,12 @@ combined_style = {
132
  # +
133
  m = leafmap.Map(center=[35, -100], zoom=3)
134
  m.add_basemap("CartoDB.DarkMatter")
135
-
136
  m.add_tile_layer(
137
  url="https://minio.carlboettiger.info/shared-data/mobi-tiles/grey/{z}/{x}/{y}.png",
138
  name="Imperiled Species Richness (Greyscale)",
139
  attribution="NatureServe",
140
  opacity=0.99
141
  )
142
-
143
  m.add_pmtiles( public, name="Public", style=public_style, overlay=True, show=True, zoom_to_layer=False)
144
  m.add_pmtiles(private, name="Private", style=private_style, overlay=True, show=True, zoom_to_layer=False)
145
  m.add_pmtiles(tribal, name="Tribal", style=tribal_style, overlay=True, show=True, zoom_to_layer=False)
@@ -147,10 +145,57 @@ m.add_pmtiles(mixed, name="Mixed", style=mixed_style, overlay=True, show=True, z
147
  m.add_pmtiles(tribal, name="tooltip", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
148
 
149
 
150
-
151
  m.to_streamlit(height=900)
 
152
 
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  # +
155
  st.write("# MOBI Species Richness (Light theme)")
156
 
@@ -166,7 +211,7 @@ m.add_tile_layer(
166
  opacity=0.9
167
  )
168
  m.add_pmtiles(
169
- tribal, name="PMTiles", style=style, overlay=True, show=True, zoom_to_layer=False
170
  )
171
-
172
- m.to_streamlit(height=900)
 
132
  # +
133
  m = leafmap.Map(center=[35, -100], zoom=3)
134
  m.add_basemap("CartoDB.DarkMatter")
 
135
  m.add_tile_layer(
136
  url="https://minio.carlboettiger.info/shared-data/mobi-tiles/grey/{z}/{x}/{y}.png",
137
  name="Imperiled Species Richness (Greyscale)",
138
  attribution="NatureServe",
139
  opacity=0.99
140
  )
 
141
  m.add_pmtiles( public, name="Public", style=public_style, overlay=True, show=True, zoom_to_layer=False)
142
  m.add_pmtiles(private, name="Private", style=private_style, overlay=True, show=True, zoom_to_layer=False)
143
  m.add_pmtiles(tribal, name="Tribal", style=tribal_style, overlay=True, show=True, zoom_to_layer=False)
 
145
  m.add_pmtiles(tribal, name="tooltip", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
146
 
147
 
 
148
  m.to_streamlit(height=900)
149
+ # -
150
 
151
 
152
+ ## Tooltip layer -- hack
153
+ style = {
154
+ "version": 8,
155
+ "sources": {
156
+ "public": {
157
+ "type": "vector",
158
+ "url": "pmtiles://" + public,
159
+ "attribution": "PMTiles"},
160
+ "tribal": {
161
+ "type": "vector",
162
+ "url": "pmtiles://" + tribal,
163
+ "attribution": "PMTiles"},
164
+ "private": {
165
+ "type": "vector",
166
+ "url": "pmtiles://" + private,
167
+ "attribution": "PMTiles"},
168
+ "mixed": {
169
+ "type": "vector",
170
+ "url": "pmtiles://" + mixed,
171
+ "attribution": "PMTiles"}},
172
+ "layers": [{
173
+ "id": "mixed",
174
+ "source": "mixed",
175
+ "source-layer": "mixed_protected",
176
+ "type": "fill",
177
+ "paint": {"fill-color": green, "fill-opacity": 0.5}},
178
+ {
179
+ "id": "tribal",
180
+ "source": "tribal",
181
+ "source-layer": "tribal_protected",
182
+ "type": "fill",
183
+ "paint": {"fill-color": purple, "fill-opacity": 0.5}
184
+ },
185
+ {
186
+ "id": "public",
187
+ "source": "public",
188
+ "source-layer": "public_protected",
189
+ "type": "fill",
190
+ "paint": {"fill-color": blue, "fill-opacity": 0.5}
191
+ },
192
+ {
193
+ "id": "private",
194
+ "source": "private",
195
+ "source-layer": "private_protected",
196
+ "type": "fill",
197
+ "paint": {"fill-color": red, "fill-opacity": 0.5}}]}
198
+
199
  # +
200
  st.write("# MOBI Species Richness (Light theme)")
201
 
 
211
  opacity=0.9
212
  )
213
  m.add_pmtiles(
214
+ tribal, name="PMTiles", style=combined_style, overlay=True, show=True, zoom_to_layer=False
215
  )
216
+ m
217
+ #m.to_streamlit(height=900)