diff --git a/backend/app/worker/processes.py b/backend/app/worker/processes.py index 4155cdc..a5ab453 100644 --- a/backend/app/worker/processes.py +++ b/backend/app/worker/processes.py @@ -12,14 +12,17 @@ i3dm_db = f"Host={settings.POSTGRES_SERVER};Username={settings.POSTGRES_USER};password={settings.POSTGRES_PASSWORD};Port={settings.POSTGRES_PORT};Database={settings.POSTGRES_TASKS_DB}" def earcut_js(coordinates): - coordinates_str = json.dumps(coordinates) - result = subprocess.run([ - 'node', - '/app/node/earcut.js', - coordinates_str - ], stdout=subprocess.PIPE) - output = list(map(int, result.stdout.decode("utf-8").split(','))) - return output + try: + coordinates_str = json.dumps(coordinates) + result = subprocess.run([ + 'node', + '/app/node/earcut.js', + coordinates_str + ], stdout=subprocess.PIPE) + output = list(map(int, result.stdout.decode("utf-8").split(','))) + return output + except Exception: + return [] def identify_projection(projection): try: @@ -134,8 +137,8 @@ def pg2b3dm(table_task_name, output_3dtiles_path, attributes, min_geometric_erro '--use_implicit_tiling', "false", '--max_features_per_tile', f"{int(max_features_per_tile)}" ], - capture_output = True, - text = True + # capture_output = True, + # text = True ) try: diff --git a/backend/app/worker/tasks.py b/backend/app/worker/tasks.py index 795739c..327bdc3 100644 --- a/backend/app/worker/tasks.py +++ b/backend/app/worker/tasks.py @@ -163,7 +163,6 @@ def setup_output_directory(pipeline_id): def create_point_instance_3dtiles(pipeline_extended): asset = pipeline_extended['asset'] - asset_upload_path = get_asset_upload_path(asset['id'], asset['extension']) asset_id = asset['id'] pipeline_id = pipeline_extended['id'] table_name = get_asset_table_name(asset_id) @@ -188,8 +187,6 @@ def create_point_instance_3dtiles(pipeline_extended): **pipeline_config } - import_vector_to_postgres(asset_upload_path, table_name, geometry_column_name, fid_column_name) - table = Table(table_name, MetaData(), autoload_with=engine_tasks) table_task_name = get_pipeline_table_name(pipeline_id) @@ -303,7 +300,6 @@ def create_point_instance_3dtiles(pipeline_extended): def create_mesh_3dtiles(pipeline_extended): asset = pipeline_extended['asset'] - asset_upload_path = get_asset_upload_path(asset['id'], asset['extension']) asset_id = asset['id'] pipeline_id = pipeline_extended['id'] table_name = get_asset_table_name(asset_id) @@ -330,8 +326,6 @@ def create_mesh_3dtiles(pipeline_extended): **pipeline_config } - import_vector_to_postgres(asset_upload_path, table_name, geometry_column_name, fid_column_name) - table = Table(table_name, MetaData(), autoload_with=engine_tasks) table_task_name = get_pipeline_table_name(pipeline_id) @@ -393,9 +387,11 @@ def create_mesh_3dtiles(pipeline_extended): } polyhedron_wkt = polyhedral_to_wkt(geometry_to_polyhedral_surface(geometry, geometry_options)) - - feature_properties[geometry_column_name] = polyhedron_wkt - session.exec(insert(table_tasks).values(feature_properties)) + if polyhedron_wkt != 'POLYHEDRALSURFACE Z()': + feature_properties[geometry_column_name] = polyhedron_wkt + session.exec(insert(table_tasks).values(feature_properties)) + else: + print(f'Error creating polyhedron:', feature) session.commit() diff --git a/backend/scripts/celery-reload.sh b/backend/scripts/celery-reload.sh old mode 100644 new mode 100755 diff --git a/backend/scripts/celery.sh b/backend/scripts/celery.sh old mode 100644 new mode 100755