Skip to content

Commit

Permalink
fix project export #419
Browse files Browse the repository at this point in the history
  • Loading branch information
KellyMWhitehead authored and philipbaileynar committed Aug 9, 2024
1 parent e782ff5 commit adb3f11
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This one is so we can develop and have code hinting. Use pip3 install -e /local/RiverscapesXML/python/packages/rsxml to debug locally
# Remove this and pip uninstall rsxml to use the wheel file
$QGIS_PATH/Contents/MacOS/bin/pip3 install rsxml==2.0.1
$QGIS_PATH/Contents/MacOS/bin/pip3 install rsxml==2.0.6
# This is the wheel file we want to package up
rm -fr ./wheels
$QGIS_PATH/Contents/MacOS/bin/pip3 wheel rsxml==2.0.1 -w ./wheels --no-deps
$QGIS_PATH/Contents/MacOS/bin/pip3 wheel rsxml==2.0.6 -w ./wheels --no-deps
38 changes: 26 additions & 12 deletions src/view/frm_export_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def accept(self) -> None:
os.mkdir(self.txt_outpath.text())

# copy the geopackage layers to the new project folder
out_name = os.path.split(self.qris_project.project_file)[1]
out_name = 'qris.gpkg' # os.path.split(self.qris_project.project_file)[1]
out_geopackage = os.path.abspath(os.path.join(self.txt_outpath.text(), out_name).replace("\\", "/"))
shutil.copy(self.qris_project.project_file, out_geopackage)

Expand Down Expand Up @@ -357,7 +357,12 @@ def accept(self) -> None:
continue
if value == "":
continue
metadata_values.append(Meta(key, value))
if key == "metadata":
dict_metadata = value
for k, v in dict_metadata.items():
metadata_values.append(Meta(k, v))
else:
metadata_values.append(Meta(key, value))

self.rs_project = Project(name=self.txt_rs_name.text(),
proj_path=xml_path,
Expand Down Expand Up @@ -434,7 +439,8 @@ def accept(self) -> None:

input_layers.append(GeopackageLayer(lyr_name=view_name,
name=aoi.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='aoi'))

# Sample Frames
sample_frame_node = self.find_child_node(inputs_node, "Sample Frames")
Expand Down Expand Up @@ -463,7 +469,8 @@ def accept(self) -> None:

input_layers.append(GeopackageLayer(lyr_name=view_name,
name=sample_frame.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='sample_frame'))

# Profiles
profile_node = self.find_child_node(inputs_node, "Profiles")
Expand Down Expand Up @@ -492,7 +499,8 @@ def accept(self) -> None:

input_layers.append(GeopackageLayer(lyr_name=view_name,
name=profile.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='profile'))

# Cross Sections
xsection_node = self.find_child_node(inputs_node, "Cross Sections")
Expand Down Expand Up @@ -520,7 +528,8 @@ def accept(self) -> None:

input_layers.append(GeopackageLayer(lyr_name=view_name,
name=xsection.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='cross_section'))


context_node = self.find_child_node(inputs_node, "Context")
Expand Down Expand Up @@ -550,7 +559,8 @@ def accept(self) -> None:

pour_point_layers.append(GeopackageLayer(lyr_name=view_name,
name=pour_point.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='pour_points'))

if 'catchments' not in keep_layers:
keep_layers['catchments'] = {'id_field': 'pour_point_id', 'id_values': []}
Expand All @@ -566,7 +576,8 @@ def accept(self) -> None:

pour_point_layers.append(GeopackageLayer(lyr_name=catchment_view,
name=pour_point.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='catchments'))

pour_point_gpkgs.append(Geopackage(xml_id=f'pour_points_{pour_point.id}_gpkg',
name=pour_point.name,
Expand Down Expand Up @@ -622,7 +633,8 @@ def accept(self) -> None:
context_layers.append(GeopackageLayer(summary=f'context_{geom_type.lower()}',
lyr_name=context_vector.fc_name,
name=context_vector.name,
ds_type=GeoPackageDatasetTypes.VECTOR))
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='context'))

inputs_gpkg = Geopackage(xml_id=f'inputs_gpkg',
name=f'Inputs',
Expand Down Expand Up @@ -768,10 +780,11 @@ def accept(self) -> None:

gp_lyr = GeopackageLayer(lyr_name=view_name,
name=layer.name,
ds_type=GeoPackageDatasetTypes.VECTOR)
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type=layer.layer.fc_name)
geopackage_layers.append(gp_lyr)

events_gpkg = Geopackage(xml_id=f'{event.id}_gpkg',
events_gpkg = Geopackage(xml_id=f'dce_{event.id}_gpkg',
name=f'{event.name}',
path=out_name,
layers=geopackage_layers)
Expand Down Expand Up @@ -836,7 +849,8 @@ def accept(self) -> None:

gp_lyr = GeopackageLayer(lyr_name=analysis_view,
name=analysis.name,
ds_type=GeoPackageDatasetTypes.VECTOR)
ds_type=GeoPackageDatasetTypes.VECTOR,
lyr_type='analysis')
geopackage_layers.append(gp_lyr)

analysis_gpkg = Geopackage(xml_id=f'{analysis.id}_gpkg',
Expand Down

0 comments on commit adb3f11

Please sign in to comment.