page setup en - longaspire/vita GitHub Wiki

1. Requirements

This tool is developed in the Windows environment, the following instructions are based on this premise. Linux and Mac OSX environment configuration is similar.

The generator uses PostgreSQL and PostGIS database to store DBI data. The space information of the building is automatically saved to the database after an import, so installing PostgreSQL and PostGIS is necessary. In addition, if you want to use the graphical interface to write the GUI of the generator. It is recommended to install SWT and Window Builder, it will be more convenient.

Download resources

2. Environment Configuration

2.1 PostgreSQL and PostGIS

2.1.1 Tips for Installation

There is nothing special about PostgreSQL installation, just remember the right port number of PostgreSQL and use the right login account and password of the database during installation (the generator uses postgres and 123456, respectively).

Also, when you are done, go to Stack Builder and select spatial extention to install PostGIS. Of course, you can also download the postgis.exe file separately from the PostgreSQL website and double-click to install it. ** Postgis2.1 is recommended here because this version is selected in the generator code **.

When the postgis is installed, you will be prompted to choose whether to create a spatial database. If you choose Yes, you will try to create a database template, but it is very likely that the creation will fail, so we need to manually create the spatial database template.

2.1.2 Creating a spatial database from template

Refer to tutorial, and a blog.

Note that you should type the following commands instead, in order to create the template for VITA:

$psql template1
template1=#create database template_postgis with template=template1;
template1=#update pg_database set datistemplate=TRUE where datname='template_postgis';
template1=#\c template_postgis
template_postgis=#create language plpgsql;
template_postgis=#\i /opt/locale/share/postgis/lwpostgis.sql;
template_postgis=#\i /opt/locale/share/postgis/spatial_ref_sys.sql;
template_postgis=#GRANT ALL ON geometry_columns TO PUBLIC;
template_postgis=#GRANT ALL ON spatial_ref_sys TO PUBLIC;
template_postgis=#VACUUM FREEZE;
template_postgis=#\q

P.S. When you select \i to run the sql script, the lwpostgis.sql\spatial_ref_sys.sql file is in the installation directory of postgis, i.e., xxx/share/contribute. In the windows environment, the postgis.sql file corresponds to the lwpostgis.sql file of linux. (The windows version of postgis.sql\spatial_ref_sys.sql can be found in the /sql folder of the VITA source code)

Then you need to create the template database postgis_21_sample for program initialization:

createdb postgis_21_sample -T template_postgis

psql is in the postgres installation directory, so enter the directory through the command line, run psql, then type

psql -U postgres template1

If a .dll file missing error occurs while running the script, it is recommended to reinstall postgis.