This repository contains a basic python script to convert a .csv file generated by a GEOSTIX to .kml format for fast viewing on a map and quick quality checking (qc).
Some tools need to be present on your system to run csv2kml-qc properly :
Under Linux (Ubuntu) distribution the installation procedure is as follows:
-
Open a terminal
-
Installing dependencies:
sudo apt-get install git python3.10
-
Clone csv2kml-qc repository:
git clone [email protected]:Geobsys/csv2kml-qc.git
-
Create a virtual environment:
python3.10 -m venv venv_csv2kml-qc
-
Activate the virtual environment:
source venv_csv2kml-qc/bin/activate
-
Install modules:
For Linux user, put these command in the terminal :
chmod +x setup_linux.sh sudo ./setup_linux.sh
For macOS user, put these command in the terminal :
chmod +x setup_macOS.sh sudo ./setup_macOS.sh
For Windows user, just double clic on the .bat.
pip install simplekml pyproj shapely numpy pandas fiona gpsdatetime gnsstoolbox
To test csv2kml-qc:
-
Access the main folder:
cd csv2kml-qc
-
Launch the tool with the default setting on the dataset example:
python3.10 src/csv_to_kml.py test/EXTENVENT.LOG
EXTENVENT.LOG is one of the enter files.
-
Data format (CSV)
- extevent: Choose "extevent" paramter for this format.
Time (s) | Day | State | Latitude | Longitude | Height | Planimetric uncertainty | Height uncertainty | Orientation X | Orientaion Y | Orianttion Z |
---|---|---|---|---|---|---|---|---|---|---|
time | day | state | lat | lon | h | incert_pla | incert_hig | oX | oY | oZ |
222708 | 445,2285 | R | 45.519933813 | 6.680457525 | 1738.724 | 0.04 | 0.05 | 0.3585647 | -0.0514448 | 0.1724559 |
- log: Choose "log" parameter for this format.
Undifined 1 | GNSS | Undifined 2 | Time (s) | Date (jj/mm/annee) | Hour (h:mn:s) | State | Latitude | Longitude | Height | Planimetric uncertainty | Height uncertainty |
---|---|---|---|---|---|---|---|---|---|---|---|
uk1 | GNSS | uk2 | time | date | hour | state | lat | lon | h | incert_pla | incert_hig |
1 | GNSS | 2 | 481467.100 | "23/02/2024" | "13:44:27.100" | "N" | 48.845234261 | 2.423569332 | 132.608 | 22.01 | 47.68 |
- Parameters
- import parameters: Define the format of the import file in the enter of the programm.
Command | Name | Type | Description | Default value | Choices value |
---|---|---|---|---|---|
-it | input file | string | input file type between 'extevent' and 'log' | "extevent" | ["extevent", "log"] |
-sep | separator | string | separator used in the .csv file | "," |
- export parameters: Define the format of the export file in the end of the programm.
Command | Name | Type | Description | Default value |
---|---|---|---|---|
-o | output file | string | output file in .kml format | "" |
-name | doc_name | string | kml document name | "" |
--quiet | print some statistics |
- apearance parameters: User can choose the representation of the point (mode, label and icon size in the kml)
Command | Name | Type | Description | Default value | Choice value |
---|---|---|---|---|---|
-m | mode | string | representation mode | "icon" | ["icon"] |
-ls | label_scale | float | label scale let you modify the size of the label | 2 | |
-is | icon_scale | float | icon scale let you modify the size of the icon | 1 | |
-ih | icon_href | string | marker in the kml | icon | |
--show_pt_name | action="store_true" | Hide the points names |
- general parameters: User can modify the number of data and the altitude in the representation of the object (relitveground or absolute).
Command | Name | Type | Description | Default value | Choice value |
---|---|---|---|---|---|
-dr | data_range | string | Range of data from start (s), to end (e), with a step (t) : (s,e,t). e and t are optionnal. This allow you to decimate the number of the point | '(0,-1,100)' | |
-am | altitude mode | string | See simplekml .Altitudemode (absolute, relativeToGround, clampToGround). This define the mode of the altitude's representation | "absolute" | ["absolute", "relativeToGround", "clampToGround"] |
- Point: User can choose to show to visualize or not the points.
Command | Action | Description |
---|---|---|
--show_point | action="store_false" | "Don't show points" |
- Line: User can choose to show to visualize or not the lines.
Command | Action | Description |
---|---|---|
--show_line | action="store_false" | "Don't show the lines between the points" |
- Confidence interval: User can choose to visualize or not the confidence intervals. There are represent as 3D pyramids. He can also choose a scale factor for planimetric and altimetric uncertainty. If there are too big uncertaintyn he can add a maximum value for them.
Command | Name | Type | Description | Default value |
---|---|---|---|---|
--show_conf_int | action="store_false" | Don't show the confidence interval | ||
-sp | scale_factor_pla | float | Scale factor for planimetric uncertainty. | 1 |
-mp | incert_pla_max | float | Maximum planimetric uncertainty | np.nan |
-sh | scale_factor_hig | float | Scale factor for altimetric uncertainty. | 1 |
-mh | incert_hig_max | float | Maximum altimetric uncertainty | np.nan |
- Buildings: If the user wants, he can create a 3D model for the buildings in the study aera by adding a shapefile of the aera.
Command | Name | Type | Description | Default value | Condition |
---|---|---|---|---|---|
-departments | departments | string | Input folder where shp building file is stocked, or directly the file path. Warning, if there is others file in the folder, the programm will chose the first one by alphabet to define the schema, and then look to the others for the intersection if the both schema match. The user have to choose and download himself the right shapefile on BD-TOPO which correspond to his study area. | "" | |
--show_buildings | action="store_false" | Don't show the show_buildings | Used only if there is a shapefile in enter | ||
-margin | margin | float | margin (in geographical degres) around the workfield for building modelisation | 0.001 | Used only if there is a shapefile in enter |
--save_buildings | action="store_true" | If you want to save the shp file of your buildings, you can provide a folder path and name. If the name is 'intersection', it will not be saved. | Used only if there is a shapefile in enter |
- Ephemerids: If you want to know the number of satellite seen by a point at its acquisition date, you can add a rinex file which correspond at the right date.
Command | Name | Type | Description | Default value |
---|---|---|---|---|
--calc_ephemerids | action="store_false" | Don't calculate the ephemerids | ||
-rn | rinex_name | string | Path of the observation or navigation rinex file | "" |
- Frustum: If you want to creat the frustum of the picture. These allow you to visualize the orientation of the sensors when taking a photo
Command | Name | Type | Description | Default value |
---|---|---|---|---|
--show_orientation | action="store_false" | Don't show frustum | ||
-fr_captor | frustum captor | float | half-size of the near face of the frustum | 1 |
-fr_focal | frustum focal | float | focal distance | 10 |
-fr_distance | frustum distance | float | distance between the near plane et the far plane | 5 |
-fr_alpha | alpha angle (frustum) | float | angle between camera reference frame and geographical reference frame aroud 'x' axe | 0 |
-fr_beta | beta angle (frustum) | float | angle between camera reference frame and geographical reference frame around 'y' | 0 |
-fr_gamma | gamma angle (frustum) | float | angle between camera reference frame and geographical reference frame around 'z' axe | 0 |
- Open the file XXX.kml on Google Earth viewer, you can decide to show the buildings, the traces, the points and the measured intervals through the top left window. By clicking on a point, you can see all its characteristics.