Skip to content

swiss-territorial-data-lab/csv-wkt-to-uv3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This octave script is used to help shapefiles conversion into the UV3 format. The script applies on the CSV/WKT export from shapefiles to extract the geometry and to export them into a chosen UV3 file.

The script also comes with a standard color palette that can be used to assign colors to the desired extracted layers.

csv-wkt-to-uv3

This script is used on CSV/WKT exports from sphapefiles. Using an example shapefile and the QGIS software, the following procedure can be considered :

  • Open the shapefile and right-click on the desired layer

  • Choose "Export" and then "Export entities as ..."

  • Select CSV format

  • Specify the path of the CSV file

  • Keep EPSG:4326 - WGS84 coordinates system

  • Choose AS WKT as GEOMETRY and SEMICOLON as SEPARATOR

  • Click the OK button to export the geometries

As the CSV/WKT file is correctly exported, run octave (GNU/Linux bash, no GUI) :

$ octave --no-gui

Then run the script providing the information on CSV/WKT file path, the separator character (semicolon), the color index (from 1 to 20) and the path of the UV3 file to create :

octave:*> csv_wkt_to_uv3('path/to/source.csv',';',4,'path/to/convert.uv3');

The following images gives the available colors in the built-in colormap :



Built-in colormap with index from 1 to 20 - The colormap was stolen from python matplotlib (tab20b and tab20c)


The script is also able to associate an height value to the WKT geometries in two different ways : if the WKT geometries come with an elevation (Z), it is used as UV3 third coordinate. If the CSV comes with an MSL column, the script interprets its values as height and use them as UV3 third coordinate, replacing the WKT one if provided.

A color can be specified for each WKT geometry through R, G and B column. Each column as to provided the corresponding color component in [0,255] range. If a color component is not provided, the specified colormap index is used to assign the color component.

A detailed documentation of specific file formats used by the tools of this suite can be found of the format page.

Copyright and License

csv-wkt-to-uv3 - Nils Hamel, Huriel Reichel
Copyright (c) 2020 Republic and Canton of Geneva

This program is licensed under the terms of the GNU GPLv3. Documentation and illustrations are licensed under the terms of the CC BY-NC-SA.

Dependencies

The csv-wkt-to-uv3 comes with the following package (Ubuntu 20.04 LTS) dependencies (Instructions) :

  • octave

About

Tool for shapefile geometries conversion to UV3 format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages