Skip to content

Commit

Permalink
Merge pull request #4 from TDT4290-group-4/3-group-surveys-to-fix-flo…
Browse files Browse the repository at this point in the history
…ating-point-issue

3 group surveys to fix floating point issue
  • Loading branch information
adriahso authored Oct 27, 2025
2 parents bedebd3 + 4393a81 commit 673827f
Show file tree
Hide file tree
Showing 4 changed files with 326 additions and 97 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#survey content
/surveys/*
/output_las/*
surveys
converted_surveys
temp_cells
metadata
h3_cells
.DS_Store
.venv
74 changes: 64 additions & 10 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,25 +1,79 @@
# Las Converter

`lasConverter.py` converts survey CSV files into LAS files using EPSG:4978 and groups/crops them by H3 cells.
The main steps are:

1. Prepare H3 Cells and Assign Surveys
2. Convert CSV Surveys to LAS using EPSG:4978
3. Group and Crop by H3 Cells

# How to run

## Activate python environment
## 1. Prepare Files and Folders

Before running the script, make sure your project folder has the following structure:

```text
lasConverter.py
surveys/
├── survey_name_1/
│ ├── file1.csv
│ └── file2.csv
├── survey_name_2/
│ └── ...
└── ...
metadata/
├── metadata.csv
└── level1_h3_cells.csv
```

### `surveys/`
- Contains **one folder per survey**, using the **survey name** as the folder name.
- Each survey folder contains the CSV files for that survey (arbitrarily named).

### `metadata/metadata.csv`
- Must include the columns: `fid`, `survey_name`, `survey_area`, `geom`, `epsg`.
- Script assumes bounding polygons in `geom` use EPSG:4258.
- Each row corresponds to a survey.

### `metadata/level1_h3_cells.csv`
- Must contain a single column `cell_id`, listing all relevant **level 1 H3 cells**.


## 2. Activate python environment

Create a python environment with
Create a python virtual environment with
```zsh
python -m venv <environment_name>
```

and run it with:
Activate it:

Windows: `<environment_name>\Scripts\activate`
* **Windows:**
```zsh
<environment_name>\Scripts\activate
```

* **macOS/Linux:**
```zsh
source <environment_name>/bin/activate
```

macOS/Linux:
`source <environment_name>/bin/activate`
## 3. Install requirements

## Run script
First ensure that all requirements are installed: `pip install -r requirements.txt`
Install the required Python packages:

```zsh
pip install -r requirements.txt
```

Then run the command below to create the potree structure.

## 4. Run the script

Run the converter:

```zsh
python lasConverter.py <input_directory> <output_directory>
python lasConverter.py
```

The processed LAS files, cropped to level 2 H3 cells, will be saved in the `./h3_cells` folder.
Loading

0 comments on commit 673827f

Please sign in to comment.