Kelbec commited on
Commit
4bc2361
1 Parent(s): b79ff85

fix line multiline parsing

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -0
  2. docker-compose.yml +3 -4
  3. pages/01_dcascade.py +32 -13
Dockerfile CHANGED
@@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
11
  RUN conda install -c conda-forge gdal
12
  RUN pip install git+https://${GITHUB_TOKEN}@github.com/saferplaces/dcascade_py.git@development
13
  RUN pip install keplergl
 
14
  COPY requirements.txt .
15
  RUN pip install -r requirements.txt
16
 
 
11
  RUN conda install -c conda-forge gdal
12
  RUN pip install git+https://${GITHUB_TOKEN}@github.com/saferplaces/dcascade_py.git@development
13
  RUN pip install keplergl
14
+ RUN pip install xarray
15
  COPY requirements.txt .
16
  RUN pip install -r requirements.txt
17
 
docker-compose.yml CHANGED
@@ -2,9 +2,8 @@
2
  # docker-compose up -d
3
  services:
4
  dcascade:
5
- image: dcascade
6
- build: .
7
  ports:
8
  - "8765:8765"
9
- # volumes:
10
- # - .:/dcascade
 
2
  # docker-compose up -d
3
  services:
4
  dcascade:
5
+ image: 901702069075.dkr.ecr.us-east-1.amazonaws.com/dcascade-app:latest
 
6
  ports:
7
  - "8765:8765"
8
+ volumes:
9
+ - ./public:/home/jovyan/public
pages/01_dcascade.py CHANGED
@@ -12,9 +12,8 @@ from leafmap.toolbar import change_basemap
12
  from solara.components.file_drop import FileInfo
13
  from dcascade_py import dcascade_py
14
  import xarray as xr
15
- from shapely.geometry import LineString
16
  import time
17
- import pandas as pd
18
 
19
 
20
  file_nc = solara.reactive("")
@@ -135,17 +134,37 @@ def MapComponent():
135
  m.add(geo_data.value)
136
  m.add(LayersControl())
137
  if sel_feature.value is not None:
138
- # Extracting the geometry
139
- geometry = LineString(sel_feature.value['geometry']['coordinates'])
140
-
141
- # Creating GeoDataFrame
142
- gdf = gpd.GeoDataFrame([sel_feature.value['properties']], geometry=[geometry])
143
-
144
- # Set the CRS (Coordinate Reference System) if known
145
- gdf.crs = "EPSG:4326"
146
- # Set the CRS (Coordinate Reference System) if known
147
- sel_geo_data = GeoData(geo_dataframe=gdf)
148
- sel_geo_data.style = {'color': 'red', 'fillColor': '#3366cc', 'opacity':0.5, 'weight':15.0, 'dashArray':'5'}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  if sel_geo_data:
151
  m.element( # type: ignore
 
12
  from solara.components.file_drop import FileInfo
13
  from dcascade_py import dcascade_py
14
  import xarray as xr
15
+ from shapely.geometry import LineString,MultiLineString
16
  import time
 
17
 
18
 
19
  file_nc = solara.reactive("")
 
134
  m.add(geo_data.value)
135
  m.add(LayersControl())
136
  if sel_feature.value is not None:
137
+ # print(type(sel_feature.value['geometry']['coordinates']))
138
+ try:
139
+ # Extracting the geometry
140
+ geometry = LineString(sel_feature.value['geometry']['coordinates'])
141
+
142
+ # Creating GeoDataFrame
143
+ gdf = gpd.GeoDataFrame([sel_feature.value['properties']], geometry=[geometry])
144
+
145
+ # Set the CRS (Coordinate Reference System) if known
146
+ gdf.crs = "EPSG:4326"
147
+ # Set the CRS (Coordinate Reference System) if known
148
+ sel_geo_data = GeoData(geo_dataframe=gdf)
149
+ sel_geo_data.style = {'color': 'red', 'fillColor': '#3366cc', 'opacity':0.5, 'weight':15.0, 'dashArray':'5'}
150
+ except Exception as e:
151
+ print(e)
152
+ sel_geo_data = None
153
+ try:
154
+ # Extracting the geometry
155
+ geometry = MultiLineString(sel_feature.value['geometry']['coordinates'])
156
+
157
+ # Creating GeoDataFrame
158
+ gdf = gpd.GeoDataFrame([sel_feature.value['properties']], geometry=[geometry])
159
+
160
+ # Set the CRS (Coordinate Reference System) if known
161
+ gdf.crs = "EPSG:4326"
162
+ # Set the CRS (Coordinate Reference System) if known
163
+ sel_geo_data = GeoData(geo_dataframe=gdf)
164
+ sel_geo_data.style = {'color': 'red', 'fillColor': '#3366cc', 'opacity':0.5, 'weight':15.0, 'dashArray':'5'}
165
+ except Exception as e:
166
+ print(e)
167
+ sel_geo_data = None
168
 
169
  if sel_geo_data:
170
  m.element( # type: ignore