Quantum GIS plugin for Czech cadastral data Anna Kratochvílová and Václav Petráš Students of Geoinformatics Programme Faculty of Civil Engineering Czech Technical University in Prague Abstract This paper presents new Quantum GIS plugin for Czech cadastral data and its development. QGIS is a rapidly developing cross-platform desktop Geographic Information System (GIS) released under the GNU GPL. QGIS is written in C++, and uses the Qt library. The plugin is developed in C++, too. The new plugin can work with Czech cadastral data in the new Czech cadastral exchange data format called VFK (or NVF). Data are accessed through VFK driver of the OGR library. The plugin should facilitate the work with cadastral data by easy search and presenting well arranged information. Information is displayed in the way similar to web applications, thus the control is friendly and familiar for users. The plugin supports interaction with map using QGIS functionality and it is able to export various cadastral reports. This paper provides ideas which can be generalized to develop QGIS plugin dealing with specific data. Keywords: VFK, NVF, cadastre, ČÚZK, GIS, QGIS, OGR, C++, plugin 1. Introduction 1.1. Czech cadastre Modern Czech cadastre has a long history with roots in Austria-Hungary in the 19th century. Since 2001 the Czech Cadastral Office for Surveying, Mapping and Cadastre (ČÚZK) has provided cadastral data in electronic form via the Information System of the Cadastre of Real Estate (ISKN) [1]. Many organizations and companies, both state and commercial, use this opportunity at an increasing rate. Several data formats exist, some of them comply with INSPIRE specifications [2]. The most used format is the Czech cadastral exchange data format called VFK (or NVF) which contains all data related to real estate. Unlike the other formats VFK contains infor- mation about ownership. Cadastral data in VFK are widely used by municipalities and state institutions for execution of their duties. For using VFK data proper software is needed. Beside some proprietary programs, there have been attempts to provide free software solution: module v.in.vfk for GRASS GIS, Otevřený katastr (Open Cadastre) [3] for import to PostGIS and VFK driver [4] in OGR library. The last-named has the advantage that GDAL/OGR library is used by many programs, both proprietary and free open source. However, typical end-user is not able to access the functionality without some wrapper application providing graphical user interface (GUI). Geoinformatics FCE CTU 8, 2012 91 Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data For working with cadastral data which are basically spatial data an ideal environment is a Geographical Information System (GIS). 1.2. QGIS For the development of the application we decided to use Quantum GIS (QGIS) [5]. QGIS has many advantages both for the user (e.g. customizable and easy to use GUI) and the developer (e.g. good API, simple plugin system). QGIS is a free open source GIS licensed under GNU GPL1. QGIS is written in C++ pro- gramming language and uses Qt framework2. There are several possibilities how to add new functionality to QGIS. Firstly, a new plugin for QGIS desktop application can be written in C++ or Python. Secondly, it is possible to build your own application based on QGIS library. Finally, you can directly modify existing QGIS application. The presented plugin was developed for QGIS Desktop, however also other components of QGIS exists (e.g. QGIS Server, QGIS Browser). In order to develop a plugin for QGIS it is necessary to use QGIS API (Application Programming Interface). The API is well documented and a guide for plugin development is available, too. Thanks to GPL license everyone who obtains QGIS application can obtain also its source codes. As a result one can prove how performed analyses are implemented which is crucial for academic work [6]. For public administration, low cost of free open source software can be a decision criterion. Efforts to introduce free open source solutions to public administration can be found on European level.3 2. VFK data format and OGR-VFK driver 2.1. VFK data format The Czech cadastral exchange data format called VFK (or NVF) replaced previous format VKM in 19964. Files in this format are provided by the Czech Office for Surveying, Mapping and Cadastre. VFK contains information about real properties (parcels, buildings, building units), including their description, geometry and related property rights. In contrast to other current Czech cadastral formats (e.g. INSPIRE Cadastral Parcels), VFK contains information about owners. VFK files are provided to public for fee, however municipalities and state institutions obtain it free of charge [7]. From the technical point of view VFK is a text format which resembles CSV format (see below). &HPAR;ID N30;STAV_DAT N2;DATUM_VZNIKU D;... &DPAR;1319150210;0;"23.06.2003 14:54:44";... &DPAR;1319151210;0;"24.04.2002 09:26:01";... 1GNU General Public License, http://www.gnu.org/licenses/licenses.html 2http://qt.nokia.com 3https://joinup.ec.europa.eu/ 4http://www.cuzk.cz/Dokument.aspx?PRARESKOD=998&MENUID=0&AKCE=DOC:10-SDELENI_K_SVF Geoinformatics FCE CTU 8, 2012 92 http://www.gnu.org/licenses/licenses.html http://qt.nokia.com https://joinup.ec.europa.eu/ http://www.cuzk.cz/Dokument.aspx?PRARESKOD=998&MENUID=0&AKCE=DOC:10-SDELENI_K_SVF Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data Building Parcel Ownership report Other real estate rights Ownership Holder of real estate rightsBuilding unit Figure 1: Simplified relations between entities in database (for full schema please refer to [9]) Official format description and underlying database schema is provided, however this docu- mentation [8] is not sufficient for building queries. The description provided in [9] was used as a reference for the plugin development. For schema overview refer to figure 1. 2.2. OGR-VFK driver OGR5 is an free open source C++ library which enables read (and in certain cases also write) access to various geospatial vector formats including ESRI Shapefile, PostGIS or Oracle Spatial. OGR is the part of GDAL library, therefore it is also referred as GDAL/OGR. This library is used in many free open source software projects like GRASS GIS, QGIS or MapServer and in proprietary software (e.g. ESRI ArcGIS) which is possible thanks to MIT style free software license. The support of the Czech cadastral exchange format (VFK) was missing till 2010 when M. Landa [4] implemented the VFK driver which has then become the part of the library. Thanks to the driver every software using OGR library can access Czech cadastral data in VFK format. During the QGIS VFK plugin development the VFK driver was improved by its author in order to reflect needs of the plugin. The most significant enhancement is the export to SQLite3 file database. This file is then used by the plugin but it can be accessed by any SQLite browsing and editing tools. 3. Implementation 3.1. QGIS plugin for Czech cadastral data QGIS plugin for Czech cadastral data is primary intended for using by local municipalities. The implementation of VFK driver in OGR library enabled to view Czech cadastral data in 5http://www.gdal.org/ogr/ Geoinformatics FCE CTU 8, 2012 93 http://www.gdal.org/ogr/ Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data QGIS, however it was still inconvenient to browse the non-spatial but significant part of the data which is represented by a large and complex set of attribute tables. The aim of the plugin is to facilitate the work with this kind of data which can be then viewed and analysed in relation to the spatial part. The development of the plugin was split into two parts. During the first part we developed an application not connected to QGIS. This involved the development of the crucial functionality — database search in SQLite database created by VFK-OGR driver, and generating and exporting various reports. During the second part the application was connected to QGIS as a plugin so that the map interaction could be implemented. Data are handled by the plugin in the following way. QGIS reads spatial data from VFK file through VFK-OGR driver. The driver creates SQLite file, from which plugin reads attributes of spatial features and other related non-spatial data. Plugin connects these two sets of data through unique identifiers defined in VFK documentation [8]. In order to use the plugin functionality user is supposed to open the VFK file from within the plugin instead of using the QGIS standard dialog for adding vector layers. This enables to optimize loading process comparing to standard QGIS OGR layer loading process by avoiding calling certain unnecessary procedures. Another improvement affecting the performance is the fact that the driver uses the SQLite database file from previous run if available. During the plugin development crucial attribute columns were identified and VFK-OGR driver now creates database indices for this columns. Indices improve the speed of attribute querying in the plugin. These changes were imple- mented by the author of the VFK-OGR driver. The plugin was developed with development version of QGIS and development version of OGR. 3.2. Plugin functionality Plugin is in the stage of first prototype and its functionality is so far limited. However, it contains basic functionality to solve all common tasks. This functionality includes search ac- cording to various parameters depending on searched feature or object. Currently it is possible to search information about parcels, buildings and owners. Several reports are available: • report about parcels • report about buildings • report about building units (flats or non-residential space) • report about owners • ownership reports (according to Czech cadastre style) These reports are interconnected (figure 2) so that the user can easily get from one report to another. Plugin contains a browser similar to the standard web browser. This browser enables inter- active browsing of attribute data in the following way: Geoinformatics FCE CTU 8, 2012 94 Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data neighbouring parcels Building Holder of real estate rights Ownership report Parcel Building unit Figure 2: Interconnections between the reports • Data are represented as an styled HTML page. • Hyperlinks are used for navigation through various reports. • Navigation includes buttons Back and Forward. • Browsing history of visited pages does not require to redo database queries. Plugin provides the possibility to show current state of parcels and buildings in web application Viewing Cadastre (Nahlížení do katastru nemovitostí, ČÚZK application) which provides limited access to cadastral data with map interface. This application is launched in system web browser showing currently selected feature. Unlike Viewing Cadastre, VFK plugin provides possibility to search by owner (e.g. find all real estates of one owner). Reports generated by the plugin can be exported into two formats — HTML with CSS stylesheet and LATEX(enables creating PDF). HTML can be easily imported to OpenOffice.org or LibreOffice so that the document structure is preserved. In order to use information from database search or search information about features selected in map the following functionality for synchronizing was developed: • Parcels and buildings which are currently shown in plugin browser can be selected (highlighted) in the map. • Information about selected feature(s) in the map can be shown in plugin browser. For convenience, cadastral map layers are displayed with predefined style. Most importantly it includes displaying parcel numbers with special cadastral formatting (style originally coming from Austria-Hungary). Brief help page is embedded in the plugin. It contains hyperlinks to find wanted functionality easily. It is worth noting that when using the plugin user can profit from all the functionality provided by QGIS too (e.g. loading WMS layers). Geoinformatics FCE CTU 8, 2012 95 Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data Figure 3: Plugin showing information about parcels’ owner Figure 4: Docked plugin window with hidden control panel Geoinformatics FCE CTU 8, 2012 96 Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data 3.3. Plugin GUI The graphical user interface (GUI) of the plugin is divided into two main parts — the browser showing data reports and the control panel with toolbar for data import and search. The GUI was designed so that new functionality could be added easily without making the GUI cumbersome. Thanks to powerful Qt framework, the plugin window can be floating or docked anywhere in QGIS application window (see figures 3 and 4). This is particularly advantageous to users using large screens. This way user can see both the map and related data. 4. Further development Further development will be based on results of testing. Nevertheless, there are some im- provements which are already planned: • the direct support of other output formats (PDF, ODF) • export of geometry • using threads for time consuming data loading and querying (make the user interface responsive) • database file handling • add more layer styles 5. Conclusion The Czech Cadastral Office for Surveying, Mapping and Cadastre manages large database containing both spatial and non-spatial data. These data have been used increasingly since launching Internet based Remote Access in 2001 [1]. The majority of clients is coming from public administration which gets this data free of charge [7]. Presented plugin aims to local municipalities which need tools for accessing these data. They can gain advantage from solution which uses free open source software. Apart from money saving, they avoid dependency on one certain software supplier and they can get software which respects their needs [10]. The plugin makes use of two free open source projects QGIS and GDAL/OGR to provide functionality needed for handling Czech cadastral data. It uses GIS environment to interactively browse spatial and attribute data and bind them together to get clear overview. 6. Acknowledgement We are grateful to the author of VFK-OGR driver, Ing. Martin Landa, for additional en- hancements of the driver needed for the plugin. We also thank to Mr. Jiri Sobotik from municipality Novy Jicin who encourages us to start the plugin development and contributes with his ideas about plugin functionality and testing. Geoinformatics FCE CTU 8, 2012 97 Kratochvílová A., Petráš V.: Quantum GIS plugin for Czech cadastral data 7. References 1. ČESKÝ ÚŘAD ZEMĚMĚŘICKÝ A KATASTRÁLNÍ. Annual Report 2011. ČÚZK, 2012. ISBN 978-80-86918-66-2. URL: http://www.cuzk.cz/GenerujSoubor.ashx? NAZEV=10-EVZ2011 2. SOUČEK, Petr and Jiří FORMÁNEK. Data spravovaná resortem ČÚZK jsou stále přístupnější. In: GIS Ostrava 2012 - Současné výzvy geoinformatiky. URL: http: //gis.vsb.cz/GIS_Ostrava/GIS_Ova_2012/sbornik/papers/soucek.pdf 3. JEDLIČKA, Karel, Jan JEŽEK and Jiří PETRÁK. Otevřený katastr – svobodné inter- netové řešení pro prohlížení dat výměnného formátu katastru nemovitostí. In Geoinfor- matics FCE CTU. Praha: ČVUT, 2007. p. 111-117. URL: http://geoinformatics. fsv.cvut.cz/gwiki/Geoinformatics_FCE_CTU_2007 4. LANDA, Martin. OGR VFK Driver Implementation Issues. In: Proceedings – Sympo- sium GIS Ostrava 2010. p. 8. ISBN 978-80-248-2171-9, ISSN 1213-239X. URL: http: //gis.vsb.cz/GIS_Ostrava/GIS_Ova_2010/sbornik/Lists/Papers/EN_1_10.pdf 5. Quantum GIS Development Team, 2012. Quantum GIS Geographic Information Sys- tem. Open Source Geospatial Foundation Project. URL: http://qgis.osgeo.org 6. ROCCHINI, Duccio and Markus NETELER. Let the four freedoms paradigm apply to ecology. Trends in Ecology. 2012, 27, vol. 6, p. 310-311. ISSN 01695347. DOI: 10.1016/j.tree.2012.03.009. URL: http://www.sciencedirect.com/science/article/ pii/S0169534712000742 7. Česká republika. Zákon České národní rady ze dne 7. května 1992 o katastru nemovi- tostí České republiky (katastrální zákon). In: Sbírka zákonů České republiky. 1992. URL: http://portal.gov.cz/zakon/344/1992 8. ČESKÝ ÚŘAD ZEMĚMĚŘICKÝ A KATASTRÁLNÍ. Struktura výměnného formátu informačního systému katastru nemovitostí České republiky [online]. 23. 2. 2012 [cit. 2012-04-07]. URL: http://www.cuzk.cz/GenerujSoubor.ashx?NAZEV=10-D12U. 9. LANDA, Martin. Návrh modulu GRASSu pro import dat ve výměnném formátu ISKN. Master thesis. 2005. ČVUT Praha. URL: http://gama.fsv.cvut.cz/~landa/publications/ 2005/diploma_thesis/martin.landa-thesis.pdf. 10. FOGEL, Karl. Tvorba open source softwaru: Jak řídit úspěšný projekt svobodného soft- waru. 2010. CZ.NIC, 2012. ISBN: 978-80-904248-5-2. URL: http://knihy.nic.cz/ files/nic/edice/karl_fogel_poss.pdf. Geoinformatics FCE CTU 8, 2012 98 http://www.cuzk.cz/GenerujSoubor.ashx?NAZEV=10-EVZ2011 http://www.cuzk.cz/GenerujSoubor.ashx?NAZEV=10-EVZ2011 http://gis.vsb.cz/GIS_Ostrava/GIS_Ova_2012/sbornik/papers/soucek.pdf http://gis.vsb.cz/GIS_Ostrava/GIS_Ova_2012/sbornik/papers/soucek.pdf http://geoinformatics.fsv.cvut.cz/gwiki/Geoinformatics_FCE_CTU_2007 http://geoinformatics.fsv.cvut.cz/gwiki/Geoinformatics_FCE_CTU_2007 http://gis.vsb.cz/GIS_Ostrava/GIS_Ova_2010/sbornik/Lists/Papers/EN_1_10.pdf http://gis.vsb.cz/GIS_Ostrava/GIS_Ova_2010/sbornik/Lists/Papers/EN_1_10.pdf http://qgis.osgeo.org http://www.sciencedirect.com/science/article/pii/S0169534712000742 http://www.sciencedirect.com/science/article/pii/S0169534712000742 http://portal.gov.cz/zakon/344/1992 http://www.cuzk.cz/GenerujSoubor.ashx?NAZEV=10-D12U http://gama.fsv.cvut.cz/~landa/publications/2005/diploma_thesis/martin.landa-thesis.pdf http://gama.fsv.cvut.cz/~landa/publications/2005/diploma_thesis/martin.landa-thesis.pdf http://knihy.nic.cz/files/nic/edice/karl_fogel_poss.pdf http://knihy.nic.cz/files/nic/edice/karl_fogel_poss.pdf