Connor Sutton
commited on
Commit
Β·
a489e19
1
Parent(s):
a45c2b1
restructured module
Browse files- Dockerfile +2 -2
- docker-compose.yml +1 -1
- {geospatial-data-converter β geospatial_data_converter}/.streamlit/config.toml +0 -0
- geospatial_data_converter/__init__.py +0 -0
- {geospatial-data-converter β geospatial_data_converter}/app.py +0 -0
- {geospatial-data-converter β geospatial_data_converter}/kml_tricks.py +1 -1
- geospatial_data_converter/tests/boundary.kml +0 -0
- geospatial_data_converter/tests/test_kml.py +16 -0
- geospatial_data_converter/tests/testpoint_ocean.kmz +0 -0
- {geospatial-data-converter β geospatial_data_converter}/utils.py +0 -3
Dockerfile
CHANGED
@@ -11,10 +11,10 @@ RUN pip install --user --no-cache-dir --upgrade pip
|
|
11 |
COPY ./requirements.txt /home/appuser/requirements.txt
|
12 |
RUN pip install --user --no-cache-dir --upgrade -r /home/appuser/requirements.txt
|
13 |
|
14 |
-
COPY
|
15 |
|
16 |
WORKDIR /workspace
|
17 |
EXPOSE 7860
|
18 |
|
19 |
-
CMD ["streamlit", "run", "/home/appuser/
|
20 |
#CMD ["/bin/bash"]
|
|
|
11 |
COPY ./requirements.txt /home/appuser/requirements.txt
|
12 |
RUN pip install --user --no-cache-dir --upgrade -r /home/appuser/requirements.txt
|
13 |
|
14 |
+
COPY geospatial_data_converter/ /home/appuser/geospatial_data_converter/
|
15 |
|
16 |
WORKDIR /workspace
|
17 |
EXPOSE 7860
|
18 |
|
19 |
+
CMD ["streamlit", "run", "/home/appuser/geospatial_data_converter/app.py", "--server.port", "7860", "--server.address", "0.0.0.0", "--server.enableXsrfProtection=false"]
|
20 |
#CMD ["/bin/bash"]
|
docker-compose.yml
CHANGED
@@ -9,7 +9,7 @@ services:
|
|
9 |
working_dir: /workspace
|
10 |
command: [
|
11 |
"streamlit", "run",
|
12 |
-
"/home/appuser/
|
13 |
"--server.port", "${APP_PORT:-7860}",
|
14 |
"--server.address", "0.0.0.0",
|
15 |
"--server.enableXsrfProtection=false"
|
|
|
9 |
working_dir: /workspace
|
10 |
command: [
|
11 |
"streamlit", "run",
|
12 |
+
"/home/appuser/geospatial_data_converter/app.py",
|
13 |
"--server.port", "${APP_PORT:-7860}",
|
14 |
"--server.address", "0.0.0.0",
|
15 |
"--server.enableXsrfProtection=false"
|
{geospatial-data-converter β geospatial_data_converter}/.streamlit/config.toml
RENAMED
File without changes
|
geospatial_data_converter/__init__.py
ADDED
File without changes
|
{geospatial-data-converter β geospatial_data_converter}/app.py
RENAMED
File without changes
|
{geospatial-data-converter β geospatial_data_converter}/kml_tricks.py
RENAMED
@@ -52,7 +52,7 @@ def parse_descriptions_to_geodf(geodf: gpd.GeoDataFrame) -> gpd.GeoDataFrame:
|
|
52 |
|
53 |
def swap_coordinates(geometry):
|
54 |
"""
|
55 |
-
Swap the latitude and longitude of
|
56 |
MultiPoint, MultiLineString, MultiPolygon, or LinearRing geometry.
|
57 |
|
58 |
Parameters:
|
|
|
52 |
|
53 |
def swap_coordinates(geometry):
|
54 |
"""
|
55 |
+
Swap the latitude and longitude of a shapely Point, LineString, Polygon,
|
56 |
MultiPoint, MultiLineString, MultiPolygon, or LinearRing geometry.
|
57 |
|
58 |
Parameters:
|
geospatial_data_converter/tests/boundary.kml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
geospatial_data_converter/tests/test_kml.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
|
3 |
+
sys.path.append("..")
|
4 |
+
from utils import convert, read_file
|
5 |
+
|
6 |
+
|
7 |
+
def test_kml_coversion():
|
8 |
+
with open("boundary.kml", "rb") as f:
|
9 |
+
kml = read_file(f)
|
10 |
+
converted_data = convert(kml, "boundary_converted.kml", "kml")
|
11 |
+
with open("boundary_converted.kml", "wb") as f:
|
12 |
+
f.write(converted_data)
|
13 |
+
|
14 |
+
|
15 |
+
def test_kmz_conversion():
|
16 |
+
pass
|
geospatial_data_converter/tests/testpoint_ocean.kmz
ADDED
Binary file (687 Bytes). View file
|
|
{geospatial-data-converter β geospatial_data_converter}/utils.py
RENAMED
@@ -64,9 +64,6 @@ def convert(gdf: gpd.GeoDataFrame, output_name: str, output_format: str) -> byte
|
|
64 |
if output_format == "CSV":
|
65 |
gdf.to_csv(out_path)
|
66 |
else:
|
67 |
-
# if output_format == 'KML': # need to longitude and latitude columns
|
68 |
-
# # gdf = gdf.apply(lambda row: swap_coordinates(row), axis=1)
|
69 |
-
# gdf['geometry'] = gdf['geometry'].apply(swap_coordinates)
|
70 |
gdf.to_file(out_path, driver=output_format, engine="pyogrio")
|
71 |
|
72 |
if output_format in ("ESRI Shapefile", "OpenFileGDB"):
|
|
|
64 |
if output_format == "CSV":
|
65 |
gdf.to_csv(out_path)
|
66 |
else:
|
|
|
|
|
|
|
67 |
gdf.to_file(out_path, driver=output_format, engine="pyogrio")
|
68 |
|
69 |
if output_format in ("ESRI Shapefile", "OpenFileGDB"):
|