Py.Cafe

rhamon-garcia/

leafmap-solara-data-explorer

Interactive Geospatial Data Explorer

DocsPricing
  • RJ_UF_2021.shp
  • app.py
  • requirements.txt
  • teste_rj.json
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import leafmap
import solara

zoom = solara.reactive(2)
center = solara.reactive((20, 0))


class Map(leafmap.Map):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Add what you want below
        #url =('https://github.com/rhamon-garcia/Vector_Data_Test/blob/main/teste_ucs.json')
        #url = ('https://github.com/rhamon-garcia/Vector_Data_Test/blob/main/gpl_ucs_estaduais_limites_inearj_me_2023.zip')
        #url = ('https://github.com/rhamon-garcia/Vector_Data_Test/blob/main/gpl_ucs_estaduais_limites_inearj_me_2023.shp')
        url = ('https://github.com/giswqs/data/raw/main/raster/srtm90.tif')
        #self.add_stac_gui()
        #self.add_geojson(in_geojson=url,layer_name="UCs RJ")
        #self.add_vector_tile_layer(url, styles={}, layer_name='Vector Tile')
        #self.add_vector_tile(url, styles={}, layer_name='Vector Tile', **kwargs)
        #self.add_data(url,layer_name='Teste')
        self.add_cog_layer(url,name='Teste2')
        #self.add_layer(url)
        #self.add_kml(in_kml=url,layer_name='Teste3')
        #center = [52.204793, 360.121558]

        
        #marker = Marker(location=center, draggable=False)
        #self.add_marker(center);


@solara.component
def Page():
    with solara.Column(style={"min-width": "500px"}):
        # solara components support reactive variables
        # solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
        # using 3rd party widget library require wiring up the events manually
        # using zoom.value and zoom.set
        Map.element(  # type: ignore
            zoom=zoom.value,
            on_zoom=zoom.set,
            center=center.value,
            on_center=center.set,
            scroll_wheel_zoom=True,
            toolbar_ctrl=False,
            data_ctrl=False,
            height="780px",
        )
        # solara.Text(f"Zoom: {zoom.value}")
        # solara.Text(f"Center: {center.value}")