Spaces:
Sleeping
Sleeping
test
Browse files- .gitattributes +4 -0
- app.py +117 -0
- requirements.txt +6 -0
.gitattributes
CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
|
|
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
|
36 |
+
*.geojson filter=lfs diff=lfs merge=lfs -text
|
37 |
+
*.html filter=lfs diff=lfs merge=lfs -text
|
38 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
*.pmtiles filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3 |
+
# you may not use this file except in compliance with the License.
|
4 |
+
# You may obtain a copy of the License at
|
5 |
+
#
|
6 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7 |
+
#
|
8 |
+
# Unless required by applicable law or agreed to in writing, software
|
9 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11 |
+
# See the License for the specific language governing permissions and
|
12 |
+
# limitations under the License.
|
13 |
+
|
14 |
+
# +
|
15 |
+
import leafmap.foliumap as leafmap
|
16 |
+
import streamlit as st
|
17 |
+
|
18 |
+
public = "https://minio.carlboettiger.info/shared-data/pad/public.pmtiles"
|
19 |
+
tribal = "https://minio.carlboettiger.info/shared-data/pad/tribal.pmtiles"
|
20 |
+
private = "https://minio.carlboettiger.info/shared-data/pad/private.pmtiles"
|
21 |
+
mixed = "https://minio.carlboettiger.info/shared-data/pad/mixed.pmtiles"
|
22 |
+
style = {
|
23 |
+
"version": 8,
|
24 |
+
"sources": {
|
25 |
+
"public": {
|
26 |
+
"type": "vector",
|
27 |
+
"url": "pmtiles://" + public,
|
28 |
+
"attribution": "PMTiles",
|
29 |
+
},
|
30 |
+
"tribal": {
|
31 |
+
"type": "vector",
|
32 |
+
"url": "pmtiles://" + tribal,
|
33 |
+
"attribution": "PMTiles",
|
34 |
+
},
|
35 |
+
"private": {
|
36 |
+
"type": "vector",
|
37 |
+
"url": "pmtiles://" + private,
|
38 |
+
"attribution": "PMTiles",
|
39 |
+
},
|
40 |
+
"mixed": {
|
41 |
+
"type": "vector",
|
42 |
+
"url": "pmtiles://" + mixed,
|
43 |
+
"attribution": "PMTiles",
|
44 |
+
}
|
45 |
+
},
|
46 |
+
"layers": [
|
47 |
+
{
|
48 |
+
"id": "tribal",
|
49 |
+
"source": "tribal",
|
50 |
+
"source-layer": "tribal_protected",
|
51 |
+
"type": "fill",
|
52 |
+
"paint": {"fill-color": "#3388ff", "fill-opacity": 0.5}
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"id": "public",
|
56 |
+
"source": "public",
|
57 |
+
"source-layer": "public_protected",
|
58 |
+
"type": "fill",
|
59 |
+
"paint": {"fill-color": "#850101", "fill-opacity": 0.5}
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"id": "private",
|
63 |
+
"source": "private",
|
64 |
+
"source-layer": "private_protected",
|
65 |
+
"type": "fill",
|
66 |
+
"paint": {"fill-color": "#4b3b76", "fill-opacity": 0.5}
|
67 |
+
},
|
68 |
+
{
|
69 |
+
"id": "mixed",
|
70 |
+
"source": "mixed",
|
71 |
+
"source-layer": "mixed_protected",
|
72 |
+
"type": "fill",
|
73 |
+
"paint": {"fill-color": "#005a00", "fill-opacity": 0.5}
|
74 |
+
}
|
75 |
+
]
|
76 |
+
}
|
77 |
+
|
78 |
+
# -
|
79 |
+
|
80 |
+
st.set_page_config(layout="wide", page_title="Protected Areas Explorer", page_icon=":globe:")
|
81 |
+
|
82 |
+
|
83 |
+
# +
|
84 |
+
m = leafmap.Map(center=[35, -100], zoom=4)
|
85 |
+
SURFACE_IMAGE ="https://huggingface.co/spaces/boettiger-lab/protected-areas/resolve/main/mobi/{z}/{x}/{y}.png"
|
86 |
+
m.add_basemap("CartoDB.DarkMatter")
|
87 |
+
m.add_tile_layer(
|
88 |
+
url=SURFACE_IMAGE,
|
89 |
+
name="MOBI",
|
90 |
+
attribution="NatureServe",
|
91 |
+
opacity=0.99
|
92 |
+
)
|
93 |
+
m.add_pmtiles(
|
94 |
+
tribal, name="Protected Areas", style=style, overlay=True, show=True, zoom_to_layer=False
|
95 |
+
)
|
96 |
+
|
97 |
+
st.write(m)
|
98 |
+
|
99 |
+
|
100 |
+
# +
|
101 |
+
|
102 |
+
# style = leafmap.pmtiles_style(url) # Use default style
|
103 |
+
|
104 |
+
m = leafmap.Map(center=[35, -100], zoom=4)
|
105 |
+
SURFACE_IMAGE ="https://minio.carlboettiger.info/shared-data/mobi-tiles/red/{z}/{x}/{y}.png"
|
106 |
+
m.add_basemap("Esri.WorldGrayCanvas")
|
107 |
+
m.add_tile_layer(
|
108 |
+
url=SURFACE_IMAGE,
|
109 |
+
name="MOBI",
|
110 |
+
attribution="NatureServe",
|
111 |
+
opacity=0.9
|
112 |
+
)
|
113 |
+
m.add_pmtiles(
|
114 |
+
tribal, name="PMTiles", style=style, overlay=True, show=True, zoom_to_layer=False
|
115 |
+
)
|
116 |
+
|
117 |
+
st.write(m)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
pydeck
|
3 |
+
pmtiles
|
4 |
+
streamlit
|
5 |
+
leafmap
|
6 |
+
|