Shp to Obs

Dominik Fröhlich, Tamás Gál, and Andreas Matzarakis

2015-03-26

Transformation of Shapefiles to Object files for the use with RayMan / SkyHelios model by a plugin for Quantum GIS

Introduction

Shp to Obs provides the capability of creating input files for the micro scale radiative-bioclimate model RayMan Pro. The Quantum GIS plugin requires two ESRI®-shapefiles (or three, if vegetation included) as input.

Caveats

The plugin is still under development. Please report any issues and bugs to dominik.froehlich@venus.uni-freiburg.de, or andreas.matzarakis@mif.uni-freiburg.de.

Shp to Obs is free software and is offered without guarantee or warranty. You can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License (GPL v2) as published by the Free Software Foundation (www.gnu.org). Bug reports or suggestions are welcome at the e-mail address above, but we cannot promise a prompt or mutually satisfactory solution.

Installation

Automatic Installation (recommended): Please open the plugins manager. In "Settings" check "show experimental plugins". Now search for "shptoobs" and check the plugin with the RayMan icon. The Plugin now can be found in the "Vector" menue.

Manual Installation: First of all, you need QGIS and any other Python plugin installed (to make sure the plugins-folder exists). QGIS can be downloaded from the official web page. After the setup process is finished, launch QGIS and select "Download Python Plugin" from the "Plugins" menu. Choose a random plugin and install it. Afterwards close QGIS.
Now unzip shp_to_obs.zip and move the content to a new folder "shp_to_obs" in the location stated below. In Windows please copy "shp_to_obs" to

	C:\Documents and Settings\(user)\.qgis\python\plugins\

On Mac and Linux navigate to your home folder and enable hidden files to be displayed (ctrl + h on Linux, Mac users are refered to www.mactricksandtips.com/2008/04/show-hidden-files). Afterwards you should see a ".qgis2" folder. Please copy the extracted content of "shp_to_obs.zip" folder to

	.qgis2/python/plugins/shp_to_obs/

Enable Shp to Obs by restarting qgis and using the manage plugins utility (Plugins -> Manage Plugins). The utility pops up a list box of all available plugins and you should select the checkbox beside Shp to Obs. After clicking OK, an Shp to Obs option should be available on the Vector dropdownn menu.

Usage

Run the plugin by choosing "Shp to Obs" from the "Vector" menu.
First, a welcome box appears reminding you of the required input files. Continue by clicking "next".

Required input files

The Shp to Obs plugin needs at least two input files (since version 0.1.6 it can be run with a buildings file alone using the layer center as a center point) to create a RayMan obstacle file. All of the required files have to be shape files.

Buildings file (required): First, a polygon shape file is required, that contains the buildings for the .obs. It needs a field in the attribute table stating the height of each building. This field must not contain any missing values.

Center points file (optional for version >= 0.1.6): Second, a point shape file is required, setting the center point(s) of the .obs file to create. If this layer consists of several points, Shp to Obs will create an obstacle file for each of the points. The center points input layer requires a field in the attribute table, that specifies the vertical offset of each point. A negative value in this field will increase the height of all obstacles, while a positive value will reduce the height respectively. Zero means no offset. This field must not contain missing values.

Trees file (optional): Optionally, Shp to Obs is able to include trees into the obstacle file. Therefore a third input layer is necessary. The trees layer has to be a point shape layer and must possess at least the following five fields, that, again, must not have missing values.

• A height field specifying the total height of the tree (in m).
• A crown radius field, that gives the radius of the crown expansion (in m).
• A trunk height field that sets the distance between the ground and the lower side of the crown (in m).
• A trunk radius field setting the radius of the trunk (in m).
• A type field specifying the type of the tree (1 char in small letters, "l" for a leaf tree, or "n" for a coniferous tree).

Converting shape to obstacle files

Please run the plugin by choosing "Shp to Obs" from the "Vector" menu.
First, a welcome box appears reminding you of the required input files. Continue by clicking "next".
Now a second window opens. It has got four tabs.

In the "Buildings" tab, the buildings layer is selected. After selecting a layer from the upper dropdown menu, the field containing the height of the buildings can be selected from the lower dropdown menu.

The "Trees (optional)"-tab contains the settings for an optional trees layer. If you want to have trees in your obstacle file, select the corresponding trees layer from the upper dropdown menu. Afterwards you should be able to set the fields for the tree's attributes in the lower section.

The third tab is the "Center Point(s)"-tab. The center points layer can be selected from the upper dropdown menu. Afterwards the the field setting the vertical offset of the center points can be chosen by the lower dropdown.

In the "Output Directory"-tab the folder and file name of the new obstacle file(s) is set. If you saved a qgis-project previously, name and path of the project file are proposed.

After selecting the required layers and fields, and entering path and file name, click the "Convert" button to start the converter. According to number and complexity of your input geometries the process may take some time.

Please feel free to report about any success or failure.

FAQ and troubleshooting

Why is there a trailing number in the filename of my .obs file? This is perfectly fine. As you might have set a number of center points, the plugin will create a .obs file for each of them. The files are numbered at the end of their filename starting from 0.

Why is my .obs file empty? If you recieve an empty .obs file (an empty text file with only a header stating "# RayMan Pro obstacle file #", please make sure all of your input files are in a metric projection. If you are using a degree projection the obstacles will get lost in rounding (and RayMan requires meters anyway).

Why is my .obs file empty? If you recieve an empty .obs file (an empty text file with only a header stating "# RayMan Pro obstacle file #", please make sure all of your input files are in a metric projection. If you are using a degree projection the obstacles will get lost in rounding (and RayMan requires meters anyway).

Why does my .obs file contain awfully large numbers? In case you recieve an .obs file with huge numbers (huge distances to the center point) please make sure all of your input files are using the same projection.