scieee AI-readable full text Open interactive document viewer

3D Point Clouds in Urban Planning: Developing and Releasing High-end Methodologies based on LiDAR and UAV Data for the Extraction of Building Parameters

Rebelo, Carla Cristina Roque

Abstract

Os dados geográficos têm um papel determinante na formalização do plano urbano, enquanto instrumento de planeamento e documento normativo que define juridicamente as obrigações públicas e vincula os particulares, num determinado período temporal, no que respeita a disciplina urbanística de uma cidade ou de um aglomerado urbano, estabelecendo regras de uso e de ocupação do solo. O plano está associado a um processo, designado processo de planeamento; processo esse que e constituído por um conjunto de fases, dinâmicas e adaptativas, que se iniciam na sua elaboração e terminam na avaliação dos desvios entre o determinado no documento inicial e as metas e objectivos efectivamente atingidos. O plano, o processo e a praxis do planeamento exigem dados geográficos actualizados a cada instante, quer para as acções de monitorização quer para os momentos de avaliação. Um dos aspectos cruciais do plano e a quantificação da volumetria do espaço edificado existente. Outro aspecto, também fundamental, é o da gestão dessa volumetria; quer da volumetria existente quer da volumetria adicional. O tema da volumetria dos espaços edificados tem constituído, aliás, um dos temas mais sensíveis quando se trata da densificação do espaço urbano existente ou do desenho de novos espaços urbanos de expansão. Considerando o quadro teórico apresentado, o tema central da tese trata da modelação de nuvens de pontos 3D obtidas por tecnologia LiDAR e por UAV, para as aplicações na elaboração do plano e no processo de planeamento urbano, designadamente quantificação dos parâmetros urbanísticos altura da fachada e volume dos edifícios.A exploração do tema central da tese suporta-se em dois níveis: o nível da operacionalização e o nível da usabilidade. O nível da operacionalizão concretiza dois objectivos: i) demonstração da relevância e da pertinência da extracção, medição e geovisualização 3D dos parâmetros urbanísticos baseadas na experimentação e implementação de técnicas de geoprocessamento; ii) demonstração da pertinência dos parâmetros urbanísticos extraídos considerando distintas morfologias urbanas. Para o nível da usabilidade de nem-se igualmente dois objectivos: i) demonstração da usabilidade dos parâmetros urbanísticos extraídos avaliando o erro associado a extracção; ii) demonstração da usabilidade dos parâmetros urbanísticos extraídos para planeamento, em particular para o mapeamento dasimétrico de alta precisão. Da investigação decorre uma solução metodol ogica. A solução metodológica nomeada 3D Extraction Building Parameters (3DEBP) destina-se a extracção da área, da altura da fachada e do volume dos edifícios a partir de nuvens de pontos 3D. Esta solução foi criada tendo por base um conjunto de ferramentas FOSS: PostgreSQL/PostGIS, QGIS, GRASS e R-stats. Foram realizados testes em duas áreas urbanas com morfologias distintas: Praia de Faro (morfologia irregular) e Amadora (morfologia regular). O teste sobre a área urbana da Praia de Faro utilizou uma nuvem de pontos LiDAR e uma outra extra da de levantamento realizado por UAV. O teste sobre um quarteirão urbano de Amadora foi realizado apenas sobre nuvem de pontos UAV. Os testes revelaram que a qualidade da informação extra da e dependente da morfologia urbana. Nas conclusões discute-se a medição 3D com base em dados obtidos por tecnologia LiDAR e UAV, questiona-se a implementação de soluções FOSS para diferentes fases do processo de planeamento e defende-se a introdução intensiva da modelação 3D no plano urbano do futuro.

Full text

Janeiro, 2016 Tese de Doutoramento em Geografia e Planeamento Territorial. Especialização em Detecção Remota e Sistemas de Informação Geográfica 3D Point Clouds in Urban Planning: Developing and Releasing High-end Methodologies based on LiDAR and UAV Data for the Extraction of Building Parameters Carla Cristina Roque Rebelo Tese apresentada para cumprimento dos requisitos necess´arios `a obten¸c˜ao do grau de Doutor em Geografia e Planeamento Territorial, Especializa¸c˜ao em Detec¸c˜ao Remota e Sistemas de Informa¸c˜ao Geogr´afica, realizada sob a orienta¸c˜ao cient´ıfica do Professor Doutor Jos´e Ant´onio Tened´orio e co-orienta¸c˜ao Professor Doutor Jos´e Alberto Gon¸calves. i ACKNOWLEDGMENTS I would like to start by thanking my supervisor, Professor Jos´e Tened´orio, for his support, encouragement, dedication and scientific vision that always inspired a constructive discussion at every stage of this research, and that was fundamental for the success of this work. I am also indebted for the trust, friendship, and understanding that he has always shown over these past few years, in all the good moments, but also in tough ones. I am also very grateful to my co-supervisor, Professor Jos´e Alberto Gon¸calves, for his support, availability and technical guidance at every stage of this project, and for sharing his knowledge and fostering the discussion, which was so important for this research. I would like to thank all the people that have made this thesis possible: Professor ´ Oscar Ferreira from the University of Algarve for providing me with LiDAR data; my friend, the engineer and topographer, Rita Batista, and the topographer Jos´e Batista for carrying out the topographic survey at Praia de Faro; and engineer Jo˜ao Marnoto from SINFIC for providing my with UAV data for Amadora and for his availability to perform a UAV flight over Praia de Faro. I am also indebted to him for having shared his knowledge and for all his support and friendship. I would like to express my gratitude to the following people who have played an important role at this stage of my life. To Professor Jo˜ao Catal˜ao from the Faculty of Sciences of the University of Lisbon for providing me with information on Praia de Faro right at the beginning of this research. To the e-GEO research centre that has recently been integrated into CICS.NOVA for its financial support for the acquisition of data, participation in national an international conferences, resources, and the possibility of using the facilities to carry out this work. In particular, I would like to thank Professor Maria Jos´e Nazar´e Rocca (former e-GEO coordinator) and Professor Carlos Pereira da Silva, for his support as coordinator of the Geographic Modelling, Cities and Spatial Planning Group. To the University of Algarve, for the financial support within the scope of the PROTEC programme that supports advanced training for lecturers at polytechnic higher education institutions. To my colleagues at e-GEO: Bruno Neves, Teresa Santos, Sara Encarna¸c˜ao, Rossana Estanqueiro, Filipa Ramalhete, S´ergio Freire, and Ricardo Mendes. Special thanks to Raquel de Deus, of my class at university and a good friend, for her support and for having shared not only my frustrations but also the good moments. To my friend Ant´onio Rodrigues, a special friend, for the constant support, encouragement, and confidence. His suggestions, sometimes challenging, have ended up being very important for the course this project has taken. All the good moments shall not be forgotten. To the company that has welcomed me, particularly to Jo˜ao Lou¸c˜ao, Technical Manager, for the support he has given me in these past few months that enabled me to finish writing this thesis. To my colleagues and friends at the University of Algarve, Sara Madeira, Ana Pinho, and Concei¸c˜ao Ribeiro. And special thanks to those with whom I shared an office – Carlos Sousa and Maria Celeste Gameiro – for the good environment that they have always fostered. To Jos´e Rodrigues, for the support and strength that he gave me to jumpstart this research. To my colleagues Luis Crispim, Rui Dias, and Paulo Torrinha. Particularly to my friend and colleague, Rosa Oliveira, always available and always present. To Victor Ferreira and Jorge Gustavo for their help with open-source. Last but not least, I would like to thank all my friends for their understanding over these past few years, particularly to my parents and my sisters for their support and their faith in me. To my husband Sigismundo and my daughter Matilde, who have been the foundation for my balance and strength to accomplish this objective. This thesis would not have been possible without you. iv 3D POINT CLOUDS IN URBAN PLANNING: DEVELOPING AND RELEASING HIGH-END METHODOLOGIES BASED ON LIDAR AND UAV DATA FOR THE EXTRACTION OF BUILDING PARAMETERS CARLA CRISTINA ROQUE REBELO RESUMO PALAVRAS-CHAVE: Plano Urbano, Nuvem de Pontos 3D, Modela¸c˜ao de Dados 3D, Altura Edif´ıcio, Volume, FOSS, 3DEBP Os dados geogr´aficos tˆem um papel determinante na formaliza¸c˜ao do plano urbano, enquanto instrumento de planeamento e documento normativo que define juridicamente as obriga¸c˜oes p´ublicas e vincula os particulares, num determinado per´ıodo temporal, no que respeita `a disciplina urban´ıstica de uma cidade ou de um aglomerado urbano, estabelecendo regras de uso e de ocupa¸c˜ao do solo. O plano est´a associado a um processo, designado processo de planeamento; processo esse que ´e constitu´ıdo por um conjunto de fases, dinˆamicas e adaptativas, que se iniciam na sua elabora¸c˜ao e terminam na avalia¸c˜ao dos desvios entre o determinado no documento inicial e as metas e objectivos efectivamente atingidos. O plano, o processo e a praxis do planeamento exigem dados geogr´aficos actualizados a cada instante, quer para as ac¸c˜oes de monitoriza¸c˜ao quer para os momentos de avalia¸c˜ao. Um dos aspectos cruciais do plano ´e a quantifica¸c˜ao da volumetria do espa¸co edificado existente. Outro aspecto, tamb´em fundamental, ´e o da gest˜ao dessa volumetria; quer da volumetria existente quer da volumetria adicional. O tema da volumetria dos espa¸cos edificados tem constitu´ıdo, ali´as, um dos temas mais sens´ıveis quando se trata da densifica¸c˜ao do espa¸co urbano existente ou do desenho de novos espa¸cos urbanos de expans˜ao. Considerando o quadro te´orico apresentado, o tema central da tese trata da modela¸c˜ao de nuvens de pontos 3D obtidas por tecnologia LiDAR e por UAV, para as aplica¸c˜oes na elabora¸c˜ao do plano e no processo de planeamento urbano, designadamente quantifica¸c˜ao dos parˆametros urban´ısticos altura da fachada e volume dos edif´ıcios. A explora¸c˜ao do tema central da tese suporta-se em dois n´ıveis: o n´ıvel da operacionaliza¸c˜ao e o n´ıvel da usabilidade. O n´ıvel da operacionaliza¸c˜ao concretiza dois objectivos: i) demonstra¸c˜ao da relevˆancia e da pertinˆencia da extrac¸c˜ao, medi¸c˜ao e geovisualiza¸c˜ao 3D dos parˆametros urban´ısticos baseadas na experimenta¸c˜ao e implementa¸c˜ao de t´ecnicas de geoprocessamento; ii) demonstra¸c˜ao da pertinˆencia dos parˆametros urban´ısticos extra´ıdos considerando distintas morfologias urbanas. Para o n´ıvel da usabilidade definem-se igualmente dois objectivos: i) demonstra¸c˜ao da usabilidade dos parˆametros urban´ısticos extra´ıdos avaliando o erro associado `a extrac¸c˜ao; ii) demonstra¸c˜ao da usabilidade dos parˆametros urban´ısticos extra´ıdos para planeamento, em particular para o mapeamento dasim´etrico de alta precis˜ao. Da investiga¸c˜ao decorre uma solu¸c˜ao metodol´ogica. A solu¸c˜ao metodol´ogica nomeada 3D Extraction Building Parameters (3DEBP) destina-se `a extrac¸c˜ao da ´area, da altura da fachada e do volume dos edif´ıcios a partir de nuvens de pontos 3D. Esta solu¸c˜ao foi criada tendo por base um conjunto de ferramentas FOSS: PostgreSQL/PostGIS, QGIS, GRASS e R-stats. Foram realizados testes em duas ´areas urbanas com morfologias distintas: Praia de Faro (morfologia irregular) e Amadora (morfologia regular). O teste sobre a ´area urbana da Praia de Faro utilizou uma nuvem de pontos LiDAR e uma outra extra´ıda de levantamento realizado por UAV. O teste sobre um quarteir˜ao urbano de Amadora foi realizado apenas sobre nuvem de pontos UAV. Os testes revelaram que a qualidade da informa¸c˜ao extra´ıda ´e dependente da morfologia urbana. Nas conclus˜oes discute-se a medi¸c˜ao 3D com base em dados obtidos por tecnologia LiDAR e UAV, questiona-se a implementa¸c˜ao de solu¸c˜oes FOSS para diferentes fases do processo de planeamento e defende-se a introdu¸c˜ao intensiva da modela¸c˜ao 3D no plano urbano do futuro. vi 3D POINT CLOUDS IN URBAN PLANNING: DEVELOPING AND RELEASING HIGH-END METHODOLOGIES BASED ON LIDAR AND UAV DATA FOR THE EXTRACTION OF BUILDING PARAMETERS CARLA CRISTINA ROQUE REBELO ABSTRACT KEYWORDS: Urban Plan, 3D Modelling, 3D Point Cloud, Building Height, Volume, FOSS, 3DEBP Geographical data plays a major role in urban plan development, both as a planning instrument and as a normative document that legally defines public obligations and binds individuals, in a given period of time, regarding the urban aspect of a city or an urban conglomerate, and establishes standards for land use and land cover. The plan is associated with a process, called the planning process, which consists in a set of dynamic and adaptive phases that begin with its development and end with the evaluation of any discrepancies between the provisions of the original document and the accomplished goals and objectives. The plan, the process, and the planning praxis require up-to-date geographical data at all times, both for monitoring actions and for the evaluation phases. One of the crucial aspects of the plan is the quantification of the existing building volume. Another fundamental aspect is managing that volume: both regarding the existing volume and any additional volumes. Actually, the building volume in built areas has been one of the most sensitive topics on the densification of existing urban spaces or the design of new growing urban areas. Considering the existing theoretical framework, the central topic of this thesis focuses on 3D point cloud modelling obtained from LiDAR and UAV technologies, employed in the development of a plan and in the urban planning process, namely regarding two specific building parameters – building height and volume. The explanation of the central topic of this thesis is twofold: implementation and usability. The implementation level has two goals: i) demonstrating the relevance and pertinence of the extraction, measurement, and 3D geovisualization of building parameters based on the experimentation and implementation of geoprocessing techniques; ii) demonstrating the pertinence of the extracted building parameters considering different urban morphologies. At the usability level, we defined two goals: i) demonstrating the usability of the extracted building parameters, evaluating the error associated with the extraction; ii) demonstrating the usability of these parameters for planning, particularly for high precision dasymetric mapping. Based on our research, we propose a methodological solution termed. 3D Extraction Building Parameters (3DEBP) and aimed at extracting areas, fa¸cade height, and building volumes from 3D point clouds. This solution was created with the following set of FOSS tools: PostgreSQL/PostGIS, GRASS, QGIS, and R-stats. We performed several tests in two urban areas with different morphologies: Praia de Faro (irregular morphology) and Amadora (regular morphology). The former (Praia de Faro) used a LiDAR point cloud and another one extracted from a UAV survey, while the latter (urban neighbourhood of Amadora) only used a UAV point cloud. Both experiments reveal that the quality of the information extracted depends on urban morphology. Finally, we discuss 3D measurement based on data obtained from LiDAR and UAV technology, raising questions on the implementation of FOSS solutions for different phases of the planning process, and arguing for the intensive introduction of 3D modelling for the future of urban planning. viii MP MegaPixel NASA National Aeronautics and Space Administration NDSM Normalized Digital Surface Model OGC Open Geospatial Consortium OS Open Source PCGT The Collaborative Platform for Territory Management (Plataforma Colaborativa de Gest˜ao Territorial) PDM Master Plan (Plano Director Municipal) PMVS Patch-Based Multi-View Stereo Software PNPOT National Programme of Spatial Planning (Programa Nacional da Pol´ıtica de Ordenamento do Territ´orio) PL/R Procedural Language R PLY Polygon file format POOC Shoreline Spatial Plan (Plano de Ordenamento da Orla Costeira) PRF Pulse Rate Frequency PROGIP Computer Management Support Programme for Municipal Plans PROSIG Support Programme for the Creation of Local Nodes of SNIG PROT Regional Spatial Plans (Plano Regional de Ordenamento do Territ´orio) RCM Resolution of the Council of Ministers REOT Spatial Planning Status Reports (Relat´orio sobre o Estado do Ordenamento do Territ´orio) RJIGT Legal Framework for Territorial Management Instruments (Regime Jur´ıdico dos Instrumentos de Gest˜ao Territorial) RGB Red Green Blue RMSE Root-Mean-Square Error RPAS Remotely Piloted Aircraft System SCE Military Cartography Services (Servi¸cos Geogr´aficos do Ex´ercito) SDI Spatial Data Infrastructure SfM Structure-from-Motion SGM Semi-Global Matching SNIT National System for Territorial Information (Sistema Nacional de Informa¸c˜ao Territorial) SNR Signal-to-Noise-Ratio SQL Standard Query Language xv SSAIGT Spatial Plans Automated Submission System (Sistema de submiss˜ao autom´atica Informa¸c˜ao Geogr´afica Territorial) SRUP Servitudes and Public Utility Restrictions TEN Tetrahedron Network TIN Triangulated Irregular Network UAS Unmanned Aerial System UAV Unmanned Aerial Vehicle UOPG Operating unit of planning and management (Unidade operativa de planeamento e gest˜ao) VE Vertical Error WFS Web Feature Service WGS84 World Geodetic System 1984 WMS Web Map Service xvi Introduction The Portuguese legislation on land use planning and urbanism has introduced new requirements for geographic information in these past few decades. Hence, the need for the integration of 3D geographical data acquisition technologies, accompanied by the development of advanced and dedicated methodologies, has become a relevant and priority research topic for urban planning. One of these requirements related with the need for updated geographic information was introduced for the first time by the Legal Framework for Territorial Management Instruments (Regime Jur´ıdico dos Instrumentos de Gest˜ao Territorial – RJIGT) approved by Decree-Law No. 380/99, of 22nd September. This legal framework of the Territorial Management Instruments (Instrumentos de Gest˜ao Territorial – IGT) promotes the analysis and characterization at different intervention scales of the territorial management instruments, including the urban scale, requiring the updating of geographic information and an evaluation report of the municipal plans every two years1. This report is required to assess whether there is any need to revise the plan. Consequently, at that time, geographical database updating for municipal plans was already a very important issue to monitor and evaluate those plans in continuum. In this century, this Decree-Law was amended by Decree-Law No. 316/2007, of 19th September, and Decree-Law No. 46/2009, of 20th February, in order to simplify the procedures of the planning process by decentralizing them and increasing municipal responsibilities, while simultaneously clarifying concepts and intervention instruments. Moreover, the publication of two important Regulatory Decrees to support the planning process was approved on 29th May, 2009. One of these was Regulatory Decree No. 9/2009, which defined certain technical concepts in the fields of spatial planning and urbanism, such as building fa¸cade height, building volume 1Currently, this report must be drafted every four years, pursuant to article 189 of Decree-Law No. 80/2015, of 14th May. 1 and total volume, among others. The other one was Regulatory Decree No. 10/2009 that established the rules for mapping to be used in IGT, including the positional accuracy of topographic mapping to be used in the elaboration of IGT. This legislation was the starting point for this research work, based not only on a vision of a geographic information updating, but also on the introduction of 3D data that can support an efficient system of indicators to monitor and evaluate plans. In the meantime, a new legal framework – RJIGT – has recently been published by Decree-Law No. 80/2015 of 14th May, which constitutes a revision of Decree-Law No. 380/99 as a consequence of Law No. 31/2014 on the general bases for a public policy on soil, spatial planning, and urbanism2. The aim of this new Decree-Law is to launch a new concept and a new form of land management that is more coherent, consequential, and responsible, where the spatial effects of the economic and social dynamics are reinforced in the spatial planning. This revision of the IGT legal framework has brought to light four aspects that are crucial to the planning process: i) improving efficiency with the dematerialization of the elaboration and revision procedures in the planning process; ii) ensuring the ‘democratization’ of the plans by promoting the self-knowledge of all the stakeholders; iii) reinforcing the monitoring and evaluation phases of the territorial plans, whose mandatory underlying indicators should be included in the content of the plan; and iv) replacing the 10-year time frame for the revision of the plans with a ‘dynamic time frame’, which means that the revision of the plans has become more dependent on the results of the monitoring and assessment process. Furthermore, Decree-Law No. 193/95, based on 2D mapping production rules, was replaced by Decree-Law No. 141/2014, of 19th September. This new law also integrates the usage and elaboration of maps regarding the territorial management instruments included in Regulatory Decree No. 10/2009 (which was revoked). This Decree-Law increases the need for topographic mapping updating for the elaboration/revision to one to three years depending on the type of municipal plan. This new legislation reinforces the importance of technology in monitoring and evaluating the plans. Consequently, the research on the usability and pertinence of 3D data acquisition technologies for the planning process carried out in this thesis was strengthened by this new legislation. In other words, the recent legal 2Lei de bases gerais da pol´ıtica p´ublica de solos de ordenamento do territ´orio e de urbanismo. 2 framework of RJIGT does not challenge the approach of this thesis, but reinforces its importance for the planning process. Problematics and goals of the research What role do the new data acquisition and modelling technologies play in the planning process? The planning process for territorial management instruments is dynamic due to urban development. This dynamics is essentially reflected on the elaboration/revision, monitoring and evaluation, and public discussion phases and presents a challenge for the planning process, in so far as it requires modelling and constantly measuring urban areas. Due to this dynamic character of the planning process, the new IGT legal framework privileges the monitoring and evaluation of the plans. Therefore, the monitoring of a plan requires continuously updated geographic information, which simultaneously allows a systematic supply of plan indicators. One of the challenges of monitoring a plan as a management instrument is the urban scale, namely monitoring urban densification and land-use changes from non aedificandi to aedificandi. These issues require very simple measurements, such as building height and building footprint area for the estimation of built volumes. These volumes are in turn used for general strategic studies, such as solar radiation models to determine the energy potential of cities, noise models that are associated with a requirement of the law, urban wind field physical models, air pollution models, urban density models, and dasymetric mapping techniques for the reallocation and aggregation of semantic data according to a common geometry. All these models and other general urban analysis studies require building height for the identification of new buildings or changes in building height. The new legislation reinforces the monitoring of urban dynamics, which implies issues tied with measuring and modelling building volume. Furthermore, 3D geovisualization has proven to have greater receptivity from the citizens and stakeholders when a plan is publicly discussed. Although, the construction of models still makes use of classical photogrammetry measurements, that is not enough insofar as the time and cost is substantially higher when compared with the time and cost of recent acquisition methods from point clouds and 3D modelling data. 3 Thus, in response to the initial question, the new data acquisition and modelling technologies play an important role in the planning process by the introduction of 3D data for 3D measuring, such as the acquisition of building height and volume that can supply a system of 3D indicators to monitor plans, and for 3D geovisualization at the public discussion phase. The scope of this research is understanding how to extract building parameters from 3D point clouds obtained from Light Detection And Ranging (LiDAR) or Unmanned Aerial Vehicle (UAV) airborne systems to support the urban issues mentioned above. Therefore, the development of a semi-automatic methodology using Free and Open Source Software (FOSS) technologies that allow us to model and measure building parameters – area, height, volume, and total volume – shall be demonstrated. Furthermore, the evaluation of the building parameter errors is also an important task to support the level of usability of this data for urban planning. The research objectives of this thesis are twofold: At the operational level: •demonstrating the relevance and pertinence of the extraction, 3D measurement, and 3D geovisualization of building parameters on the experimentation and implementation of these actions; •demonstrating the pertinence of the building parameters extracted from distinct urban morphologies. At the usability level: •demonstrating the usability of the building parameters for the planning process through the evaluation of errors. The usability will be established by the definition of an error threshold for each building parameter that is acceptable for the monitoring or 3D geovisualization; •demonstrating the usability of building parameters for urban planning issues, particularly for high precision dasymetric mapping techniques. Conceptual structure of the thesis: point clouds modelling for urban planning Conceptually, this research project should address a structure based on spatial data acquisition for 2D/3D modelling that aims to demonstrate and operationalize geographical data acquisition technologies for a plan and for the extraction of 4 building parameters at the urban scale, as the culmination of the response to the objectives proposed. Synthesis of the methodology: from data to demonstration The general methodology has a hierarchical structure. Each of the higher levels inherits the characteristics of the lower levels. The acquisition of spatial data forms the basis of this structure, as indeed it is the basis of all the operational projects related with the production of geographic information for urban and spatial planning: remote sensing surveying, Global Positioning System (GPS), photogrammetry, mapping, etc. It is, in fact, the most elementary stage in the geographic information production process for the planning process. The 2D/3D modelling inherits the quality data obtained at the basis of this structure. In fact, data quality is at the base of this structure, which necessarily includes the evaluation of errors, depending on the technologies and acquisition processes. The knowledge of this error is absolutely essential to infer the quality of the models produced. That quality may be lower in the case of urban analysis for characterization purposes (a phase in which the most important aspect is an overview of the city or country) in the preparation of a plan. Anyway, one cannot work in the planning process without knowledge of the error and eventually the possibility of it spreading. The quality of the measurement based on building parameters (extraction of parameters) inherits the two levels mentioned above and depends on the quality of the 2D/3D models produced, as well as on their usability for planning. Consequently, the ultimate goal is the internalization of the generated models into the plan. 5 If it is technically possible to quantify the error information and the effect of this error in the creation of the models, then we can state that this is demonstrated through its operationalization (higher level of the structure) in the planning process, either urban planning or spatial planning. Structure of the thesis The thesis is structured into four chapters as follows: •Chapter 1 the geo-information technologies are addressed by showing their importance for and evolution within the planning process over these past few decades in Portugal and their current trends for urban planning. The geoinformation technologies applied in this thesis are described, namely the Li- DAR system and low-cost UAV related with the acquisition of 3D point cloud data and the Free and Open Source technologies used to explore and modelling 3D point clouds. This chapter contributes to the acquisition of spatial data presented at the base of the methodological framework, which forms the knowledge basis for the beginning of this research. •Chapter 2 highlights the experimentation with and implementation of 3D point clouds for the extraction of building parameters – area, height, volume, and total volume – of single family dwellings. Two approaches are presented: (1) experimenting with a LiDAR point cloud for the extraction of building parameters, which includes the usage of an automatic methodology, the evaluation of building height, and characterization of the roofs extracted with semi-automatic methodologies; and (2) testing and comparing UAV and LiDAR point clouds for the extraction of building parameters using a FOSS methodology. It also includes a deep analysis of the errors registered in the estimation of building parameters – area, height, volume, and total volume – for each technology. •Chapter 3 addresses the low-cost UAV technology for the extraction of building parameters in an urban morphology composed of residential building blocks. Two approaches are presented: (1) the evaluation of building heights extracted from building block types; and (2) the demonstration of the pertinence and usability of the extracted building block volume parameter for high precision dasymetric mapping. 6 Chapters 2 and 3 are the core of this thesis: they contribute to the 2D/3D building parameters modelling and extracting within the methodological framework. Furthermore, the evaluation of the errors that was carried out in each chapter contributes to the demonstration of the pertinence and usability of the data extracted for the planning process. •Chapter 4 contains the discussion of the issues addressed in this research and summarizes the main conclusions of this thesis. This chapter highlights the following four issues: (1) it emphasizes the importance of 3D measurement for urban planning; (2) it summarizes the different approaches that we have tried out in this research and reviews the main results and their contributions to this research; (3) it contrasts the results obtained in this research with the new 3D paradigm in the planning process, based on relevance, pertinence, and usability; and (4) it provides future directions regarding the 3D measurement and 3D geovisualization for the planning process, including the optimization and improvement of the solution proposed in this thesis, and the future perspectives for 3D data in urban planning. This chapter contributes to the demonstration and operationalization within the methodological framework. 7 8 in Portugal at this time can be found in Fernandes (2002). Furthermore, at this time, the official cartography on a 1/10000 scale produced by the Portuguese Geographic and Cadastre Institute 12 (Instituto Geogr´afico e Cadastral – IGC.) was done in a similar way, but was not able to support planmaking because only 19 map sheets of Lisbon on a 1/10000 scale were available. In 1985, most of the municipalities only had print maps on a 1/25000 scale, and the plans were designed from this support. At the end of the 1980s computer-aided design started to be used by architects and engineers for the production of detailed plans (urban project) and urban plans based on the conversion of analogue maps to a digital format (raster). Subsequently, most municipalities started to work with computer aided design for urban studies, based on digital mapping obtained by the scanning of mapping documents (Matos et al., 1994). During this time, the usage of analogue maps was a problem for the delimitation of land uses in a master plan, because of the lower accuracy in the definition of zoning areas due to instrument accuracy and human error (graphicism error) and distortions on the support (Campos & Silva, 1997). At the end of the 1980s, there were only four effective master plans and three approved by Municipal Councils (Fernandes, 2001), mainly due to the ‘absence of a planning culture’ and the inexperience of the local administration to deal with the implementation of policies and plans (Pereira, 2003). Additionally, only thirty urban plans and 142 detailed plans were approved between 1985 and 1990 (Alves, 2007). 1.1.2 Digital mapping in the 1990s Urban planning in the 1990s became a matter of utmost importance for the development of the territory because Portugal had joined the European Community (EC) in 1985 (Alves, 2007). The implementation of master plans became mandatory since the approval of community funding for projects required the existence of such an effective plan. This stage marked the first generation of master plans in Portugal with the definition of the legal framework for the municipal plans established in Decree-law No. 69/90, of 2nd March. After the publication of this law the number of master plans did not in- 12Currently it is included in DGT as IGP. 15 crease as expected (Alves, 2007) because few technicians were able to respond to the amount of plans in the short time. On the other hand, there were technical mapping issues related to analogue topograhic mapping that were difficult to implement when designing the plans. Campos & Silva (1997) identify in the regulatory cartography two types of problems regarding the spatial representation of plans: measurement and interpretation. Both are mainly related with the scale of topographic mapping and with the use of topographic mapping in an analogue support. Some issues related with the elaboration of plans are summarized below: •out-of-date official topographic mapping (some maps were over 20 years old) due to analytical photogrammetric methods and ground control procedures that were very time consuming. The delimitation of zoning areas was difficult without a real knowledge of the territory; •incorrect handling of these mapping data by technicians, where the geographical data sometimes was acquired through the extended copies of mapping documents; •topographic mapping was rarely scanned as a single document; what the base map used was a composition map of various scans. Sometimes several map sources on different scales were used to compose the base map (Matos et al., 1994); •topographic mapping on a 1/25000 scale was not suitable for the spatial representation of land uses required for the elaboration of zoning master plans (planta de ordenamento), such as the delimitation of land uses and urban fringe; •the use of digital maps obtained from analogue maps with distortions, where the overlap with other maps often presented deviations. More details about the problems in the elaboration of mapping plans during this decade can be found in Campos & Silva (1997) and Matos et al. (1994). Afterwards, the Portuguese government established two programmes in 1994 to solve these problems, whose main objective was to support the acquisition of geographical data by computer-aided design systems, ensuring the quality of analogue maps scanned and increasing plan-making and the evaluation of plans to 5 years: Computer Management Support Programme for Municipal Plans13 (PROGIP) and 13Programa de apoio `a Gest˜ao Informatizada de Planos Municipais do Ordenamento do Ter- 16 Support Programme for the Creation of Local Nodes of SNIG (PROSIG). The difficulties in the implementation of these programmes can be seen in Matos et al. (1994). Furthermore, around this time, the Portuguese government approved funding for the development of a new National Mapping Series on a 1/10000 scale by IGC14 in order to support plan-making and revise municipal plans and special plans. Later, the ProCARTA programme was launched in 1994 to provide technical support to municipalities for the production of official digital mapping on a 1/10000 scale for five years, based on agreements signed between private companies and IGC. However, there were some difficulties in the implementation of this programme because the standards and procedures were not properly defined and companies did not possess the mapping technology needed for the management skills. Following the growing trend in digital mapping usage, Decree-Law No. 193/95, of 28th July, was published to support plan-making. This law established the regulations for mapping production in Portugal, where the production and updating of official topographic mapping should be ensured by IGC(1/10000) and IGeoE (1/25000). Also, IGC should regulate and establish rules for the production of topographic mapping by private companies. Urban planning policies in the second half of the 1990s were more proactive than reactive for the (re)qualification of urban areas was a priority (Alves, 2007) based on good practices for the usage of geographical data acquisition technologies. Later, at the end of the decade, the principles and objectives for territorial management and urbanism were established by the Spatial Planning and Urban Policy Framework (Lei de Bases da Pol´ıtica de Ordenamento do Territ´orio e Urbanismo – LBPOTU) approved by Law No. 48/98, of 11th August. Moreover, the legal framework for the IGT approved by Decree-Law No. 380/99, of 22nd September, promoted the characterization and analysis of the plans for territorial management at different levels of intervention. According to the LBPOTU, three levels of plans were defined for IGT: a) at the national level, the National Programme of Spatial Planning (Programa Nacional da Pol´ıtica de Ordenamento do Territ´orio – PNPOT), sectorial plans and Special Spatial Plans (such as the Shoreline Spatial Plan – POOC); b) at the regional level, the Regional Spatial Plans; c) at the municipal level, the inter-municipal plan and rit´orio. 14Currently, included in DGT. 17 municipal plans (Master Plan, Urban Plan, and Detailed Plan). This law introduced the monitoring and evaluation of the spatial planning policy in the planning process pursuant to article 28. Accordingly, the ‘Spatial Planning Status Reports’ (Relat´orio sobre o Estado do Ordenamento do Territ´orio – REOT) should be developed every two years by the Government (at the national level), Regional Boards (at the regional level), and Local Authorities (at the local level). The RJIGT introduced significant changes in the planning process, particularly regarding plan-making, evaluation, and revision of municipal plans. Pursuant to article 98, an assessment report had to be submitted every two years to evaluate whether the plan needed to be revised. Furthermore, the revision of a master plan was mandatory after 10 years, and the municipal plans or special plans could only be updated after 3 years of formalization. This law integrated the monitoring stage into the planning process to support the evaluation. During the 1990s, around 90% of the first generation of master plans had been published, the majority of which was approved between 1994 and 1995 (Pereira, 2003). At the end of the 1990s, the topographic mapping production changed to digital photogrammetry, where all procedures of stereo restitution were made from digital photogrammetric workstations (softcopy photogrammetric systems). Softcopy photogrammetry involved replacing aerial photographs with digital ones. Subsequently, aerial imagery using conventional film-based cameras (large format diapositives) was scanned by a high-precision photogrammetric scanner. This photogrammetric scanner had specific basic requirements such as large format A3, a transparency unit for film material, high geometric and radiometric resolution, and high accuracy. This equipment was very expensive at the time, but it was a mandatory peripheral hardware to ensure the quality of map production. Besides, photogrammetric procedures, including stereo restitution, became possible in a computer system based on algorithms developed from analytical photogrammetry. For instance, aerial triangulation became automatic based on stereomatching techniques, where the tie points are automatically identified. This advance in photogrammetry allowed to georeference simultaneously every image in a block. The stereoviewing is accomplished artificially by displaying alternately a pair of images taken from different points of view with the active shutter-glasses method (Aber et al., 2010). 18 In Portugal, digital mapping was implemented at IGeoE in the second half of the decade with a photogrammetric workstation of Image Station from Intergraph and a PhotoScan TD photogrammetric scanner (Fernandes, 2002). In 1995, the first aerial flight with GPS was made in Portugal by the German company MAPS (Fernandes, 2002). This technology allowed for the reduction in the number of GCPs that were needed for the photogrammetric process. The digital mapping technology reduced the time-consuming process of topographic map updating or production, since most procedures were automated. The production of digital maps on a 1/25000 scale (Figure 1.3) increased in the last five years of the 1990s, not only because of the improvements in terms of technology, but also because the needs of the CENSUS 2001 project resulted in the update of more than 80% of the councils. Figure 1.3: Updating of topographic 1/25000 mapping over time. Source: Gomes (2011). In the last decade of the 20th century and the first decade of the 21st century, an average of 37 mapping sheets on a 1/25000 scale were produced per year (Gomes, 2011). However, map production has decreased in the past few years due to the lack of human resources. 1.1.3 Fully Digital Mapping and GIS in the 21st century The spatial planning policy of the first decade of this century is characterized by the end of the ‘First generation plans’ and the beginning of the ‘second generation plans’ based on digital mapping and GIS technologies. The first generation master plans were completed in 2003 with the G´ois master plan (Pereira, 2003). According to Alves (2007), in 2004 only about 105 municipalities of a total of 278 had urban plans. This means that most municipalities grew without rules and regulations in built-up urban areas. DGT database at that time recorded the existence of 193 urban plans and 654 detailed plans. Regarding detailed plans, 8.4% of those were exclusively for the rehabilitation and regeneration of urban areas and 19 18.7% for industrial and service areas. Also, about 50% of the municipalities had the master plan under revision. The revision of the master plans (2nd generation of plans) has been showing a greater dynamism as a result of several amendments to the legal framework of IGT. In this context, three important Regulatory Decrees that were approved on 29th May to complement plan-making stand out: Regulatory Decree No. 9/2009, which standardizes the technical concepts that would be used in spatial planning and urbanism; and Decree No. 11/2009 that defines the criteria for the classification and reclassification of land uses. However, Regulatory Decree No. 10/2009, which fixed the rules for the mapping that would be used for the elaboration and revision of the plans, was revoked in 2014. Part of its content was included in the new Decree-law No. 141/2014, of 19th September, on mapping production. Recently, Decree-Law No. 193/95 was replaced by Decree-Law No. 141/2014 of 19th September, on 2D mapping production rules, which integrated part of the content of Regulatory Decree No. 10/2009. Furthermore, the new legal framework of the IGT was defined by Decree-Law No. 80/2015, of 14th May (see Appendix A), which takes into account the ‘general basis for public policies on soils, land use, and urbanism’ published (Law No. 31/2014, of 30th May). These new legislation has contributed to the stability, regulation, and standardization of the procedures involved in the planning process. The spatial planning policy was marked by the approval of the strategic plan PNPOT with Decree-Law No. 58/2007, of 4th September and 6 Regional Spatial Plans (Planos Regionais do Ordenamento do Territ´orio – PROT)15 were approved. These plans provide a benchmark for the revision of master plans, urban plans and detailed plans, and for the elaboration of special plans. In this century, revision plans over have been conducted in a GIS environment, where all the thematic mapping is produced from official and approved topographic mapping16 (on several scales: 1/2000, 1/5000, 1/10000, and 1/25000), which should be structured by the rules and technical specifications proposed by DGT. These topographic maps produced by digital photogrammetric techniques remained, and the analogue and analytical stereo plotting instruments still used by 15 Approved: Algarve PROT (2007), Oeste e Vale do Tejo PROT (2009), Alentejo PROT (2010), Centro PROT(2011), AML PROT (2008), and Norte PROT. 16 According Decree-Law No. 141/2014 ‘Topographic mapping’ represents the translation of base mapping (‘cartografia de base’) obtained from photogrammetric techniques. 20 some companies were replaced by digital photogrammetric workstations. Photogrammetric workflow procedures (Figure 1.2) during this decade changed with the introduction of two technologies: the digital aerial camera and the direct georeferencing system. These two technologies allow us to obtain georeferenced aerial imagery in a digital format, eliminating the time consuming photogrammetric workflow scanning process. There was also an automation of the aerotriangulation process with direct georeferencing, including a reduction of GCPs required at this stage of the process. Digital aerial cameras do not have a standard sensor format. They can be divided into large format, medium format, and small format systems. Most of these cameras have a rectangular image format, where the larger dimension is in the across-flight direction to reduce the number of required flight lines (Neumann, 2008). The image size of the large camera format is much higher, which also implies that less images are needed to cover the same area when compared with a medium format camera. It is important to highlight that these advances in digital photogrammetry have turned the acquisition of 2D vector data and orthorectified imagery by a fully digital mapping production into a more time- and cost-effective process. The first surveying flight with a digital aerial camera over Portuguese territory (which acquired 7056 images of 40% of the territory) was made at the end of 2004 using the large format camera Vexcel Ultracam17 (Patr´ıcio, 2006). Moreover, two more aerial flights were made with this camera to cover the whole territory in 2005 and 2006. In 2007, the first large format airborne mapping system Intergraph/ZI DMC (Intergraph/ZI, now Hexagon Geosystems) was acquired by the Portuguese company Municipia. Today it is still the only digital aerial camera in the country. Innovations in automated photogrammetry will be continued over the 21st century in terms of digital image processing algorithms and airborne digital cameras. Baltsavias (1999a, p. 89) stated that ‘Research is mainly focusing on automation of feature extraction...’ and the latest algorithms developed in photogrammetry have shown that this statement still holds true. Moreover, the contribution of computer vision to photogrammetry in these past few years was higher and it is expected 17This aerial flight resulted from an agreement between IGP and the General Directorate for Forestry Resources (Direc¸c˜ao Geral de Recursos Florestais - DGRF) for the production of very high resolution orthorectified imagery (50 cm). 21 to yield significant economic benefits to topographic map production in the future. According to Leberl et al. (2010), computer vision has produced various algorithmic innovations in multi-image matching and multi-image-based point cloud measurements. Nowadays, the geographical data acquired by the digital photogrammetric stereo restitution is completely integrated into GIS environments, where the accuracy and semantic information of official geographical data is preserved. According to Tened´orio et al. (2013), GIS have enabled the dematerialization of processes in urban planning. GIS allow us to manage and structure 2D/3D vector data according to a data model in a geographical database. Consequently, technical standards for a master plan data model18 (Normas T´ecnicas sobre o Modelo de Dados para o PDM) were developed and implemented in 2011. Their main objective was to establish norms and standards for the structuring of master plans in 2D geographical databases and for spatial digital representation. Furthermore, the master plan should include metadata information based on the INSPIRE19 Directive. However, the Technical Standards for urban and detailed plans data model have not yet been developed. All the functionalities of GIS (edition, spatial analyses, queries, multi-scale mapping) can support urban planning through the production of 2D mapping products more easily. Furthermore, the management of solutions, spatial analyses, and visualization of data in a GIS environment contributes to a better planning process, mainly in terms of decision-making, assessement, and elaboration of thematic maps. During the first decade of the 21st century, GIS and computer-aided design systems were completely integrated and recognized by most municipalities as an important tool to support urban planning mapping. However, the revision of master plans in some municipalities was still performed by external officers, because the municipalities lacked skills, resources, and technical expertise in GIS. According to DGT (2013), at the end of 2013 there were 1508 IGT implemented and approved plans, which included: 122 national plans (1 PNPOT, 76 special plans,20 and 45 sectorial plans), 6 PROT, and 1380 municipal plans (277 master plans, 248 urban plans, 853 detailed plans, and 2 inter-municipal plans). 18Required pursuant to paragraph 1 of Article 15-A. of Decree-Law No. 141/2015. 19Infrastructure for Spatial Information in Europe established by Directive 2007/2/EC of the European Parliament and of the Council of 14th March 2007. 20Including 9 POOCs. 22 1.1.4 Web-based 2D GIS and spatial platforms in the 21st century In the past few years, the interaction between GIS data capabilities and communication technologies for the urban planning process have increased in Portugal, through the implementation of electronic platforms over the Internet. Some of the advantages of electronic platforms for the planning process are: a) encouraging transparency in plan-making for citizens; b) self-knowledge of the status of the planning process by all the stakeholders; c) increased effectiveness of plan-making, monitoring, and assessing; and d) plans can be consulted at all times. Silva (2010, p.8) wrote that ‘The growing access and use of information and communication technologies, especially the Internet (...) implied a democratization knowlegde on urban issues.’ In Portugal the first steps towards the ‘digital democratization of IGT information’ began in article 14721 of RJIGT, which states that all IGT should be available within the framework of the National System for Territorial Information (Sistema Nacional de Informa¸c˜ao Territorial – SNIT). The SNIT was implemented in 2008 by DGT backed by web-based 2D GIS tecnhology and supported by Geomedia/Intergraph GIS tools. These web-services provided by SNIT as WMS (Web Map Service) and WFS (Web Feature Service) were based on Open Geospatial Consortium (OGC) specifications. The SNIT is a modular platform managed by DGT (Alves & Sim˜oes, 2015). Presently, the SNIT has 3 main electronic platforms (Article 190 of Decree-Law No. 80/2015, of 14th May): 1. Spatial Data Infrastructure SNIT (SDI SNIT) supported by technology that follows INSPIRE rules, through which it is possible to consult an approved plan (revised, changed or first generation plan) and visualize the thematic mapping of a plan. The same spatial data structure is ensured for all master plans; 2. Spatial Plans Automated Submission System (Sistema de submiss˜ao autom´atica Informa¸c˜ao Geogr´afica Territorial – SSAIGT), where the plans can be submitted by public entities for publication in the Official Gazette and on SDI/SNIT. Currently, the geographic information of plans (georeferenced images, 2D vector data, and metadata) should be submitted according to the 21Decree-Law No. 380/99. 23 technical standards of the data model for master plans provided by DGT in 2011. 3. The Collaborative Platform for Territory Management (Plataforma Colaborativa de Gest˜ao Territorial – PCGT) created in 2008 was designed to support, monitor, and assess ongoing programmes and plans, either by the responsible local authorities for its elaboration or revision, or by public entities and stakeholders that are also involved with the plan. The SNIT has three more electronic platforms22: a) GeoEquip for public equipment (in progress); b) SRUP (Servitudes and Public Utility Restrictions); and c) AH (Historic Archive). Currently, the following issues can be identified in the planning process: transparency, flexibility, standardization, and simplification. Transparency is given by the dissemination of plans using communication technologies, where citizens, stakeholders and public entities can more easily have access to the information regarding a plan. Plan-making and revision is more flexible, since the time frame for the revision of the plan is now defined by entities or plan-makers and should take into account the economic cycle. On the other hand, the standardization of planmaking is a mandatory issue based on spatial data infrastructure and digital spatial representation. The simplification of plan-making and revision processes should be achieved by the standardization of procedures and technical standards. 1.1.5 New paradigms for urban planning Over time, the planning process followed the evolution of geographic information technologies, where the transition from the physical planning process (based on analogue mapping) to the digital planning process revolutionized planning procedures. The digital planning paradigm started with data acquisition technologies, followed by the computation of the planning process. In this case, the way plans are visualized and information is measured based on digital spatial representation (2D mapping). Nowadays, new paradigms for the planning process in Portugal are eminent due to the reform of the RJIGT and advances in 3D data acquisition tech- 22 All these platforms can be consulted in www.dgterritorio.pt/sistemas de informacao/snit. 24 object encountered) and the last echo of lower objects. For instance the laser beam hits a building edge where two echoes (or returns) can be generated (Figure 1.5). Most recent systems are able to record multiple return (up to five) measurements for a single emitted pulse (Wehr & Lohr, 1999), where the signal is a fraction of the different objects reflected (Figure 1.6). This is a clear advantage of LiDAR when compared with image-based technologies (Forlani et al., 2006). Multiple pulses can occur on vegetated areas: a) in vegetation that is not very dense, the first echo belongs to the canopy top and the last pulse to the ground, and b) in forested areas, there are some gaps between branches and foliage where multiple echoes are recorded before the pulse hits the ground. In the last years of the last decade, LiDAR systems have significantly improved in terms of point density (number of points collected) and in terms of the widespread use of multiple returns (Toth, 2009). Figure 1.6: Return pulses recorded for a building surrounded by trees. Zhang et al. (2006) have demonstrated that the last return measurements have a better overall performance in building identification methods for a study area that includes residential houses, complex buildings, individual trees, forest stands, parking lots, open ground, ponds, and roads. Zhang et al. (2006) also refer that multipath reflections (e.g. when a pulse hits glass walls or windows) in the first return result in incorrect low elevation measurements for the roof building, while the last return allows for an easier separation of ground and non-ground measurements and building measurements from trees due to its greater variability. Alexander et al. (2009) have shown that a high point density enables the highest overall accuracy of building type detection and it is useful for the identification of roofs. However, lower densities have proved to be more useful to identify roof morphology. Point density (points/m2) depends on LiDAR instantaneous field of view (IFOV) or footprint laser, pulse repetition rate (PRF), characteristics of the scan- 31 ner (scanning rate, scan configuration, and scanner calibration), and LiDAR flight parameters, such as height, speed, and number of flight lines (Carswell, 2011; Ackermann, 1999; and Baltsavias, 1999a). These parameters will be detailed later. For instance, a higher point density can be obtained from lower flight heights and a higher PRF value. Topographic LiDAR systems usually use sensitive detectors in the laser scanning receiver unit, which operates in the near-infrared wavelengths at 1064 nm or 1550 nm to measure the properties of terrestrial targets. At these wavelengths, atmospheric conditions can slightly affect the pulse laser. The pulse energy is adapted for the wavelength value to ensure eye safety. Since 2004, new ALS systems have appeared with the capacity to record additional and more detailed information about the physical properties of objects, digitizing the entire waveform of emitted pulse and the backscattered pulse (Figure 1.7), called full waveform (Mallet & Bretar, 2009). This means that in addition to X,Y,Z information on each point, it is now possible to record intensity and pulse width values (Mallet & Bretar, 2009). These two parameters provide information about the radiometry and geometry of the target, respectively. Figure 1.7: Laser pulses returned from building and trees and recorded signal strength. Source: Yan et al. (2015). The peaks of backscattered laser energy that represents the intensity values of different targets allow us to identify different land cover types (Alexander et al., 2009). The intensity value in urban areas can help to filter out non-building urban objects, such as distinguishing roofs from trees (Lemmens, 2011 and Alexander et al., 2009). Additionally, it enables the determination of vertical surface structures such as roughness, height and shape of objects, canopy densities and height of trees, and 32 reflectivity (Lemmens, 2011). Furthermore, the integration of multiple-pulses into air (MPiA) technology in 2007 allowed to fly at higher altitudes keeping the point density. The advantages of this technology were the reduction of acquisition time (and costs) and the reduction of the occlusion effect caused by relief variations. However, this technology can affect laser performance, since it is more difficult to preserve range measurement accuracy and adequate pulse energy at high pulse rates and at greater flying heights (Roth, 2011). Relevant parameters for an end user Footprint size The footprint size parameter of LiDAR is a relevant parameter to record the details of the objects. It is the area illuminated by the laser on the ground (Wehr & Lohr, 1999), which is defined as a small footprint between 5-30 cm (Mather, 2004). The use of small footprints in topographic mapping for high resolution DSM is required for urban models (Mather, 2004), where the edge detection of buildings and other objects must be clearly identified with high sharpness (Lemmens, 2011) and for detailed local mapping of surface elevations (Mather, 2004). Lemmens (2011) also noted that the small footprint in tandem with high point density is essential for the 3D modelling of buildings. Footprint size (Figure 1.8) depends on the IFOV of the laser, flight height, and scan angle from nadir (Mather, 2004). Figure 1.8: Relationship between IFOV, footprint and flying height. The most common scan patterns of ALS systems are represented in the centre, and on the right is the elliptical pattern. For instance, if IFOV (also called beam divergence) is equal to 0.2 mrad, the footprint size is 0.2 m at a flying height of 1 km. 33 The footprint size varies linearly with the flying height, so if the flying height doubles, the footprint size will also double. More details about this relation can be seen in Baltsavias (1999b). Pulse Repetition Frequency (PRF) A large number of applications require a good number of points for the production of detailed 3D models. The number of pulses recorded (which represent points) by the LiDAR system is directly related to the pulse rate frequency (PRF). PRF is the number of pulses emitted per second. The evolution of PRF in the last 15 years in commercial LiDAR systems increased substantially from 50 kHz in 2001 up to 500 kHz (500,000 pulses per second) (Roth, 2011). The multiple laser systems have variable rates of up to 1000 kHz (Carswell, 2011). However, for most LiDAR systems (Leica, Riegl,Optech) the range varies between 100kHz and 200khz (Toth, 2009). Laser scan pattern LiDAR is recorded as an irregular point cloud, where the spatial distribution of 3D points depends on scan pattern, flight height, and flight speed (Lemmens, 2011 and Mather, 2004). The scan pattern is the spatial arrangement of pulse returns that would be expected from a flat surface and depends on the mechanism used to direct pulses across the flight line. Advances in scan pattern control have increased point density and improved its distribution. The main ground scan patterns used (Figure 1.8) are Z-shaped sinusoidal, parallel lines, and elliptical. More recently multiple-output scanners have been used, as can be seen in Roth (2011), whose result is equivalent to having two fully synchronized LiDAR systems flying at the same time. Most measurement points on the ground with a Palmer scanner (elliptical pattern) are scanned twice from different directions, where the ellipse of laser footprints translates with the movement of the airplane (Wehr & Lohr, 1999). The TopEye MKIIB is a system that integrates this type of scanner. These types of lasers have some advantages in urban areas, such as reducing the points occluded during the first pass, which acquires more details about the buildings. On the other hand, it provides a large number of wall hits when flying along the street in a city due to the conical scanning mechanism (Kaartinen et al., 2005). The use of these Li- DAR point clouds with an elliptical pattern (Figure 1.8) was tested in the extraction of building parameters (see the case studies of Chapter 2). 34 1.2.3 Data handling and accuracy The raw point cloud acquired from pre-processing after the flight is sorted and filtered. During this post-processing stage, the point cloud still needs manual editing with specific software to correct errors and fill in gaps between various flight lines. All these processes usually are not required for an end user, e.g. an urban planner, who only intends to obtain specific information. However, filtering LiDAR point clouds is one of the most important steps that have to be applied by any end user by using proprietary software or implemented advanced tools for the extraction of specific information. A review of filtering algorithms and its applications to guide users to select the optimal method for a point cloud can be found in Meng et al. (2010) and Sithole & Vosselman (2004). Filtering consists in removing the unnecessary points from a 3D point cloud. For instance the creation of a 3D building model requires the removal of points reflected from vegetation and bare ground. Generally, LiDAR point cloud data is delivered in LASer file format (LAS)24 following the American Society for Photogrammetry and Remote Sensing format standards. For instance, the LAS files used for the case study of Praia de Faro presented in Chapter 2 correspond approximately to 48 MB for a point density of about 6 pts/m2. A LAS file includes at least the following information for each return: X-coordinate, Y-coordinate, elevation, return number, intensity, and scan angle. The main factors that can affect the accuracy of 3D positioning in LiDAR point clouds are the accuracy of range (Baltsavias, 1999a) and the accuracy of parameters of GPS/IMU (position and orientation) of the laser beam (Baltsavias, 1999b and Leberl et al., 2010). Moreover, the accuracy of the point clouds depends on the accurate transformation of their coordinates from WGS84 to the local coordinate system (Baltsavias, 1999b). Regarding the accuracy of this technology, Baltsavias (1999a) wrote that planimetric accuracy from ALS is 2-6 times less accurate than its vertical accuracy, while in traditional photogrammetry it is typically 1/3 more accurate. The altimetric accuracy is overcame below 10 cm (Mallet & Bretar, 2009; Hyypp¨a, 2011). The planimetric accuracy depends on flight height and LiDAR system characteristics, 24 More information about LAS can be found in http://www.asprs.org/Committee- General/LASer-LAS-File-Format-Exchange-Activities.html. 35 which can vary between 20-80 cm (Hyypp¨a, 2011). However, Ahokas et al. (2003) say that planimetric accuracy can be below 40 cm even in forested areas. 1.2.4 Strengths and weaknesses of LiDAR point clouds for 3D modelling of buildings One of the most usual applications of LiDAR point clouds in these past 10 years has been in 3D modelling of buildings. The potential of this data for 3D modelling of buildings has been demonstrated by various authors and projects, where its weaknesses are also shown. A good example of the evaluation of quality, accuracy, feasibility, and economic aspects of automatic building extraction based on LiDAR was performed by EuroSDR (European Spatial Data Research), whose report can be seen in Kaartinen & Hyypp¨a (2006). Additionally, the quality of 3D building models extracted from point clouds is detailed in Elberink & Vosselman (2011). The 3D modelling of buildings that implies the extraction of building outlines25, roof types, and building metric parameters (volume, height) has been tested by various authors. Some relevant considerations cited by them are summarized below to guide the users regarding the requirements and expectations for the usage of LiDAR point clouds in the reconstruction of 3D building models: Building Outlines:a) Kaartinen et al. (2005) note we can expect much better accuracy concerning building outlines with the combination of TopEye laser data and digital aerial images acquired at the same time; b) the determination of building outline is affected by point density, the shadowing of trees and the complexity of the structure (Kaartinen et al., 2005); c) high point densities are suggested for the detection and outlining of buildings (Vosselman, 1999 and Hyypp¨a et al., 2015); d) the reconstruction and 3D modelling of buildings with sharp discontinuities can easily be obtained from a LiDAR DSM; e) the difficulties in extracting accurate building outlines for the generation of 3D building models were shown in Chen et al. (2011), Alexander et al. (2009) and Zeng et al. (2008); and f) the extraction of building edges with height discontinuity from LiDAR is difficult due to small footprint size compared with the average point spacing and unfavourable backscattering from illuminated targets (Sohn & Dowman, 2007). 25In this thesis, it is also called building roofs. 36 Roof types:a) Kaartinen et al. (2005) have demonstrated that the LiDAR point clouds are more suitable than photogrammetric techniques to derive building heights, and extract planar roof faces and roof ridges; b) Alexander et al. (2009) noted that the overall accuracy to detect roof types (flat and pitched) increases with increasing point densities; c) Zeng et al. (2008) extracted simple and regular roofs defined by two plans; d) lower point densities are better for the detection of roof morphology (Alexander et al., 2009); e) high point density allows us to detect correctly most of the planar faces of a roof, but small structures with different heights (such as dormers) near the edges of a roof are not easy to extract (Vosselman, 1999). Hyypp¨a et al. (2015) say that a rough extraction of building roof structures can be achieved with a point density between 1 and 40 pts/m2;f) the level of difficulty in 3D reconstruction of roof face edges is strongly dependent on the type of edge (Vosselman, 1999); g) the gaps that appear in the point clouds are related with the poor reflectance properties of the roof surfaces due to water on flat roofs and dark slate roofs (Vosselman et al., 2005); and i) hip roof ridge lines and flat roof edges can be extracted with higher precision from LiDAR point clouds (Elberink & Vosselman, 2011). Building height and volume:a) if the building models are used to compute volumes, Vosselman (1999) recommends the use of building outlines in the ground planes instead of roof edges extracted from point clouds; b) very high point densities are required to accurately obtain the height of jump edges (Vosselman et al., 2005). Vosselman (1999) recommended the direct usage of LiDAR point clouds without the interpolation of this data in a regular grid, because it can avoid the usage of incorrect interpolated height values in the 3D modelling of buildings. Furthermore, the capacity and accuracy of the LiDAR system in the detection of trees and vegetation could be a disadvantage for the extraction of buildings, where the level of filtering of these points increases and is more complicated (Baltsavias, 1999b). Consequently, the building shapes are not regular because adjacent trees are difficult to remove. Meng et al. (2008) have developed a method based on building element structures using DSM LiDAR to detach the trees from the buildings. LiDAR presents potential for the detection of buildings and modelling different roof types. However, the major difficulty is the extraction of accurate building outlines and length determination, whereas photogrammetric techniques are more suitable (Kaartinen et al., 2005). Most problems encountered in automatic reconstruction of building models ‘(...) often relate to either the characteristics of laser 37 scanners or the lack of (used) knowledge about the possible shapes of buildings’ (Vosselman et al., 2005, p.182). Most problems mentioned above about 3D modelling can be solved with the combination of aerial images or ground plans with LiDAR data. Additionally, the development of interactive modelling environments to correct small errors and allow manual modelling using point clouds (Vosselman et al., 2005) can also improve the results. 1.3 Very high resolution aerial imagery from UAV technology UAV technology is an alternative for low-cost aerial photogrammetric surveys over small areas, and consequently for the acquisition of low-cost 3D point clouds. In a broad sense, this technology is also known as Unmanned Aerial Systems (UAS), which identifies its major system components. Also, the term drone is generally applied to unmanned, powered, free-flying platforms (Aber et al., 2010), but usually it is not used in the context of mapping applications. A UAV uses a passive sensing technology that provides the acquisition of very high resolution aerial images based on conventional photogrammetry principles, such as stereo aerial images coverage and the use of direct georeferencing systems. The main characteristics of this technology are its small size, its ligth weigth (usually <4 kg), the fact that is remotely controlled on the ground (where the flight is programmed and supervised by a user or the user manually controls the flight) and it allows a faster acquisition of low-cost images. Besides, the flexibility of this technology is higher in terms of transport, since an autopilot airplane kit is quite mobile and can be taken to the survey area easily by car (Aber et al., 2010). According to Everaerts (2008, p.120), ‘A major obstacle so far to the introduction of UAVs for any purpose today is that they have not been integrated into the civil aviation authorities regulations.’ This statement is still true, the carry systems for air traffic communication and air security regulations do not cover UAVs. For instance, in Portugal most UAV flights made for technology testing purposes were carried out without warrants. These flights have been made by classifying low altitude UAV systems as model aircrafts, which has caused some controversy in the country. 38 To try to solve this issue that has generated controversy in many European countries, the European Commission requested the European Aviation Safety Agency (EASA) to propose the creation of common rules for operating drones in Europe. The initial proposal was presented in September 2015 by the EASA and marked the beginning of a regulatory framework for UAVs. This document contained a set of safety rules (included in 33 proposals) for operating drones regardless of their weight. Some of the main proposals included in this document are (EASA, 2015): a) regulating commercial and non-commercial operations where the same drone might be used for both commercial and non-commercial activities; b) creating three subcategories (CAT) in the ‘open category’ 26 (low risk): CATA0 Toys and mini drones <1 kg; CATA1 Very small drones <4 kg; and CATA2 small drones <25 kg; c) preventing unauthorized flights outside safe areas, where the drones can be pre-programmed not to fly out of specific areas (called geo-fencing). These platforms can operate in conditions where traditional manned platforms cannot, due to cost, lack of flexibility or operational difficulties (Everaerts, 2008). The major differences between conventional airborne systems that use a large format camera and a UAV are summarized in Table 1.1. The costs of aerial photogrammetric surveys in small areas with classical airborne systems are very high and the planning of flights is time-consuming, unlike UAVs. A UAV is more suitable in dangerous mission flights or inaccessible areas at low altitude, such as mountains, and earthquake and flood areas (Eisenbeiss, 2009). For instance it allows a faster evaluation and monitoring of the flooding or firing areas. In general, and compared with conventional airborne systems, UAVs have shorter flying times, but need more flight missions to cover a large area. The most important aspect of this technology is also the high flexibility with which it allows to obtain very high resolution imagery for the acquisition of 3D data. The higher degree of automation in the acquisition of 3D data through advanced imagery processing, in contrast with the classical methods of digital photogrammetry (stereo restitution), enables the acquisition of 3D data even on site after the flight. Then, it becomes possible to check if there are any problems in the 3D data collected and prevent further trips to the site. 26 ‘Open’ category means to ensure the safety through a minimum set of rules, operational limitations, industry standards, and the requirement to have certain functionalities (EASA, 2015). 39 Table 1.1: Characteristics of traditional aerial airborne and UAV plataforms (Source: Adapted from Everaerts, 2008). Characteristics Conventional Airborne UAV (low-altitude) Systems Coverage local to regional (10-10000 km2) local up to 1 km2(approx. 5 cm pixel on ground) Frequency Update Mapping low or non-existing update programmes Ad-hoc without programs in place Flexibility Integration of flight plans in air traffic; dependent on weather Total, is dependent on weather, particulary wind conditions Spatial Resolution High to very-high (cm-dm) Very high (mm-cm) Positional Accuracy High (methods for sub-pixel accuracy) High (methods for sub-pixel accuracy) Target Applications Mapping, 3D city modelling, image acquisition Crisis Management, Monitoring hazards, 3D modelling of buildings and objects System Costs (approx.) 1 MEuros 15000-50000 Euros The recent developments in computer vision for the purpose of image matching techniques have contributed to the high flexibility of photogrammetric workflow for the production of mapping products (such as orthophotos, DSMs and DTMs) and for the generation of high quality 3D point clouds very similar to a LiDAR 3D point cloud. This innovation in image matching allows us to deal with oblique aerial images usually acquired by UAV, which would be unacceptable in conventional photogrammetry procedures27. These issues have made this technology very attractive for urban applications. Various authors have demonstrated that image matching method using any airborne system can be an alternative to LiDAR such as Haala et al. (2010), Haala & Kada (2010), Leberl et al. (2010) and (Madden et al., 2015). Unlike a LiDAR point cloud, the derivation of a UAV point cloud is not acquired directly, since it is strongly dependent on UAV imagery quality and stereo image matching processing. Therefore, the accuracy of a point cloud is highly dependent on these issues, particulary on Ground Sample Distance (GSD) or ground resolution of the input imagery (K¨ung et al., 2011; Strecha, 2011) and on a robust and automatic workflow that includes dense image matching (K¨ung et al., 2011). The accuracy of elevation data included in a point cloud depends on image data quality, the complexity of object surfaces and of image matching techniques. Many authors have demonstrated the potential of this technology based on UAV/- Dense image matching through positional accuracy. The generation of an accurate 27 The acquisition of 3D data in conventional photogrammetry requires nearly vertical aerial images - tilt <3◦. 40 measurements for the same point in the aerial triangulation process increase the accuracy of a 3D point cloud. According to Haala (2011), in dense urban areas multiple overlapping should be applied, especially to reduce occlusions in stereo aerial images due to relief displacement30. Nowadays, it is possible to obtain an accurate dense 3D point cloud from a dense matching of multiple stereo aerial images method. Haala (2011) shows the great potential of matching multiple overlapping images by using the Semi-Global Matching (SGM) algorithm developed by Hirschm¨uller (2008). This algorithm allows us to obtain one 3D point per each pixel in a stereo model through high computational performance. According to Hirschm¨uller (2011), it allows for robustness in radiometric differences and it offers a good compromise between accuracy and execution time. This algorithm was implemented by many researchers and companies, such as the solutions PIX4D, Leica Xpro SGM and StereoSGBM from the open source library OpenCV (Deuber et al., 2014). In lower textured areas of the images (roofs, walls or roads) the SGM offers better results for point cloud generation (PIX4D, 2013). Various authors have demonstrated the potential of dense stereo image matching for the generation of 3D point clouds. Hirschm¨uller & Bucher (2010) have shown that DSMs of urban areas produced by SGM are more accurate and detailed than LiDAR DSM. Moreover, the dense matching of multiple stereo aerial images with SGM using UAV imagery was tested by Haala & Rothermel (2012) for the generation of DSMs. These authors have shown that a high point density can be achieved in low-textured areas. 3D point cloud from UAV UAV point clouds are textured using RGB (Figure 3.4 in Chapter 3) or Color Infrared (Figure 2.8 in Chapter 2) spectral attributes from images, unlike LiDAR point clouds. Usually, UAV point clouds have an irregular and sparse distribution, which is very dependent on dense matching processing and also on imagery that reflects the characteristics of an overflown area. The point density of a point cloud obtained from UAV imagery is strongly dependent on GSD, where the theoretical concept is ‘one 3D point for each pixel that has been matched in a stereo model’. However, this is not completely true 30Relief displacement corresponds to image displacements caused by topographic relief. 47 because dense image matching fails in some circumstances. It depends on characteristics related to area (urban, mountains, dense vegetation, etc..), the geometric complexity of the respective object surfaces and the capacity and performance of dense matching (or processing imagery algorithms), particulary in complex areas. The density of points can be reduced under dense vegetation, homogeneous or untextured surfaces (lower correlation), occlusions and shadow effects from man-made or natural objects31 (a strong presence in urban areas) and radiometric changes due to changes in illumination. Generally, this results in gaps or sparse points in a point cloud (Figure 1.11). Furthermore, acquisition geometry can affect point density, i.e., highly tilted images can affect the overlapping between stereo pairs and consequently reduce point density. Figure 1.11: UAV points recorded for a building. The accuracy, reliability, and density of elevation data as generated from automatic image matching is influenced by a number of factors. Important factors are the quality of the available image data and the sophistication of the used matching algorithms, but also the geometric complexity of the respective object surfaces. Furthermore, the point density is proportional to the number of pixels matched, which also depends on overlapping imagery and GSD. For instance (Figure 1.11), in vegetation areas (untextured areas) the number of matched features is lower. Comparing LiDAR point clouds (Figure 1.6) with UAV point clouds (Figure 1.11), the latter have uneven density in this area, with very high point density clusters in the highest and steepest part of the roof and lower density in the areas occupied by trees. This image matching technique cannot obtain ground points on dense vegetation unlike LiDAR, which can do that successfully. The development of UAV technology and SGM have allowed us to produce high-density 3D point clouds from multiple stereo images, where dozens of points per 31These effects are caused by variations in surface elevation. 48 square metre can be obtained (about 90 pts/m2) with a vertical accuracy between 2 cm and 4 cm (Haala & Rothermel, 2012). 1.3.3 Strengths and weaknesses of UAV point clouds for the 3D modelling of buildings The majority of the strengths and weaknesses of UAV and dense stereo image matching techniques were presented above. However, we should ask: What are the strengths and weaknesses of this technique using directly a 3D point cloud for the extraction of buildings? The generation of 3D building models and 3D city models at low cost is certainly a strength of this technology. The generation of 3D building models (LoD1) for the extraction of building heights from this 3D data could be an advantage when compared with LiDAR, because the filtering process is easier, since less points need to be removed from the point clouds. In other words, stereo image matching is not successful in poorly textured surfaces which result in a lower point density, such as in vegetation areas (usually near buildings) or untextured surfaces (homogeneous surfaces, such as water and asphalt). Wefelscheid & Ronny (2011) have demonstrated the usage of this data in LoD1 building models. However, the quality of stereo image matching on roof surfaces should be enabled for a higher and uniform point density. This is important for the extraction of accurate building roofs and building heights. In the extraction of building roofs from UAV point clouds there are some issues to take into account: 1. The detailed texture of the roof covering material can affect the quality of the 3D point cloud with gaps or lower point densities. The gaps can appear in tin roofs (Harwin & Lucieer, 2012) and flat black roofs (Rosnell et al., 2011). Therefore, lower point densities in flat roof cover has been shown in Rosnell et al. (2011). 2. Some untextured building surfaces could be an advantage, such as the image matching of ‘white walls’ (K¨ung et al., 2011). 3. The quality of stereo images can be influenced by weather conditions and consequently the quality of 3D point clouds obtained from them is influenced as well. According to Rosnell et al. (2011), the best point densities over homogeneous roof surfaces can be obtained from images collected under sunny 49 weather, except regarding the shadows of the buildings. However, if the images are collected under a cloudy sky, matching can fail to a large extent in these areas. 4. K¨ung et al. (2011) have shown the difficulties of stereo image matching process using PIX4D in two different buildings types for the generation of 3D models LoD1. These authors have demonstrated that: a) building roofs with a homogeneous texture can have ‘floating points’ (elevation errors); b) homogeneous texture in a cross gable roof (with various pitched plans) can have less floating points and a higher point density than a flat untextured roof; c) the roof edges of the buildings are well reconstructed; and d) 3D points on trees were often not computed. In addition, there are some issues regarding the acquisition of UAV imagery: 1. A multi-rotor UAV carrying four combined cameras enables the acquisition of a large quantity of vertical images, which can ensure a better extraction of building roofs (Feifei et al., 2012). 2. The implementation of a UAV flight over urban areas with tall buildings is difficult, but beyond that, the effects of relief displacement are increased on images. This effect can affect the matching of 3D points that result in gaps. Qin (2014) recommends the usage of SGM in dense urban areas with tall buildings to generate a dense point cloud. 3. Manyoky et al. (2011) show that the acquisition of accurate UAV imagery position is limited by camera calibration, image quality, and the definition of the ground control points. Then, the estimation of building outlines should be enabled by these issues. Also, the high radiometric quality and multiple overlapping image matching is essential to city modelling (Toth, 2009). 4. GSD imagery between 8 and 15 cm is required for the interpretation of urban objects (Leberl et al., 2010). Such GSD imagery values or even lower are easy to obtain at a low cost from UAV. 5. Vallet et al. (2011) show a vertical accuracy in roofs within 10 cm under the smoothing effect near buildings. This smoothing effect results from image matching using PIX4D, which tends to smooth obstacles such as buildings, walls, and cars (Vallet et al., 2011). 50 It is important to note that the demonstration of this technology for 3D building models is recent and most studies are based on the extraction of buildings from DSM and not directly from point clouds. 1.4 Free and Open Source Software (FOSS) to explore 3D point clouds A 3D point cloud requires tools for editing, exploring, analysing, and visualizing. In the case of a UAV point cloud, image matching photogrammetric tools are also needed for the generation of the point clouds. There are several commercial solutions to make all these operations, but most of these GIS or photogrammetric solutions are very expensive. On the other hand, they are ‘black-box solutions’, which limit the development and implementation of specific tools for the extraction of 3D information. The use of FOSS could be a potential solution for the usage of ‘3D data’ in urban planning by local, regional and central government bodies in Portugal with the development and implementation of specific urban planning tools. Espada (2010, p.1) has stated that ‘After years of scepticism towards open source software, many of today’s open source solutions are as good, if not better than proprietary software solutions.’ FOSS stands for ‘Free’ software and ‘Open Source’ (OS) software. Free software does not mean that it is free of cost, but it refers to the usage of software freedoms (Steiniger & Hay, 2009). These freedoms were established by the Free Software Foundation (FSF) (FSF, 2004 and GNU, 2013) from 0 to 3 and refer to: (0) The freedom to run the program, for any purpose; (1) The freedom to study the program and change it through the source code access, according to our needs; (2) The freedom to redistribute copies of the program if you wish; (3) The freedom to distribute copies of your modified versions to the public. Additionally, there are software licenses that conform to these freedoms. This means that the code produced is open-source under the GNU General Public License (GNU GPL) and the GNU Lesser/Library General Public License (GNU LGPL). The GNU enables the modification and redistribution of software under the same license conditions (Steiniger & Hay, 2009). 51 One of the major benefits of FOSS tools is the dynamism of the development for teams and users within the applications, where there is a regular contribution and publication of source packages and tools to solve specific problems (Bivand et al., 2008). How should we explore and visualize millions of 3D points using FOSS tools? How can development tools using open source for the extraction of 3D urban features from a point cloud fit within the monitoring and evaluation process? These questions establish new challenges and a new vision in urban planning. A solid knowledge of the usage of FOSS tools is needed for the growth and improvement of urban planning processes, where the usage of 3D geographical data technologies can offer an added value. This means modelling large volumes of 3D data for the (semi)-automatic extraction of 3D geographical data or urban parameters under the development of robust methodologies and in optimized environments, that are user friendly and effective. Furthermore, the usage of 3D data through FOSS tools must be supported by full interoperability. 1.4.1 OS software within 3D point clouds Today it seems very easy to produce 3D models with few technical and scientific skills regarding the issues that supported the technology. According to the specific functionalities of OS software, they can be classified into six categories (Table 1.3) within the usage for 3D point clouds. Table 1.3: Categories of OS software useful to produce and explore 3D point clouds Categories Description OS Software UAV Imagery Tools Computation of orientation parameters; Image matching process Bundler, VisualSfM, Micmac, PMVS, CMPMVS LiDAR tools Specific tools to explore LiDAR information BCAL, PCL Desktop GIS Editing, spatial analysis and visualization GRASS, GvSIG,QGIS Spatial database management system Management and structured data; Data manipulation PostgreSQL/PostGIS, SQlite/SpatiaLite Geostatistical computing Manipulation of statistical data, calculation and graphical display R, GeoDa Modelling and 3D Visualization Creation of 3D models, modelling tools for 3D visualization and creation of textures Meshlab, CloudCompare The ‘democratization’ of technology and OS tools has advantages, but it is important to be careful in their usage, since it is important to ensure the quality of 52 mapping products. OS Photogrammetric Solutions The computer vision approach implemented in certain solutions has made it possible to obtain a point cloud from a set of images, but some open source photogrammetric solutions do not have the rigour and precision that is required for some applications (Deseilligny & Clery, 2012). For instance, some software packages will not provide the dense matching and precise aerotriangulation that are required for UAV imagery (Deseilligny & Clery, 2012) and that implies a combination of tools and various testing studies. Some authors have tested UAV imagery in open source tools: Bundler- PMVS2 in Harwin & Lucieer (2012) and Dandois & Ellis (2010); comparisons between a method based on bundler SfM algorithms and the commercial solutions Photoscan and PIX4D web service in Turner et al. (2013); VisualSfM in Li-Chee- Ming & Armenakis (2014). According to Wenzel et al. (2013) the algorithms for the acquisition of 3D point clouds can be integrated into two categories: 1) Processing imagery to obtain the orientation parameters of images (georeferenced images) followed by a bundle adjustment, such as Bundler, VisualSfM and Apero solutions; and 2) generation of 3D point cloud and surface reconstruction methods based on dense image matching techniques, such as PMVS, Micmac, CMPMVS and VisualSfM solutions. Below we have summarized some of the issues regarding these solutions. Bundler The Bundler software (Snavely et al., 2008) was developed during the Photo Tourism Project of the University of Washington in 2007. The Bundler32 is based on the Structure-from-Motion (SfM) approach, which is an imaging technique to process unordered and redundant sampled images, which allows us to obtain a sparse point cloud. It allows us to obtain the orientation of images performing a least squares bundle adjustment on the matched features and a sparse point cloud from the ‘Sparse Bundle Adjustment’ package (Snavely, 2012). PMVS Patch-Based Multi-View Stereo Software (PMVS) is a multi-view stereo software that obtains orientation parameters from a set of stereo images (Furukawa & 32Available from www.cs.cornell.edu/ ~ snavely/bundler/ 53 Ponce, 2010) and reconstructs 3D structures of an object or a scene. PMVS2 (new version) includes a dense multi-view stereo software to produce dense point clouds. OSM - Bundler Meanwhile an easy OSM-Bundler solution was created to obtain a dense point cloud that includes (Bartoˇs et al., 2014): •Bundler – orientation parameters and reconstruction of sparse point clouds; •PMVS2 – densification of point clouds (available from http://di.ens.fr/pmvs/); •CMVS – splitting images into smaller clusters to improve the time processing of large sets of images (available from http://di.ens.fr/pmvs/). This solution for UAV imagery holds a great potential in natural and manmade landscapes (Harwin & Lucieer, 2012). However, it is not a user-friendly interface. VisualSfM The VisualSfM application (Wu & et al., 2011) allows us to obtain a sparse point cloud based on bundle adjustment and a dense point cloud from running the PMVS/CMVS tools (Bartoˇs et al., 2014). VisualSfM is a GUI application, unlike OSM-bundler and has a good performance. According to Bartoˇs et al. (2014) it is the most suitable solution with reliable results when compared with OSM-bundler and other web-services solutions (‘cloud-based’ to get a point cloud, such as Microsoft Photosynth, Photosynth toolkit and Autodesk 123D Catch). CMPMVS CMPMVS (Jancosek & Padja, 2011) is an additional tool for the improvement of 3D reconstruction obtained from VisualSfM33. It allows more accurate results and reconstructs weak surfaces (e.g. untextured surfaces) better. In general, the workflow solution should be used after the 3D reconstruction obtained from VisualSfM, whose results for a 3D object or scene can be improved by CMPMVS. APERO and Micmac APERO and Micmac were developed by Institut G´eographique National, (IGN, the French mapping agency), to compute 3D models from a set of stereo images (Deseilligny & Clery, 2012). APERO uses classical algorithm of bundle ad- 33Available from http://ptak.felk.cvut.cz/sfmservice/websfm.pl?menu=cmpmvs 54 justment to compute the orientation of images and Micmac performs an aerial image matching following 3D reconstruction from oriented images. Recently, APERO was implemented into the graphical user interface Micmac34. The limitations of Micmac are the complexity of its parameters and the fact that it is not fast enough for some applications (Micmac, 2013). Meshlab Meshlab is an application for the post-processing of 3D points, providing a set of tools for editing, cleaning, rendering, and producing meshes. Furthermore, it is very useful to support the 3D visualization of some solutions that do not have a graphical solution, such as OSM-Bundler. In general, Meshlab is very suitable for 3D visualization of millions of 3D points, whose data format should be PLY, XYZ, and ASC (LAS files from LiDAR are not read 35). FOSS GIS, spatial database and statistical – 2.5D-FOSS-GISDB solution Nowadays, there are several GIS open source desktop packages with different goals, which are stable and reliable for many applications. On the other hand, they have a high interoperability, since it is possible to exchange data between them, thus facilitating the automation of processes. A comparison between eight FOSS desktop GIS and proprietary GIS software (ESRI) regarding their main functionalities was conducted by Steiniger & Hay (2009). Also, Espada (2010) made a comparison between six FOSS desktop GIS. FOSS tools for point clouds require a higher performance, which means a challenge with respect to data storage, processing, and manipulation. Consequently, the user must take this into account when choosing FOSS tools. Below we detail potential tools to filter and structure 3D point clouds that are well supported by development teams. The (semi)-automatic extraction of 3D data for the generation of 3D building models requires a robust methodology preferably integrated into one solution. Quantum GIS, Geographical Resources Analysis Support System (GRASS), R-stats, and PostgreSQL/PostGIS tools can establish a optimal and interoperable 34 Available from http://logiciels.ign.fr/?Micmac site. 35 For instance, a LiDAR point cloud in LAS format can be converted into PLY by GRASS GIS. 55 2.5D-FOSS-GISDB solution (Figure 1.12), i.e., a set of desktop GIS powered by a 2.5D geographic data base (containing 3D data). Figure 1.12: 2.5D-FOSS-GISDB solution for point clouds. GRASS GIS The GRASS is a free and open source GIS software released under the GNU General Public License (GNU GPL) (Neteler & Mitasova, 2008), which was implemented in the GIS community about 30 years ago by the US Army Corps of Engineers. In GRASS GIS the data and projects are stored in a GISDBASE (often called grassdata) with their own structure. The GRASS environment is user friendly, but data structure and the way of working with data make it different from other desktop GIS. One of the advantages of GRASS is the interconection with other OS tools, such as QGIS, R-stats, GDAL/OGR libraries, PostgreSQL, and MySQL. This GIS solution can be found in Holl (2005) and Neteler & Mitasova (2008), which provides a good support to all the users that want to use it. GRASS GIS is composed of a set of powerful tools for the generation of DSM- s/DTMs products from 3D point clouds, including specific modules. Additionally, it also has a high performance for managing, processing (filtering and manipulation), analysing and visualizing point clouds. However, GRASS 7.0 is recommended for point clouds, because it has a high performance in terms of the time it takes processing operations when compared with version 6.X (Rebelo et al., 2013a). 56 However, UAV point cloud density is very dependent on GSD imagery, which is directly proportional. The radiometry and geometry quality of images and the characteristics of the area surveyed can also influence point cloud density. Therefore, density point is lower (sparse) or there are failures (gaps) in vegetation areas, untextured surfaces (dark surfaces, tiny roofs, etc..), shadows and occlusions (mainly in urban areas). The ability of dense stereo image matching to generate point clouds, particularly in these areas, is extremely important, and also for the accuracy of point cloud. Some of the advantages of this system when compared with conventional digital airborne LiDAR and photogrammetric systems are: 1) low-cost system which is easier to buy; b) high flexibility, remotely controlled from the ground and easy to use; c) in less than 24 hours it is possible to perform a UAV flight and acquire a 3D point cloud from a small urban area; and d) it can achieve an accurate and dense point cloud point just like LiDAR. The weaknesses of this technology is the limited flight time (battery life is usually between 30-60 min) and very high sensitivity to wind conditions. For the modelling of buildings the strengths are the lower points in vegetation near the buildings which facilitates the filtering. However, complex and untextured roofs and occlusions on the building roofs can result in a sparser point cloud and gaps, and both can cause difficulties to the modelling of roof shapes and result in a less accurate building outline. d) FOSS to explore 3D Point Clouds FOSS could be implemented as a potential solution for the usage of 3D data for urban planning, since it does not imply any costs with the maintenance of software licenses and it encourages the development of specific tools for the planning process. However, human resources with competencies and skills in FOSS tools and open source programming are needed. Nowadays, there are FOSS tools for the acquisition of 3D point clouds which can be called ‘OS photogrammetric solutions’ and for spatial database analysis, manipulation and visualization called ‘2.5D-FOSS-GISDB’ solution. In the framework of OS photogrammetric solutions, these are classified into two categories: 1) Processing UAV imagery to obtain the orientation of images; and 2) Generating 3D point cloud and surface reconstruction methods. The first category includes Bundler, VisualSfM and Apero solutions, and the second category in- 63 cludes PMVS, Micmac, CMPMVS and VisualSfM solutions. These latter solutions are based on imaging technique SfM. A good solution within this photogrammetry framework is to combine ‘VisualSfM, CMPMVS and Meshlab’ or OSM-bundler (Bundler, PMVS and Meshlab). The 2.5D-FOSS-GISDB solution implies a set of desktop GIS powered by 2.5D geographic database (containing 3D data), which is composed of QGIS, GRASS, R-stats, and PostgreSQL/PostGIS software packages and can establish an optimal and interoperable solution. This solution is suitable for 3D point clouds and it allows: a) structuring a big volume of 3D data within a 2.5D geographic database PostgreSQL/PostGIS; b) filtering and performing a spatial and statistical analysis using GRASS GIS, R or PostGIS functions; and c) 2D/3D geovisualization from QGIS or GRASS. This solution can also be centred in QGIS, establishing a connection with GRASS and PostgreSQL/PostGIS, and R within PostgreSQL/PostGIS. Furthermore, this solution allows us to develop new tools or automatic procedures within a 2.5D geographical postgreSQL/PostGIS database using the procedural SQL language of PostgreSQL (PL/PgSQL) and procedural language PL/R. All these issues can be very useful for the planning process as to the extraction of buildings parameters for monitoring and evaluating a plan. The demand for FOSS tools has grown considerably in these past few years in Portugal. However, the vision on FOSS tools is still not sufficient for the implementation of a FOSS-based planning policy. The creation of a team of developers for urban planning is needed to support: a) the challenges required in the new IGT legal framework (such as the standardization of data models and the graphical representation of plans), and b) the introduction of 3D geographical data technologies in the planning process, such as geovisualization for public discussion, and computing indicators to the monitoring and evaluation phases. In the next chapter, we shall demonstrate the usability of these geoinformation technologies – UAV, LiDAR, and FOSS – for the extraction of building parameters in a small coastal urban area. 64 Chapter 2 Extraction of Building Parameters: A Case Study of a Coastal Urban Area – Praia de Faro According to Baltsavias (1999a), ALS systems will replace photogrammetry in some applications and open up new areas of applications with more accurate cartographic products. Nevertheless, the junction of automated processing and ultra-light UAV imagery can produce results that are comparable to the ones obtained with traditional photogrammetric systems (Strecha, 2011). The aim of this chapter is to demonstrate the usability of these two technologies, ALS or UAV, for urban applications, such as the measurement of building density parameters in urban area. The performance and accuracy of each of these technologies to extract building parameters will be tested and evaluated. The building parameters tested were building fa¸cade height, building area, and building volume. These parameters have the following definitions: i) According to Decree-Law No. 9/2009, the building fa¸cade height parameter in Portugal corresponds to the vertical dimension and should be measured from the elevation of cornice, eaves (beirado) parapet wall, rooftop railings or gutters (platibanda) to the elevation of building base (also called ‘elevation of the main entrance of the building’ if it matches the ground level). However, taking into consideration that a building can have different fa¸cade heights according to its deployment on the 65 ground, only one fa¸cade side of the building was chosen to compute this parameter for this study. For this case study we assumed the upper elevation according to the eaves or parapet wall. ii) the building area parameter is defined from the boundary of the building roof, which is equivalent to the building rooftop area. Usually, most building roofs are coincident with the ground area occupied by the building, such as shown below in Figure 2.1. Figure 2.1: Building Roof Area iii) According to Decree-Law No. 9/2009, the building volume (volumetria do edificio) in Portugal is the measure of the volume built above ground level, defined by the planes that contain the fa¸cades, rooftop, and ground level. In practice, the building volume can be calculated by multiplying building fa¸cade height by building roof area. Therefore, from the sum of building volumes it is possible to obtain the total volume parameter of a built-up area. This chapter shall demonstrate the usability of 3D point clouds generated from ALS or UAV for the automatic or semi-automatic extraction of building parameters. This demonstration was performed based on the development of two different methodological approaches for a small study area, using only 3D point cloud data without any reference data. The first methodological approach was the automatic extraction of building parameters from a LiDAR point cloud using the LiDAR Analyst for ArcGIS, which will be detailed in Section 2.2. In this case we explored a ‘black box solution’ from the end user’s perspective. The second methodological approach (Section 2.3) was developed for a dedicated semi-automatic extraction of building parameters using FOSS technologies (2.5D-FOSS-GISDB), which we called 3DEBP solution. The latter approach was performed for UAV and LiDAR point clouds, which included the development of a Geographical Database Management System (GDBMS). Both methodological approaches were developed in two distinct stages: (1) building parameters extraction, and (2) evaluation of building parameters extracted using ac- 66 curate vector data. Furthermore, the second methodology allowed us to compare the effectiveness and accuracy of two different technologies for the extraction of building parameters. 2.1 Study area and data acquisition The study area – Praia de Faro – is an island-barrier bounded North by the Ria Formosa estuary and South by the sea, located in the Southern portuguese Coast of the Algarve region. The selected geographic area (Figure 2.2) has approximately 2.5 hectares, with a width of 100 m North to South and 250 m East to West along the principal and central street of the island. This open sandy beach is a built-up area with 19 buildings along the street. Most of these buildings are single-family dwellings with a maximum of two stories, although there is a building located Northeast of the study area with four stories (from the estuary side, from East to West, it is the fourth building). Figure 2.2: Study area: Praia de Faro. The buildings represent a diversity of architectural styles and types, with irregular shapes. The roofs are either flat, multiple-level flat, pitched, and complex (with different slopes). The degree of dissimilarity between building shapes is high. This urban area is extremely complex and the building’s typology is very heterogeneous (Table 2.1). 67 Table 2.1: Building code used in Sections 2.2 and 2.3. Northern buildings Southern buildings Code sect. 2.2 Code sect. 2.3 Buildings Code sect. 2.2 Code sect. 2.3 Buildings E1a,E1b - E10 ED10 E2 ED1 2 - - - E3 ED3 E11 ED11 E4 ED4 E12 ED12 E5 ED5 E13 ED13 E6 ED6 E14 ED14 E7 ED7 E15 ED15 E8 ED8 E19 ED19 E9,E16 ED9 16 - - - E18,E18a ED18 - - - E22 - - - - In Table 2.1, we can see the buildings of this study area and the algorithm used together with the methodologies that will be detailed in the following sections. 68 The challenge is the development of a methodology that is robust for the semiautomatic extraction of building parameters from this heterogeneous area using 3D point cloud data. The 3D point cloud data of this study used for this demonstration have a difference of 4 years approximately between them. LiDAR point cloud data was provided in the framework of a project on the morphological impacts and coastal risks carried out by the University of Algarve. However, the UAV point cloud data was collected and processed for this particular study. More details about the point cloud data can be seen in Subsection 2.1.2. In addition to point cloud data it was necessary to collect accurate vector and raster data sources to support some specific studies along this work and for the evaluation of the results obtained. 2.1.1 Vector and raster reference data The acquisition of reference building parameters – building area and building fa¸cade height – was performed from accurate 2D and 3D vector data, respectively. Subsequently, the reference building volume was computed from these two reference parameters. These reference building parameters were important to evaluate the building parameters estimated from each 3D point cloud. The large-scale 2D vector data included accurate building outlines (Figure 2.2). This data was important to calculate the reference building area which allowed us to evaluate the area measurements extracted for each building. The 2D vector data was provided by Sociedade POLIS Litoral Ria Formosa. This information was acquired from traditional photogrammetric restitution with a horizontal accuracy below 40 cm. The 3D vector data included accurate elevation points of building roofs and terrain.In addition, 3D elevation points of roofs and ground were used to calculate the reference building fa¸cade height. The distribution of these 3D points selected from a subset can be seen in Figure 2.2. Furthermore, specific GCPs that have good visibility and definition on aerial images were also collected and used for the processing of UAV imagery. Moreover, raster data was used along this work for the visual inspection of the building roofs extracted from 3D point cloud data. This data refers to true orthoimages1produced by aerial images collected from a digital airborne camera 1The true ortorectification process of aerial images take into account the elevation of all objects above ground - DSM. 69 used during a LiDAR flight and true orthomosaic produced from UAV imagery. The characteristics of all reference data used in this study can be seen in Table 2.2. Table 2.2: Description of reference data – vector and raster Type of data Year Data Technical Acquisition Data details 3D vector data 2012 Elevation points of roofs Leica TCR 705 Reflectorless Total Station Corners and prominent points GCPs Leica GPS900 Corners of causeway, crosswalk, and car parking 2D vector data 2002 Building outlines Photogrammetric stereo restitution Large-scale: 1:2000 Road network Photogrammetric stereo restitution Large-scale: 1:2000 Raster data 2009 True-orthoimages Source: Aerial images from the LiDAR flight with a Rollei AIC P20 (39 MP) camera and DSM GSD: 9 cm 2013 True-orthomosaic Source: Aerial images from the UAV flight with CanonPowerShot ELPH300HS4.3 camera and DSM GSD: 5 cm; Near- Infrared images (NIRGB) All the elevation points (3D vector data points) were acquired from direct field measurement with ground surveying. The 3D topographic survey was first planned for the location of reference points in building roofs that are relevant for the determination of reference building fa¸cade height value (In Appendix B we can see a excerpt of this planning). Additionally, the ground points were defined near the buildings. The topographic equipment Leica Reflectorless total station used for surveying roof points can be seen in Figure 2.3c. This equipment has an angle accuracy measurement of 5”. Before the topographic surveying of 3D points a reference point network of control was established. These reference point network was important to support the survey of all the points planned in the study area. This local network was made in real time with a Leica GPS900 reference station and a real time rover setup (Figures 2.3a and 2.3b). Later, a topographic survey was conducted to obtain GCPs on specific locations for the processing of UAV imagery (Subsection 2.1.2.). This surveying included a subset of six points (Figure 2.7) selected from UAV imagery which have a good identification in various pairs of UAV images. These points were surveyed with Leica GPS900 with a cm-level accuracy of 3 cm on the ground. 70 Figure 2.3: Topographic survey equipment: a) Leica GPS900 reference station; b) Leica GPS900 rover;and c) Leica TCR 705 Reflectorless Total Station. 2.1.2 3D point clouds LiDAR point cloud The LiDAR point cloud was collected in November of 2009 at a flight height of 500 m above ground using an LiDAR system mounted on a helicopter. This LiDAR system has a airborne topographic laser scanner called TopEye MKIIB (Figure 2.4), which is fitted with an Applanix Rollei AIC 39 MegaPixel (MP) digital camera. The laser scanner used by this system is the Palmer scanner which has an elliptical pattern. This type of scanner allowed us to collect a point cloud with higher point density, which can fully cover all vertical elements. However, for this study, the higher point density of the vertical elements may bring more difficulties for the extraction of building rooftop, which implies the development of effective tools to remove the points from all the building fa¸cades. Figure 2.4: Airborne LiDAR system: TopEye MKIIB. 71 The range capture of the LiDAR flight recorded two returns per laser pulse (first and last returns). Each laser return results in a point data with X, Y and Z coordinates and the value of intensity for each point. The LiDAR point cloud of the study area has a density of about 6 points per square metre (this means that distance between points is less than one metre), and the last return points are about 5% of the first return points. Furthermore, the georeferencing of the point cloud was transformed from WGS84 to the local coordinate system (Hayford-Gauss Datum 73). According to the flight planning report, the LiDAR point cloud that will be used along this study has a vertical accuracy of 10 cm. It is important to note that the LiDAR data was kindly provided by Micore project FP7 Framework of Algarve University, which was processed by the BLOM company that made the flight. Later more details about this data will be provided in this section by a comparison with a UAV point cloud. UAV point cloud The UAV point cloud data was obtained from processing UAV imagery, which will be described later. The acquisition of UAV imagery data was performed on 12th April 2013 from a swinglet CAM produced by SenseFLY (Figure 2.5). This aerial system is remotely controlled from a laptop, weighs about 500 grams, and has an autonomy of approximately 30 minutes of flight time. It requires moderate wind that is not above 7 m/s. The swinglet CAM (Figure 2.5) is equipped with a small digital camera (12 MP) and a small direct georeferencing system (GNSS and IMU). The sensor size is 6.2 x 4.7 mm and the focal length is 4.3 mm. Figure 2.5: Airborne UAV system – swinglet CAM. This small aerial system can achieve GSD between 2 and 40 cm at a flight 72 Given the results displayed, there is evidence that the UAV point cloud is slightly better than the LiDAR point cloud (Table 2.5) based on the RMSEzvalue, but this difference is not relevant. Therefore, we should highlight that the LiDAR accuracy referred in the report was 10 cm. However, the processing and quality control of the LiDAR point cloud is unknown, namely the GCPs used for its calibration and the quality control method. Additionally, it is important to refer that the point clouds were not collected under the same conditions and around the same time. Therefore, it is possible to conclude that: •These point clouds have positional quality for this study, because the average of vertical errors (10.9 cm and 17.7 cm) is acceptable for the estimation of building fa¸cade height parameter. •The RMSEzvalues are lower than 20 cm. This level-accuracy affords us the necessary reliability to use this data for the extraction of building parameters. •The UAV point cloud is sparser and more irregular than the LiDAR point cloud based on the standard deviation value, which means that the automatic extraction of building parameters can be more difficult from the UAV point cloud. It is more difficult to establish a methodology that is able to cover all the standard irregularities when removing points that do not belong to building rooftop and ground. The following sections provide an overview of the usability of this data for the extraction of building parameters from different approaches. The objective is to look for answers through these approaches: a) What type of tools are effective for the extraction of building parameters from the perspective of an urban planner: FOSS or proprietary tools?;b) Is it possible to extract accurate building parameters solely from 3D point cloud data without accurate 2D/3D vector data acquired from stereo restitution?; and c) Is the 3D point cloud appropriate for the extraction of building parameters with an acceptable quality? If so, how can we integrate this data into urban planning? 2.2 Usability of LiDAR data for the extraction of building parameters The demonstration of the usage of 3D data from a LiDAR point cloud and 79 its potential shall be presented and discussed in this section. The main objective of this demonstration is to evaluate the level usability of a LiDAR Point Cloud in the following situations: i) automatic extraction of building height and roof outline for the generation of 3D building models with the ArcGIS LiDAR Analyst extension; ii) evaluation of LiDAR accuracy for the extraction of building parameters that involve the third dimension (building fa¸cade height and building volume) based on the development of a geoprocessing model; and iii) identification of the type of building rooftop from the pulse intensity of LiDAR, slope, point density, and elevation. 2.2.1 Evaluation of the automatic extraction of building parameters for the generation of 3D building models from a LiDAR point cloud: methodology and results The automatic extraction of buildings from a LiDAR point cloud, using all return points (first and last return), can be performed following three steps: 1) interpolating from point cloud to raster DSM; 2) creating raster DTM from DSM; and 3) extracting building features based on DSM, DTM and Normalized Digital Surface Model (NDSM)2and a set of building parameters software. The methodology developed for the building extraction was performed with the LIDAR Analyst. The flowchart of this automatic processing is shown in Figure 2.11. The methodology included two different approaches using a subset of parameters. In the first approach (Test 1) the buildings were extracted using the default parameters of the software. The second approach (Tests 2&3) was designed to improve the results of the first one by the introduction of two steps in the workflow: refining DSM and customizing a subset of extraction parameters. The refining of DSM is an essential task in this workflow. When performing building extraction, it is necessary to ensure a good quality of the DTM extracted from DSM, because the difference between them (NDSM) will yield the height of the buildings. If the DSM or DTM are built without any filtering, it will be more difficult to extract accurate building roof lines. Afterwards, the refining process for obtaining DTM (tests 2&3) was carried out by editing the DSM, removing cars and other objects near the buildings. 2NDSM is the difference between DSM and DTM and it gives the heights of objects on a surface. 80 Figure 2.11: Methodological approach for building extraction based on a LiDAR point cloud. Adapted from Rebelo & Tened´orio (2011a). The next step (Figure 2.11) is the extraction of building roof lines using a set of building parameters, which can be manipulated with a combination of different parameter values. The building parameters are the minimum building height, area range, slope for building roof, texture variance trees to differentiate between trees and buildings, and smoothing tolerance that defines the maximum distance a point can move in relation to its neighbouring vertices. First, the parameters used to define the boundaries of the buildings were changed by the minimum and maximum slope values. Then, the best values for this range were repeated for different values of the texture variance parameter used in the extraction. Table 2.6 shows three different combinations of parameter values within a set of several tests, whose results are illustrated in Figure 2.12. The selected tests (Table 2.6) defined two different approaches to extract building roofs: building blocks and isolated buildings or simply isolated buildings. Table 2.6: Parameters defined for extracting building blocks and isolated buildings Parameters Test 1 Test 2 Test 3 Do not remove buildings with area between 30-35000m230-35000m230-35000m2 Slope for building roofs (minimum-maximum) 15-40◦15-60◦40-80◦ Texture variance trees 80% 80% 90% Remove buildings lower height than 2 m 2 m 2 m Smoothing tolerance 2.2 m 2.2 m 2.2 m 81 For the definition of these parameter values we need to have a knowledge of the building types and the characteristics of the study area. Moreover, the usage of orthoimages is important to visualize the building roofs and evaluate the results of the roof lines extracted automatically. On the other hand, the visualization of trees and vegetation on orthoimages can help to define the parameter value of texture variance trees. The automatic extraction of building rooftops was based on the NDSM that is shown in Figures 2.12a and 2.12b. The overlapping of accurate building outlines and the NDSM (Figure 2.12c) shows that there are some residual differences along the boundaries of building rooftops. Figure 2.12: The source data used for the extraction of building roofs and the results acquired from different subset parameters. a) NDSM Hillshade; b) NDSM, where each pixel contains the height value of an object; c) NDSM with the overlap of accurate building outlines (reference data); d) Isolated building roofs extracted; e) Building blocks and isolated buildings extracted, where the NDSM was refined (Test 2); and f) Essentially, these are extracted building blocks, where the NDSM was refined (Test 3). The first approach to the extraction of isolated buildings (15 buildings extracted) showed difficulties in the acquisition of accurate rooftop lines, because these did not match the highest elevation values visible in the NDSM (white shaded areas in Figure 2.12d). However, the change in the slope parameter range value made the extraction of building blocks (Figures 2.12e,f) possible, with better orientation and a roof outline that is more consistent with the NDSM. 82 This extraction process implies the acquisition of specific building attributes that are calculated simultaneously, such as average building height, minimum/maximum building height values, building area, and roof type. The total building area obtained from accurate building roofs3is 3213 m2. The buildings extracted from tests 1 and 3 represent a total building area of 1986 m2and 4377 m2, which is equivalent to a 38% and 36% percentage of error, respectively. Furthermore, test 2 resulted in an estimated 3329 m2of total building area, with a percentage of error of about 3.6%. According to the presented results, test 2 has the best value for the total area of buildings, with an equivalent error of one building ( -115 m2). It is possible to compare one single building (red circle in Figure 2.12b) acquired from stereo restitution (building outlines) and the automatic roof line extracted from point cloud, with a density of 12 points/m2in the building roof areas (Figure 2.13). For this building, the difference between the building height obtained by topographic survey (6.4 m) and the average building height extracted from Li- DAR is of around 20 cm for test 1, -40 cm for test 2, and -50 cm for test 3. All these errors are acceptable because they are lower than the standard floor height. However, the building area extracted did not match the accurate building outline. Figure 2.13: Comparison between building roofs extracted from stereorestitution and automatically by LiDAR data. The generation of 3D building models without roof details, also called block model or LoD1 (according to Kolbe et al., 2005), can be easily done by extruding the footprint of each building roof to their average height (Figure 2.14). On the other hand, we can visualize rooftops classified into three types: complex, simple/flat, and pitched (Figure 2.14). The roof of each building was classified differently according to parameters defined along the automatic extraction process. When the roof extracted was characterized by medium slopes, the roof was classified 3Building roofs extracted from stereo restitution. 83 as pitched and when the slope was low, the roof was classified as flat (Figure 2.14). The complex roof type is the result of higher slopes, such as the buildings blocks extracted from different roof-type buildings. If the building roof is not accurately extracted (or if it does not represent the ‘real shape of the roof’), its classification by roof type or any other attribute can also be wrong. However, in all the tests the roof of the building represented in Figure 2.13 was well classified after the processing stage as simple/flat in accordance with the reality. Figure 2.14: 3D building model (LoD1) and accurate 2D vector data of building outlines. The types of roofs extracted are shown, as well as the visualization of the classification of four buildings on the 3D modeL (adapted from Tened´orio et al., 2013). This demonstration shows that the automatic extraction of building parameters from LiDAR can be a great advantage for the generation of 3D block models of buildings, by extruding the building area parameter (building polygons) to building fa¸cade height values. However, the complexity and diversity of buildings with irregular sizes and heterogeneous surface structures caused difficulties in the extraction of building rooftops, therefore bringing up some difficulties in the generation of 3D building models exclusively from LiDAR data. The LiDAR Analyst is not appropiated for this type of built-area, when there is high heterogeneity and complexity of building types, such as in Praia de Faro. The presence of this kind of complexity in an urban area makes it necessary to develop suitable methodologies for the extraction of building parameters (Section 2.3). 2.2.2 Evaluation of the LiDAR point cloud for the extraction of the building fa¸cade height parameter The main objective of this section is to demonstrate the level of usability or 84 relevance of a LiDAR point cloud for the extraction of building height and building volume. Additionally, as mentioned in the previous section, we should evaluate the accuracy level that a LiDAR point cloud should achieve to ensure the acquisition of accurate building heights and thus be useful for urban planning. This demonstration was based on the development of a methodology to evaluate the accuracy of building height parameters extracted from a LiDAR point cloud. Firstly, we presented the methodology used for the estimation of building parameters. Secondly, we will compute and analyze the estimated vertical errors of building fa¸cade height estimated, as well as the total error of building volumes. The methodology developed included a set of routine operations that have been automated and optimized, along geoprocessing models implemented in GIS and R statistical software environments. The reference data are also important for the development of this methodology, such as building outlines (2D-vector data) and accurate 3D points of the building rooftops (see Section 2.1). Therefore, the extraction of a ‘set of LiDAR points’ that defines the top of the building fa¸cade height (Figure 2.15) will be processed using the reference data. Figure 2.15: Flowchart for the extraction of building fa¸cade height and building volume from a LiDAR point cloud. The red lines in the workflow process correspond to the second part of the methodology. 85 The methodology for the extraction of building fa¸cade height was divided into three main parts (Figure 2.15): i) the extraction of the highest building fa¸cade elevation at the corner of the building; ii) the extraction of the building base elevation for the fa¸cade side that faces the public street; and iii) the end of this process is the computation of building fa¸cade height based on the difference between the highest elevation of the building fa¸cade and the base elevation of the building. The first part was the extraction of the highest elevation of the building fa¸cade, near a cornice, parapet, rooftop railing or corner of the building fa¸cade (Figure 2.16). Figure 2.16: Results of first part of the geoprocessing model. a) Buffering the building outline; b) Clustering the LiDAR points of the building using elevation; c) TIN facets with slope values; d) Selected 3D points that are contained in the TIN facets within slope range values condition; e) Selected k-cluster; f) 3D points within 80 cm distance from the reference 3D point. The following steps are followed at this stage (Figure 2.16): i) the selection of a set of LiDAR points contained within polygons which are generated by a buffer of 2-metre from accurate building outlines (see Figure 2.1) as shown in Figures 2.16a,b; ii) K-Means clustering (Hartigan & Wong, 1979) of LiDAR points (using clustTool library of R within ArcGIS) based on the elevation attribute. The objective was to delimitate the rooftops’ upper plan that defines the building by kclusters. The number of k-clusters depends on the building roof type; iii) determining the boundary of LiDAR points which best defines the highest plan of each building roof by selecting the ‘cluster and a range of slope values obtained from a Triangulated Irregular Network (TIN)’ condition. The selection of clusters was based on a visual inspection. Next, the slope values were calculated from a TIN facet polygons gen- 86 erated by LiDAR points clustered. Finally, the cluster points that are contained in each TIN facet with a slope between 0◦and 79◦were removed; and iv) computing the average and median values of selected LiDAR points, which are within 80 cm of the reference 3D point of the rooftop (which defines the highest point of the building fa¸cade). In the case of certain buildings, we had to change this value to 40 cm to reject points that were incorrectly classified as rooftop. The delimitation of all roof sections with different orthometric heights (Figures 2.16b,c) was achieved with clustering. However, the visual inspection was important to select the clusters that better represent each building rooftop. In Figure 2.16b the building is described by 4 clusters, but only the points that belong to cluster 2 (black points) are selected with a slope range between 80◦and 90◦(2.16d,e). Subsequently, the extraction of the base elevation building was divided into the following four main steps (Figure 2.17): i) The boundary of each building rooftop was designed by the LiDAR points selected in the first stage, through the convex hull (Figure 2.17a). The term convex hull used by Park & Oh (2012) means ‘the boundary of the minimal convex set containing a given non-empty finite set of points in the plane’; ii) The LiDAR points that are outside the convex hull polygon (‘outside LiDAR points’) within a buffer of 1 m from the boundary of the building polygon (‘base building area’) were selected (Figure 2.17b); iii) Afterwards, the ‘LiDAR ground points’ should be selected from ‘outside LiDAR points’ by a ‘range elevation values and range slope values’ condition. The condition was the 3D points with an elevation lower than 6 m and contained in a TIN facet with a slope between 0◦ and 17◦(Figure 2.17c); and finally iv) computing the average and median values of ‘LiDAR ground points’ selected from the following spatial selection condition: ‘LiDAR ground points’ that belong to the base building area and are at X distance value from edge road. The results of the second part of this methodology can be seen in Figure 2.17 for one building. The LiDAR ground points selected at the end of this process (Figure 2.17d) were used to calculate a median elevation or the average value that represents the base elevation of the building. The end of this process is the computation of building fa¸cade height based on the difference between the highest elevation of the building fa¸cade and building base elevation. The building volume was also computed for each building from the area of building outlines and building fa¸cade height estimated from 87 LiDAR. Figure 2.17: Results of the second part of the geoprocessing model - extraction of building base elevation. a) Building rooftop boundary from convex hull; b) One metre buffer from boundary of building rooftop; c) Lidar points outside the boundary; and d) LiDAR ground points selected for the estimation of building base elevation. The building fa¸cade height parameter for the building (Figures 2.16 and 2.17) was estimated at 6.27 m (median value). The vertical error in the estimation of this parameter was only 10 cm in relation to the reference value of 6.47 m. The evaluation of the building fa¸cade height parameter estimated for the 22 buildings of the study area was based on the difference between the reference building fa¸cade height and building fa¸cade height estimated from LiDAR, also called by vertical error. The following plots (Figure 2.18) show the vertical errors obtained for each building. The left plot shows the building fa¸cade height error achieved with median elevation values of building rooftop and base (Figure 2.18a), while the right plot is based on the average elevation values of the buildings. Figure 2.18: Distribution of building fa¸cade height errors by histograms, box and whisker plot. a) Median elevation of the selected LiDAR points; and b) Average elevation of the selected LiDAR points (adapted from Rebelo et al., 2012). 88 correlation (almost null) between the density of points per m2/slope and between point density/intensity; c) moderate negative relationship (Pearson r=−0.55) between slope and intensity; and d) moderate positive correlation (Pearson r= 0.47) between point density and orthometric height. Table 2.7: Statistical values of cluster sample obtained from LiDAR points Variables Average elevation Average intensity Average slope Average point density Average elevation 1 -0.34 0.37 0.47 Average intensity 1-0.55 -0.24 Average slope 1 0.15 Average point density 1 Sample of clusters (sub-objects): 30; Confidence level: 95% to p=0.05. Otherwise, if only similar clusters of building rooftops are selected (Figure 2.25) from a total of 30 extracted clusters (sub-objects), the negative correlation between slope and intensity variables increases to -0.77 for a small sample of 10 clusters. Figure 2.25: Building rooftops (orthoimage and building outlines) that have a correlation between intensity and slope: a) Orthoimage; b) Clusters; c) Building rooftops extracted from convex hull (adapted from Rebelo & Tened´orio, 2011b). The combination of the highest roof slopes (such as a terrace) and the highest 95 colour gradients resulting from the different materials used (red ceramics and white ceramics) will allow us to extract a set of building roof types pitched and contrasted by colour, material, or texture. 2.3 Testing and comparing the usability of Li- DAR and low cost UAV data for the extraction of building parameters using FOSS. The demonstration of the usability of a 3D point cloud for the extraction of building parameters without any other spatial reference data is the challenge proposed for this section. A higher level of automation in the acquisition of these building parameters using FOSS tools is also an objective of this demonstration, while simultaneously asserting the usability of this type of data in a ‘low-cost environment’. The usage of 3D point cloud data for the extraction of building parameters without reference data is the main objective of this case study. The need to obtain low-cost information about the territory with a higher degree of automation and updating has become a priority in this work. On the other hand, the combination of low-cost data with the development of a robust methodology based on FOSS tools is also a priority. The methodology developed for UAV or LiDAR point clouds has three main stages (Table 2.8). Table 2.8: Stages, tools, and data used in the methodology Stages Data Tools Extraction of the building elements (3D points): rooftop and ground 3D point cloud R, GRASS and PostgreSQL/PostGIS Computing building volume from building fa¸cade height and building area Extracted 3D points and building boundary PostgreSQL/PostGIS Evaluation of building parameters 2D and 3D reference data PostgreSQL/PostGIS The first stage included the development of a semi-automatic methodology to 96 identify the relevant 3D points that better describe each building from a ‘big volume of 3D data’. Part of this methodology implied the development of two algorithms in postgreSQL/PostGIS and R. The second stage included one algorithm to compute the volume of each building from 3D points extracted in first stage. Finally, the third stage consisted in the evaluation of all building parameters obtained from each point cloud data. In table 2.8 the data and tools used at each stage are detailed. This methodological solution composed by the three main stages earlier mentioned was developed for this case study. We called it 3D Extraction Building Parameters –3DEBP, which will allow the extraction of building parameters using any 3D point cloud. The following subsections will describe each step of this 3DEBP solution. 2.3.1 Extraction of building elements from a 3D point cloud The first part of the methodology developed for the extraction of building parameters from each point cloud was based on the following assumptions: i) extracting building parameters without accurate vector data, only a 3D point cloud should be used; and ii) using FOSS tools to implement a robust methodology for the acquisition of these parameters. First, it is important to define which building parameters are involved in estimating building volume (Section 2.3.2) and then how to extract them from a 3D point cloud. The parameters are: i) building fa¸cade height, which is the difference between mean elevation of the top building boundary (these are approximately the points that define the eave or parapets of the rooftop) and the mean elevation of the ground near the building. The fa¸cade side of the building that faces the public street was chosen to compute this parameter; and ii) area, which is defined from the building fa¸cade height boundary, which is equivalent to the building roof area. The methodology developed for each point cloud data included the following steps (Figure 2.26): i) selection of the set of points from point cloud that represents the building roofs. This filtering applied to the point cloud was performed by Clustering LARge Applications (CLARA) algorithm, which is implemented in the RCLUSTER library; ii) extraction of the building roof area was based on the generation of polygons from the points selected above, using the concave hull algorithm implemented in GRASS 7; these polygons represent the building roof area; and iii) selection of the set of points that represent top and ground building fa¸cade using 97 spatial analysis functions. Figure 2.26: 3DEBP methodological approach for the extraction of building area, fa¸cade height, and volume from a 3D point cloud based on a FOSS solution (adapted from Rebelo et al., 2015). All the steps above have been implemented in three algorithms for the automation of the methodology. The algorithms were developed using R programming language (CLARA algorithm) and SQL language in a GDBMS environment implemented using PostgreSQL/PostGIS for the steps i) and iii) mentioned above. Point cloud clustering Kaufman & Rousseeuw (1990, p.14) say that the clustering ‘wants to form groups in such a way that objects in the same group are similar to each other, whereas objects in different groups are as dissimilar as possible’. Clustering in an object-oriented environment was the solution chosen to filter building points from ‘big data’. However, the clustering algorithm should also be able to process big data. Among a variety of clustering algorithms implemented in the RCLUSTER library, the CLARA (RCLARA) algorithm is suitable for clustering large datasets as point cloud data. The CLARA algorithm was especially developed to deal with large applications (Kaufman & Rousseeuw, 1986). This algorithm consists in a partitioning of a dataset into k-clusters (or k-groups) that show a high degree of similarity, 98 around krepresentative objects also called the k-medoids of the cluster (Kaufman & Rousseeuw, 1990). The requirements of a partition method are: a) each cluster must have at least one object; and b) each object must belong to exactly one cluster. The use of CLARA for clustering the point cloud was carried out following two steps: a) a sample was drawn from the point cloud and clustered into ksubsets, which also gives k-medoids; and 2) each object that did not belong to the sample was assigned to the nearest of the representative objects (also called k-medoids). These two steps are based on the computation of the average distance between each object and its representative object, which represents a measure of the quality of the clustering. After all the ssamples have been drawn and clustered, we selected the one for which the lowest average distance was obtained. The dataset point cloud is represented by a matrix of millions of 3D points (objects), where each point is an object identified by three spatial variables (x, y, z) that belong to a spatial entity (buildings, ground, ...). The n-rows correspond to the objects (3D points) and the columns correspond to the spatial variables x, y and z. n objects of a point cloud = varx vary varz          x11 x12 x13 x21 x22 x23 . . .. . .. . . . . .. . .. . . xn1xn2xn3          (2.2) The methodological approach for this study is to cluster the point cloud into groups (k-clusters) that are similar: ‘non-building points’ and ‘building points’. This clustering was performed using the spatial variable z, because it allows a rough identification of the ground and non-ground points. Then, the clustered point cloud will be represented by a vector PC ={x13, x23, x33, ...xn3}. According to the nature of the objects present in the point cloud, the clustering process for each point cloud was performed for k(number of clusters) values between 2 (kmin) and 10 (kmax). This part of the clustering process was done by the following algorithm as shown in Listing 2.1 developed by Maechler (2015, p.15), which allows to generate the silhouette plots for each k-cluster that we will see later. 99 Listing 2.1: Clustering for k-clusters (kmin and kmax) l i b r a r y ( c l u s t e r ) kmin <−2 kmax <−10 s<−100 c10 <−c ( ” t o m a t o ” , ” f o r e s t g r e e n ” , ” d a r k b l u e ” , ” p u r p l e 2 ” , ” g o l d e n r o d 4 ” , ” g r a y 2 0 ” , ” r e d ” , ” y e l l o w ” , ” b l u e ” , ” g r e e n ” ) f o r ( k i n kmin : kmax ) { p l o t ( s i l h o u e t t e ( c l a r a ( z , k=k , m e t r i c =” e u c l i d e a n ” , s a m p l e s =s ) ) , main = p a s t e ( ” k = ” , k ) , do . n . k=FALSE , c o l = c 1 0 [ 1 : k ] ) } However, the sparameter4related to the number of samples used in the clustering process ranged between 10 (s) and 100 (smax) should be chosen. Listing 2.25allowed us to verify the best svalue, which is developed by Maechler (2015, p.15). Thus, if the results between the minimum and maximum svalues are equal, then the minimum value sis enough for the clustering process (Listing 2.2). Listing 2.2: Verification of clustering for s between 10 to 100 s<−10 smax<−100 clx10 <−c l a r a ( z , k , s a m p l e s =s ) c l . 1 0 <−c l a r a ( z , k , s a m p l e s=smax ) s t o p i f n o t ( c l . 1 0 $ c l u s t e r i n g == c l x 1 0 $ clustering ) The evaluation of the clustering results obtained from the CLARA algorithm was performed by a graphical representation called silhouettes. The silhouette plots were obtained for each clustering process, which was implemented in R statistical software. The silhouettes are represented in a single diagram and each silhouette shows which objects lie well within one cluster (Kaufman & Rousseeuw, 1990). The silhouettes are very useful to analyse and compare the different clusterings obtained along this stage and it allowed us to choose the best result. Each silhouette that represents all the clusters within a k-cluster processing allows us to choose the best clusters that represent the buildings. The best k-cluster should have an average similarity close to one. 4In this study the first value tested was s= 10. 5If the result was false, it implies that clustering results are the same for sand smax. 100 Following Kaufman & Rousseeuw (1990), two statistical measures were obtained at the end of the clustering process, where they are presented in each silhouette plot: a) Average silhouette width of one cluster siand b)Average silhouette width for clustering sk. These two statistical measures summarize the quality of the results obtained for each clustering. These two parameters are described below: •Average silhouette width of one cluster si s(i) allows us to evaluate how well object iwas matched with the cluster (Kaufman & Rousseeuw, 1990). siis given by the following equation: s(i) = b(i)−a(i) max(a(i), b(i)),−1≤s(i)≤1 (2.3) where, a(i) is the average dissimilarity of object ifrom all the other objects of a cluster Aand b(i) corresponds to the smallest value of d(i, C) computed for all clusters C6=A.b(i) is given by the following equation b(i) = min d(i, C), C 6=A(2.4) where, d(i, C) is the average dissimilarity of ifrom all objects of any cluster Cdifferent from cluster A. The interpretation of siis seen in Table 2.9 (Kaufman & Rousseeuw, 1990, p.85): Table 2.9: Interpretation of s(i) values obtained for each cluster s(i) Description close to 1 object iis ‘well clustered’ and has been assigned to an appropriate cluster. close to 0 object ishould lie between two clusters. This is an ‘intermediate case’, where it is not clear what cluster object ihas been assigned. close to -1 object ihas been ‘misclassified’. Probably object i was placed in the wrong cluster. Furthermore, the silhouette plot shows the average of sifor all objects ithat belong to a cluster called ‘average silhouette width of one cluster’. 101 •Average silhouette width of clustering sk The most difficult decision is to choose the ‘most appropriate’ value of k in a cluster analysis problem, because for the same problem there may be several solutions. The latter parameter which represents the average of sifor i= 1,2, ...n is denoted by sk. This parameter should be chosen as high as possible among a set of clustering results for the entire data set. According to Kaufman & Rousseeuw (1990, p.88) an approximation for the interpretation of ‘average silhouette width’ based on silhouette plot can be seen in Table 2.10 below: Table 2.10: Interpretation of Average silhouette width for clustering (Kaufman & Rousseeuw, 1990, p.88) sk Interpretation of the clustering structure 0.71-1.0 strong 0.51-0.7 reasonable 0.26-0.5 weak <0.25 not significant The appropriate number of k-clusters for the point clouds of this case study ranged from 2 to 10. Subsequently, the algorithm was run between these values where the silhouette plots were also generated, as detailed in Listing 2.1. A visual analysis of the silhouette plots helps us to understand what the best k for clustering buildings is. Kaufman & Rousseeuw (1990, p.96) say ‘(...) we want the silhouettes to be as wide (or as dark) as possible.’ The wider the representation of the silhouettes for a k-cluster, the larger the degree of similarity in that cluster shall be. After computing the silhouette plot of a clustering into k-values ranging from 2 to 10, the next step is to choose the ‘best’ number of kfor this dataset by meeting the following conditions: a) large average sivalues, as close to 1 as possible and without negative average si; b) highest value for average silhouette width [sk]; and c) highest average s(i) values for clusters that represent buildings. The chart on the left in Figures 2.27, 2.28, and 2.29 shows the silhouettes for the best clustering results into k=2 clusters of the UAV point cloud data and k=10 clusters of each point cloud data (LiDAR or UAV). These silhouettes were chosen based on the criteria above. The silhouette contains on the rightmost columns the index of each cluster [j], the neighbour of each cluster [nj] and an average silhouette width of each cluster [avei∈Cjs(i)]. The average silhouette width of clustering value 102 appears below the plot [sk]. The silhouetes plotted allowed us to do an empirical analysis of the clustering structure. In general, some clusters are more divided in case of higher kvalues. On the other hand, the size of the samples ndepends on the number of clusters and it is given by 40 + 2k(Kaufman & Rousseeuw, 1990, p.145). Then for a clustering process defined as k=10 clusters (Figures 2.27 and 2.29) the size of the sample is 60. Lastly, the right images of these figures show the clusters of the 3D point cloud and the selection of clusters that only represent the buildings. Figure 2.27: Silhouette plot for LiDAR point cloud clusters (k=10) The LiDAR point clustering for k=10 clusters (Figure 2.27) obtained an average silhouette width of 0.66. For this sample, only 4 clusters represent the buildings, where the average siranges between 0.59 to 0.90. These sivalues mean that these clusters are well clustered. However in cluster 7, there are some built structures that are not considered for this study, such street caf´es. After computing the silhouette plot for the UAV point cloud, we found that there were two appropriate number of k-clusters k=2 and k=10 for this data set. Both were used for the extraction of building heights to compare with the performance of slightly different clusterings. However, the clustering for k=2 seems better than k=10, because it identifies the objects that belong to the buildings and ‘not buildings’ with only 2 clusters. The UAV point cloud silhouettes resulting from a number of clusters k=2 103 (Figure 2.28) have a strong clustering structure (0.82), where the clusters are more compact and clearly separated unlike k=10. The clustering structure for the UAV point cloud is worse for k=10 (0.59), where the clusters obtained from the UAV point cloud are more divided when compared with the number of clusters (Figure 2.29). Also, the clusters that represent buildings have narrower silhouettes. Figure 2.28: Silhouette plot for UAV point cloud clusters (k=2). Figure 2.29: Silhouette plot for UAV point cloud clusters (k=10). On the other hand, for the same number of clusters k=10, the clustering 104 Figure 2.33: Extraction of ground points along one side of the building: a) The main steps of the first part of the methodology and the results for one building obtained in each step; b) Filtering 3D points extracted in the first part to remove 3D points of the balcony and building structure represented on the right side of the figure. However, along this part of the methodology we had to develop another algorithm in R (Figure 2.33, step 2) to filter the extracted ground 3D points (see Appendix E). This filtering is intended to remove the ‘wrong points’ that do not 111 belong to the ground near the building. The filtering algorithm was adapted from the algorithm used in the clustering process. Then, this filtering was performed using CLARA from the cluster library based on the zvariable of the point cloud. Depending on the number of spikes of empirical density functions for the variable zof the extracted points, the number of k-clusters were chosen by ked given by Equation 2.5: ked = n º of spikes kernel density curve + 1 (2.5) Finally, the standard deviation measure [σz] for the set of 3D points that belong to each cluster was analysed, where the clusters with [σz] higher than one were removed. In the example above the k-cluster chosen to filter the set of clustered LiDAR points was k=2. The standard deviation value for k=2 was higher than 1 (σz= 2.7) and for k=1 it was σz= 0.3. Subsequently, the points that belonged to cluster k=2 were removed. The 3D view of these points can be seen in Figure 2.33, where the removed points belong to balconies and building structures. Figure 2.34: Results for the first stage of the methodology: clustering, concave hull and extraction of 3D points that represent each building (adapted from Rebelo et al., 2015). 112 All the building elements obtained from the clusted UAV point cloud and LiDAR point cloud can be seen in Figure 2.34. These elements are the 3D rooftop points, the boundary of the building rooftop (polygon), the 3D points of the roof edges, and the ground points of one side of the building. The elements shown in Figure 2.34 were then used to calculate the building volume. The elevation mean (or median) of the set of extracted 3D points was used to calculate the building height parameter and the boundary of the building rooftop to calculate the building area parameter. The next section will describe this process. However, there were two buildings that were not separately extracted from UAV point cloud to k=10 (UAVk10). These buildings were removed and therefore their building volume was not calculated. 2.3.2 Building volume and total volumetric parameters The second stage of the 3DEBP mentioned at the beginning of this Section 2.3. (Table 2.8) reggarding the calculation of building volume was performed automatically. To compute this building parameter we developed a SQL algorithm Building vol in a GDBMS environment using PostgreSQL/PostGIS. The building volume parameter was obtained from the multiplication of the building fa¸cade height by the area of the building rooftop. The building fa¸cade height parameter was calculated from the statistical average (or median) values of the previously selected 3D points mentioned above (Figure 2.35). Figure 2.35: Building fa¸cade height parameter. The high heterogeneity present in the typology of the buildings makes it difficult to decide which statistical measure is more suitable. Depending on the typology of a building we would expect to have a good knowledge on the use of the average and median measures for this type of applications. Hence, it is important 113 to test it in this study. Therefore, the methodology applied to calculate the building fa¸cade height took into account these median and average measures of the roof eave and base of the building. An important implementation for the optimization of this step was the integration of R into PostGIS/PostgreSQL by PL/R – R procedural language. Part of the algorithm developed for the computation of average and median elevation of roof eave (or base the building) for each building is presented below in Listing 2.4. The r median function PL/R implemented was developed by Conway (2012). Listing 2.4: Compute average and median elevation of eave roof CREATE o r REPLACE f u n c t i o n r m e d i a n ( f l o a t 8 ) r e t u r n s f l o a t a s ’ m e di a n ( a r g 1 ) ’ l a n g u a g e ’ p l r ’ ; CREATE AGGREGATE me di a n ( s f u n c = p l r a r r a y a c c u m , b a s e t y p e = f l o a t 8 , s t y p e = f l o a t 8 , f i n a l f u n c = r m e d i a n ) ; CREATE t a b l e ” A V G e l e v a t i o n r o o f p o i n t s ” a s SELECT i d b u i l d i n g , s t u n i o n ( geom ) a s t h e g e o m , count ( * ) a s n p o i n t s t , \ * t o t a l o f p o i n t s sum ( z ) a s s u m z t o p me d ia n ( z ) a s m e d i a n z t o p FROM ” r o o f t o p p o i n t s ” g r o u p by i d b u i l d i n g ; ALTER table ”AVG elevation roof points” ADD c o l u m n m e a n z t o p d o u b l e p r e c i s i o n ; UPDATE ”AVG elevation roof points” SET m e a n z t o p = s u m z t o p / n p o i n t s t ; The algorithm we developed (Listings 2.5 and 2.6) followed three main steps as can be seen in Figure 2.36: a) calculating the building area from the geometry previously extracted from the concave hull process (boundary of the building rooftop). The area (areacloud) was computed by using the PostGIS function ST area; b) calculating the building fa¸cade height (hfmeancloud) from the difference between 114 average elevation (or median) of the roof eave (meanztop) and ground (meanzpav) as shown in Figure 2.35; and c) calculating the building volume from the parameters computed in a) and b) (Figure 2.35). Figure 2.36: Parameters involved in the computation of building volume, which represent the three steps included in Building vol.sql algorithm. Part of the algorithm we developed that represents the figure above, can be seen in the following Listings 2.5 and 2.6. Listing 2.5: Compute Building rooftop area (areacloud) and Building Fa¸cade Height (BFH) using average −−Compute t h e B u i l d i n g Area P a r a m e t e r CREATE t a b l e ” a r e a ” a s s e l e c t * FROM out concavehull ; ALTER t a b l e ” a r e a ” ADD c ol u mn a r e a c l o u d d o u b l e p r e c i s i o n ; UPDATE ” a r e a ” SET a r e a c l o u d = s t a r e a ( t h e g e o m ) ; −−Compute t h e a v e r a g e B u i l d i n g f a c a d e H e i g h t ( BFH) f r o m 3D p o i n t s −− i d b u i l d i n g : c o d e o f b u i l d i n g ; t h e g e o m : A t t r i b u t e o f g e o m e t r y CREATE t a b l e ”BFH” a s s e l e c t i d b u i l d i n g , t h e g e o m , meanztop , meanzpa v FROM ” B u i l d i n g E l e m e n t s ” ; ALTER t a b l e ”BFH” ADD c ol u mn h f m e a n c l o u d d o u b l e p r e c i s i o n ; UPDATE ”BFH” SET h f m e a n c l o u d= meanztop −meanzpav ; Listing 2.6 below shows the algorithm used to calculate the building volume and the total volume parameters. The latter is the sum of all the building volumes included in a bounded area. 115 Listing 2.6: Computing Building Volume (BV) −−C om pu t in g B u i l d i n g Volume ( v o l m e a n c l o u d ) CREATE t a b l e ” vo lu me ” a s s e l e c t i d b u i l d i n g , geom , a r e a c l o u d , m eanztop , meanzpav , h f m e a n c l o u d FROM ” BFH are a ” ; ALTER t a b l e ” vo lu me ” ADD c ol u mn v o l m e a n c l o u d d o u b l e p r e c i s i o n ; UPDATE ” v o l u m e ” SET v o l m e a n c l o u d = h f m e a n c l o u d * areacloud ; −−Compute T o t a l Volume SELECT sum ( v o l m e a n c l o u d ) FROM ” v o l u m e ” ; This algorithm calculates the buildings volume and the total volume of all the buildings included in the study area within a few seconds. The building volume parameter was estimated for 19 buildings, where the code assigned to them is shown in Figure 2.37. Figure 2.37: Buildings included in the case study with the adopted ‘ED’ code. The building volumes computed from each set of extracted building elements are shown in Tables 2.12, 2.13 and 2.14. Each table of results is based on specific point cloud clustering, where the building volume (BV) parameter was twice computed based on different statistical measures (average or median) of building fa¸cade height (BFH). The building parameters presented in these tables are rounded, where the building volume values 116 reported here resulted from an algorithm with more precise values. The difference recorded between the average or median for the building fa¸cade height was less than 0.8 m, with the highest value obtained for building 3 (Table 2.12). On the other hand, the average of these difference values was 0.3 m. The building fa¸cade height parameter estimated ranged approximately between 4 m and 8 m. Furthermore, the differences in building volume calculated from both measures ranged approximately between 10 m3(buildings ED18 and ED7) and 333 m3(building ED1 2). Table 2.12: Building Volume [BV] estimated from a LiDAR point cloud Code Area (m2) BF Have (m) BVave (m3) BF Hmed (m) BVmed (m3) ED1 2 1001.146 5.576 5583 5.910 5917 ED3 126.088 5.195 655 6.010 758 ED4 256.813 7.488 1923 7.810 2006 ED5 204.733 6.374 1305 5.700 1167 ED6 116.147 4.186 486 3.860 448 ED7 147.377 6.423 947 6.490 956 ED8 198.620 6.317 1255 6.470 1285 ED9 16 308.251 6.504 2005 6.070 1871 ED10 158.464 6.561 1040 6.700 1062 ED11 138.611 4.280 593 3.770 523 ED12 178.366 6.397 1141 6.980 1245 ED13 115.155 6.576 757 6.840 788 ED14 155.774 6.543 1019 6.170 961 ED15 209.927 6.406 1345 6.570 1379 ED17 84.397 6.849 578 6.650 561 ED18 74.935 4.923 369 5.050 378 ED19 128.109 6.033 773 6.170 790 Maximum 1001.146 7.488 5583 7.810 5917 Minimum 74.935 4.186 369 3.770 378 Average 211.936 6.037 1281 6.072 1300 Total Volume m321773 22096 According to Table 2.13, the results recorded for the k=2 UAV point cloud (UAVk2) are similar to LiDAR’s, where the difference between building height estimated from median and average is approximately 0.35 m on average. This parameter approximately ranged between 3.5 m and 9.5 m. On the other hand, the differences in the building volume parameter ranged approximately between 2 m3(building ED11) and 840 m3(building ED9 16). The results obtained for the k=10 UAV point cloud (UAVk10) using the median and average (Table 2.14) show more sensitivity in the estimation of building parameters, because the differences between them are greater than the other results 117 above. The difference between building height estimated from median and average is approximately 0.64 m on average. The differences in the building volume parameter ranged between 9.7 m3(building ED6) and 1015 m3(building ED9 16). The range of building fa¸cade height estimated from UAVk10 is very similar to the results obtained for UAVk2. Table 2.13: Building Volume [BV] estimated from a k= 2 UAV point cloud cluster Code Area (m2) BF Have (m) BVave (m3) BF Hmed (m) BVmed (m3) ED1 2 814.114 5.470 4453 5.271 4291 ED3 154.085 6.646 1024 7.257 1118 ED4 248.319 7.078 1758 7.535 1871 ED5 159.265 9.449 1505 10.182 1622 ED6 138.727 3.647 506 3.509 487 ED7 129.201 6.176 798 6.330 818 ED8 192.586 6.230 1200 6.362 1225 ED9 16 385.950 9.168 3538 11.346 4379 ED10 148.585 6.615 983 6.718 998 ED11 136.879 3.606 494 3.598 492 ED12 113.101 8.651 978 9.307 1053 ED13 77.459 6.652 515 6.735 522 ED14 152.421 6.257 954 5.996 914 ED15 152.507 6.715 1024 6.628 1011 ED17 74.370 5.782 430 5.890 438 ED18 80.849 4.024 325 3.733 302 ED19 224.253 6.544 1467 6.567 1473 Maximum 814.114 9.449 4453 11.346 4379 Minimum 74.370 3.606 325 3.509 302 Average 198.981 6.395 1291 6.645 1354 Total Volume m321952 23013 The total volume estimated from the LiDAR point cloud for the study area is approximately 22000 m3using median or average building height (Table 2.12). The difference recorded between these two values estimated is about 1.5% of the total volume estimated. However, for the UAV point clouds this difference is higher than LiDAR’s, where for UAVk2 and UAVk10 it is about 5% and 10%, respectively. The application of average or median to the estimation of BFH seems to be more suitable for a LiDAR point cloud, where any measure (median or average) can be applied. In this case the difference for the estimated building heights (average values) was 3.4 cm and between the average volumes estimated it was 19 m3. However, for the UAV point cloud, the scenario is different, because it was more sensitive to these measures, where the differences between them were higher. The average values between median and average building heights or building volumes were particularly different in the case of UAVk10. 118 Table 2.14: Building Volume [BV] estimated from k= 10 UAV point cloud cluster Code Area (m2) BF Have (m) BVave (m3) BF Hmed (m) BVmed (m3) ED1 2 939.429 6.277 5896 6.930 6510 ED3 157.594 6.141 968 6.730 1061 ED4 249.351 7.008 1747 7.530 1878 ED5 161.844 9.530 1542 10.210 1652 ED6 189.744 3.491 662 3.440 653 ED7 143.414 5.818 834 6.460 926 ED8 200.223 6.115 1224 6.350 1271 ED9 16 428.560 8.972 3845 11.340 4860 ED10 198.783 5.853 1163 6.690 1330 ED13 79.778 6.559 523 6.720 536 ED14 186.406 4.344 810 3.820 712 ED15 155.695 6.583 1025 6.720 1046 ED17 123.410 4.300 531 3.540 437 ED18 122.088 4.275 522 3.940 481 ED19 178.308 5.502 981 6.550 1168 Maximum 939.429 9.530 5896 11.340 6510 Minimum 79.778 3.491 522 3.440 437 Average 234.308 6.051 1485 6.465 1635 Total Volume m322275 24521 The average of building volumes estimated from LiDAR or UAVk2 was more similar. The 3D visualization of the buildings based on building parameters estimated from LiDAR and UAVk2 point clouds using average is shown in Figure 2.38. Figure 2.38: 3D visualization of buildings estimated from LiDAR or UAVk2 point clouds. 119 The application of this data extracted for the 3D visualization of the buildings can be very useful for an urban planner (Figure 2.38). The impact of the building parameter errors in the 3D visualization is irrelevant for the detection of a built-up area or for public discussion (Figure 2.38). This means that the buildings extracted from UAV or LiDAR are very similar to the reference 3D building models, especially if they are enhanced. In comparing UAV/LiDAR with the reference volumes it is possible to see that the 3D building model of UAV is more filled in red (reference color), which means that the volumes of these building models were mostly underestimated. However, it is important to assess the quality of the building parameters estimated and presented in the tables above if we need another type of applications with this 3D visualization. The measurement of the magnitude of error for the building parameters estimated by the implemented 3DEBP solution will be disclosed in the next subsection. This issue is important to understand the level of usability of these estimated parameters for urban planning, such as 3D visualization. 2.3.3 Evaluation of the estimated building parameters The building parameters estimated for this particular built-up area require an evaluation that allows to analyze : a) the magnitude of error for each building parameter estimated compared with other data that was acquired by traditional and more accurate methods, and b) the accuracy and performance of the 3DEBP methodology we have developed. The magnitude of errors is mainly dependent on the characteristics of the buildings types. Furthermore, it is also dependent on the performance of the methodology in the extraction of building elements from heterogenous spatial distribution of data points for different types of buildings. Among all the parameters, the extraction of the building area parameter with quality from any point cloud was the most difficult operation inside in the scope of this study. Along the extraction of the building area parameter we collected some polygons that did not represent the rooftop building boundary. One of the reasons for this is the fact that the original data does not cover the whole building rooftop. An example of this was the fact that the building rooftop of ED1 2 was not fully covered by UAV point cloud, such as shown in Figure 2.34 for clustering results. 120 Table 2.16: Building height error estimated from 3D point clouds Measure of Building Height Dataset Average (m) Median (m) Maximum (m) Minimum (m) Standard Deviation (m) UAVk2 0.61 0.51 1.43 0.01 0.43 Average UAVk10 0.90 0.59 2.40 0.24 0.75 LiDAR 0.80 0.80 3.45 0.002 0.84 UAVk2 0.89 0.68 3.92 0.08 0.92 Median UAVk10 1.05 0.74 3.91 0.04 1.22 LiDAR 0.77 0.66 4.12 0.02 0.95 Furthermore, the empirical density functions of each point cloud in the estimation of the building fa¸cade height parameter are very similar (Figure 2.44) as expected by the values shown in Table 2.16. Most values were overestimated by LiDAR and UAVk2. Once again, these plots confirm that the usage of the average measure for the UAV point cloud is better, since the estimated curve of UAV data is a slightly better approximation to their true values. Figure 2.44: Empirical density functions: true building fa¸cade height curve and the building fa¸cade height estimated for all the point clouds based on average and median. The comparison between estimated curves for LiDAR data in these plots shows that the curve of the median measure is slightly better adjusted to the reference curve between 3 m and 5 m, unlike the curve of the average measure. Most building fa¸cade height (about 45% of the buildings) extracted from these sampling of point clouds was estimated with a vertical error below 0.5 m. On the other hand, for the best results of UAVk2 (average) and LiDAR (median) about 80% of vertical errors were below 1 m. Furthermore, there is an evidence that the median and average measures used in the extraction of this building parameter are more appropriate for LiDAR and UAV, respectively. 127 Building Volume The definition of building volume is established by the product of the two independent variables – building area and building height. The magnitude of the building volume error is dependent on the error obtained in the estimation of each variable. The evaluation of each estimated building volume was based on absolute and relative errors. The absolute error is the difference between the values of reference building volume [VRef ] and estimated building volume [VE]. The relative building volume error is given by the ratio of absolute error and reference building volume, such as the following equation: BVerror(%) = VRef −VE VRef ×100 (2.8) where VRef is the multiplication of the building area BARef by building height BHRef obtained from more accurate techniques. The estimation of building volume was carried out in two ways: 1. The estimated building volume was computed from the following parameter values: building area acquired by more accurate traditional techniques of 2D vector data acquisition (stereo restitution) noted by BARef ; and building height [BHE] was estimated from point cloud data. Hence, Equation 2.9 can be written: BVerrorT ypeI (%) = VRef −(BHE×BARef ) VRef ×100 (2.9) 2. The building volume estimated was computed from the building area [BAE] and building height [BHE] both estimated from point cloud data. BVerrorT ypeII (%) = VRef −(BHE×BAE) VRef ×100 (2.10) These results were obtained automatically based on values acquired from Listing 2.6 presented in Subsection 2.3.2, through the following algorithm (Listing 2.7) using the equations above. 128 Listing 2.7: Computing the relative building volume error using BH average (for BH median replace mean by median) −−INPUT : t a b l e ” b u i l d i n g s r e f a l l ” a b o u t r e f e r e n c e d a t a and t a b l e ” v ol um e ” e x p o s e d i n l i s t i n g 3 . 6 −− J o i n t h e s e t a b l e s by a t t r i b u t e i d c o d e and i d b u i l d i n g ( c o d e o f b u i l d i n g ) CREATE t a b l e e r r o r v o l u m e s a s SELECT v o l u m e . i d b u i l d i n g , v o l u m e . geom , v ol u me . a r e a c l o u d , v o lu m e . h f m e a n c l o u d , v o l u m e . v o l m e a n c l o u d , b u i l d i n g s r e f a l l . r e f a r e a , buildingsrefall .hfrefmean , buildingsrefall .volrefmean FROM b u i l d i n g s r e f a l l , v o l u m e LEFT OUTER JOIN v o l u m e on b u i l d i n g s r e f a l l . i d c o d e = v ol um e . i d b u i l d i n g ; ALTER t a b l e e r r o r v o l u m e s ADD c ol u mn ( v o l r e f m e a n c l o u d d o u b l e p r e c i s i o n , −−B V e r r o r ( Type I ) E r r o r B V t y p e I p e r c d o u b l e p r e c i s i o n , −−B V e r r o r ( Type I I ) E r r o r B V t y p e I I p e r c d o u b l e p r e c i s i o n ) ; UPDATE e r r o r v o l u m e s SET v o l r e f m e a n c l o u d = h f m e a n c l o u d * r e f a r e a , E r r o r B V t y p e I p e r c =(( v o l r e f m e a n −volrefmeancloud ) /volrefmean ) * 1 0 0 , E r r o r B V t y p e I I p e r c =(( v o l r e f m e a n −volmeancloud ) /volrefmean ) * 100; The analysis performed for the building volume parameter was important to measure the level of usability of this type of 3D data in urban planning, without reference data (Equation 2.10) or simply using 3D data for the estimation of the building height parameter (Equation 2.9). Then, we started by analysing the magnitude of the percentage of error for the estimated building volume. In order to do this, we conducted two analyses: one based on the reference building area and the other based on the building area extracted from the point cloud. 129 Building Volume (using only the 3D point cloud for the estimation of BH) For this case the building volume estimated is dependent on the error of building height extracted from point cloud. According to average and median building height estimated, Figure 2.45 shows the relative building volume errors for each building. Figure 2.45: Relative building volume error obtained for the building volumes estimated from reference building area. The vertical error of the building height is also represented for each building. The range of relative error is lower for the building volumes estimated from the average measure applied for BH. The best range of relative errors was obtained for the UAVk2 sample, which varies between 0.3% and 16.8%. Moreover, around 45% of the building volumes estimated from this point cloud have a relative error lower than 5%, unlike UAVk10 and LiDAR. As the building height error increases, the higher will the error percentage for building volume (Figure 2.45) be. Then, the Pearson product-moment correlation coefficient (Table 2.17), r, for a confidence level of 95% was calculated for these two variables. 130 Table 2.17: Pearson correlation coefficient (r) for all the results presented in Figure 2.45 Errors BVLiDAR BVUAV k2BVUAV k10 BHaverage r= 0.93 r=0.95 r=0.98 BHmedian r= 0.94 r=0.98 r=0.99 For instance, the Pearson correlation between the absolute building height error and the percentage of building volume error is very high because there appears to be a positive relationship between them. Therefore, the Pearson correlation value is slightly higher for the building height estimated with the median statistical measure (Table 2.17). Comparing the building fa¸cade height errors with the building volume errors computed with reference area (Figure 2.45) we can identify four situations behind this correlation: a) a vertical error in the estimation of building height up to 7 cm implies an error in volume under 1%; b) a vertical error up to 50 cm means an error in volume under 8% (Figure 2.46); and c) a vertical error up to 1 m implies an error in building volume under 15%; and d) a vertical error between 1-2 m results in an error of building volume that ranges between 15% and 25%. Figure 2.46: Volume of buildings 7 and 8 with the representation of BH error (also called vertical error). Additionally, the errors obtained in the estimation of BV are similar using average or median building height (Table 2.18). The statistical values obtained from 131 UAV are better for average BH based on the evaluation of average and standard deviation statistical error. The building volume estimated from LiDAR is slighty better if the building height is estimated from the median measure, because around 60% of the buildings have a relative error that is lower than 10%, whose average of percentage error was 10.8% (Table 2.18). On the other hand, more than 20% of the buildings have an error under 10%, unlike the average measure used for building height (Figure 2.45). However, this point cloud has more estimated building volume (2 more buildings) with a relative error lower than 5% for average BH. Table 2.18: Statistical measures of Relative Building Volume error (%) obtained for the building volumes estimated from reference building area BV Parameter point cloud Average Median Min Max Standard Deviation BH(average) UAVk2 8.8 8.6 0.3 16.8 5.4 *BARef UAVk10 13.2 9.2 2.9 35.8 10.6 LiDAR 11.2 11.9 0.05 35.1 9.55 BH(median) UAVk2 13.2 11.2 1.2 52.7 12.3 *BARef UAVk10 15.5 11.4 0.5 52.6 17.5 LiDAR 10.8 8.2 0.4 41.9 10.4 Nevertheless, UAVk2 (BH average) has the best results of all the samples, whose average of error is the lowest when compared with the other samples and the maximum error is about 17%. The maximum error for all the UAVk2 (or UAVk10) samples in the estimation of building volume was about 53% for the same building (ED9 16). The maximum errors from LiDAR correspond to the estimated volume of building ED5, which also had the maximum error for building height. In Figure 2.47, we can see the behaviour of building volumes estimated from the UAVk2 and LiDAR point clouds based on reference area. The LiDAR plots below prove that the building volumes estimated from median BH (Figure 2.47b) have a better approximation to the reference values in comparison with average BH (Figure 2.47a). The circles in Figures 2.47a and 2.47b identify two peaks that represent the outliers in the estimation of volume of the complex buildings ED1 2 and ED9 16, respectively. Furthermore, the plot in Figure 2.47c proves that the estimated curve for UAVk2 has a slightly better approximation to the true values using the average 132 measure for BH. The circle in Figure 2.47d identifies the presence of two outliers, which represent two of the major errors obtained in the estimation of the building volume from the UAV point cloud. These two outliers represent buildings ED1 2 and ED9 16 (Figure 2.45), whose percentage error is significantly lower when we use the average measure for BH (Figures 2.47a and 2.47c). Figure 2.47: Empirical density functions of building volume estimated from each LiDAR and UAVk2 point clouds (with reference area) and reference building volume. The usage of average building height can be better for estimation of the volume for complex buildings than the median building height, as can be demonstrated for all the results of building ED1 2 (Figure 2.45). Next, we will analyse the building volume estimated only from 3D point clouds. Building Volume (using only 3D point clouds for BA and BH) The building volume estimated in this context depends on the accurate level of building height and area parameters extracted from a 3D point cloud. According to the building areas accepted above, the relative building volume errors obtained for each building are shown in Figure 2.48. The magnitude of relative errors was higher than the previous case (Figure 2.45), because the accurate level of the building area was lower. 133 The usage of median or average building height has less impact on building volume error, because the building volume also depends on the building area error (Figure 2.48). The UAVk2 point cloud for 40% of the estimated building volume has a percentage of error under 10% for both measures adopted in the estimation of building height. Additionally, for the UAVk10 there was also around 45% of the building volume that have had a percentage of error under 10%. However, the results obtained for these clouds were worse for the building volumes estimated from median BH, where over 20% (UAVk2) and 9% (UAVk10) of the building volume had an error of 20% more than the building volume estimated from average BH. Figure 2.48: Relative Building Volume errors acquired for the building volumes estimated only from point clouds. The grey buildings illustrated were not considered. The results of the LiDAR point cloud were slightly better, since the maximum value of relative error for building volumes estimated from average and median building height was under 30% and 20%, respectively. In Figure 2.48a), the building volume estimated from LiDAR data had a relative error of under 10% for about 62% of buildings, unlike the building volume of Figure 2.48b) (about 31%). However, the errors were under 20% for every building volume estimated by using median BH. 134 According to Table 2.19, the best statistical measurements achieved for the estimation of building volumes from UAV point clouds were achieved with the average of building height parameter. Table 2.19: Statistical measures of Relative Building’s Volume error (%) obtained for building volumes estimated from point clouds. BV Parameter Point Cloud Average Median Min Max Standard Deviation BH(average) UAVk2 17.2 16.9 3.9 38.3 11.7 *BA UAVk10 15.1 11.9 3.8 32.4 10.6 LiDAR 10.2 8.7 0.03 28.1 8.4 BH(median) UAVk2 22.2 24.7 2.3 59.2 17.8 *BA UAVk10 20.9 10.1 0.6 76.7 23.0 LiDAR 11.1 11.3 2.3 19.7 5.7 Nevertheless, the average of relative errors (Table 2.19) achieved for UAVk2 building volume (17.2%) were about twice the average value obtained for the case of BV type I (Table 2.18). The magnitude of this error is mainly due to the difficulty of estimating accurate values for the building area, where for this assessment around 40% of all the buildings were previously removed. Additionally, it is important to highlight that the range of relative building volume errors from UAVk2 in relation to the previous case greatly increased to twice as much (Table 2.18). The best range of relative error was given from the LiDAR point cloud, between 2.3% and 19.7% (using median for BH). Moreover, the magnitude of errors achieved for this data is similar to the values registered for the building volumes estimated with reference building area (Table 2.18). This mean that the magnitude of building area error achieved from this point cloud (Table 2.15) has a low impact on the estimation of building volume. On the other hand, this can mean that the errors obtained regarding building area were statistically compensated by the building fa¸cade height errors. For example, the building volume of building ED5 was estimated with an error of under 10% (Figure 2.48a), because the large building area error of -73.2 m2was compensated by the large building height error of 3.45 m (Figures 2.40 and 2.42). However, the empirical density functions (Figure 2.49) can better help in the interpretation of these results. The estimated UAVk2 curve for building volume has a slightly better approximation to the exact building volume values using the average measure for BH (Figure 2.49a). The building volume estimated from LiDAR 135 using the average BH seems to have a better approximation to the exact building volumes than the usage of median BH (Figures 2.49c,d). Figure 2.49: Empirical density functions of building volume estimated from each LiDAR and UAVk2 point clouds and reference building volume. Every building volume estimated from a 3D point cloud depends on the magnitude of the building area and building fa¸cade height errors. In addition, building volume error was the result of a statistical compensation between the building area and the building fa¸cade height errors. Therefore, we may ask: What is the best point cloud sample for the estimation of this parameter?. This is a tough question, because of the nature of this parameter, where the compensation of errors could not be controlled from each variable involved. Hence, lower errors in terms of volume do not mean good quality in extracted buildings. In other words, lower building volume errors do not imply that the extracted building volume is closer to a correct shape and height. The best solution is to evaluate separately the quality of the building parameters involved in its calculation. Total Volume The total volume (Tvol) parameter is the sum of all building volumes for a 136 Appendix B Planning of the topographic survey – Praia de Faro 239 240 Surveying Area The topograhic survey in Praia de Faro was made on 19th March 2012. Below, we can see an excerpt of the topographic planning for the building ED6 and the draft before the surveying. In the plan, the location of roof points that should be surveyed was made in orthophotos. Notes of next draft: •Maximum of Building Height (Altitude maxima da edifica¸cao); •Building Height (Altura da edifica¸cao) •Building Fa¸cade Height (Altura da fachada) 241 242 Appendix C Report: UAV imagery processing – Praia de Faro 243 244 Report of image matching process performed for UAV imagery – Praia de Faro – 245 246 247 248 −− o u t p u t : b u i l d i n g r o o f t o p p o i n t s ( w i t h x , y , z ) drop TABLE i f exists LiDAR . t o p o l i d a r k 1 0 s 1 0 0 ; c r e a t e t a b l e LiDAR . t o p o l i d a r k 1 0 s 1 0 0 as select t o p p o i n t s . idnuvem , LiDAR . ” k10s10 0LIDAR ” . * from t o p p o i n t s , LiDAR . ” k10s100LIDAR ” where t o p p o i n t s . i d nuve m = LiDAR . ” k10 s100LIDAR ” . g i d ; a l t e r t a b l e LiDAR . t o p o l i d a r k 1 0 s 1 0 0 add column g i d 1 s e r i a l primary key ; CREATE INDEX topo lidark10s100 idx ON LiDAR . t o p o l i d a r k 1 0 s 1 0 0 USING g i s t ( t h e g e o m ) ; ALTER TABLE LiDAR . t o p o l i d a r k 1 0 s 1 0 0 CLUSTER ON t o p o l i d a r k 1 0 s 1 0 0 i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− S e c o n d P a r t : E x t r a c t i o n o f b u i l d i n g g r o u n d p o i n t s t h a t −− r e p r e s e n t s b a s e o f b u i l d i n g f ro m P o i n t −Cloud −− I n p u t : B o un da ry o f b u i l d i n g s −o u t c o n c a v e h u l l −− O r i g i n a l P o i n t −cloud −− B u f f e r o f 11m a l o n g t h e p u b l i c s t r e e t −− O u t p u t : B u i l d i n g b a s e −3D points −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− C r e a t e B u f f e r s −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− B u f f e r 2m f ro m b u i l d i n g r o o f t o p −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− drop TABLE i f exists DCASCADE; c r e a t e t a b l e DAS select s t u n i o n ( s t b u f f e r ( t h e g e o m , 2 ) ) as the geom from LiDAR.”outconcavehull LiDARk10s100”; a l t e r t a b l e D add column g i d s e r i a l primary key ; CREATE INDEX D i d x ON D USING g i s t 255 ( t h e g e o m ) ; ALTER TABLE DCLUSTER ON D i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− B u f f e r 0 . 5m f ro m b u i l d i n g r o o f t o p −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− drop TABLE i f exists ECASCADE; c r e a t e t a b l e EAS select s t u n i o n ( s t b u f f e r ( t h e g e o m , 0 . 5 ) ) as the geom from LiDAR.”outconcavehull LiDARk10s100”; a l t e r t a b l e E add column g i d s e r i a l primary key ; CREATE INDEX E i d x ON E USING g i s t ( t h e g e o m ) ; ALTER TABLE ECLUSTER ON E i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− B u f f e r 1 . 5m o b t a i n e d f r om t h e d i f f e r e n c e b e t w e e n D and E −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− drop TABLE i f exists F ; CREATE Table FAS select S T D i f f e r e n c e (D . t h e g e o m , E . t h e g e o m ) as the geom from D , E ; a l t e r t a b l e F add column g i d s e r i a l primary key ; CREATE INDEX F i d x ON F USING g i s t ( t h e g e o m ) ; ALTER TABLE FCLUSTER ON F i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− M u l t i p o l y g o n F t o s i n g l e p o l y g o n −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− drop TABLE i f exists G ; c r e a t e t a b l e Gas select ( s t d u m p ( t h e g e o m ) ) . geom as the geom from F ; 256 a l t e r t a b l e G add column g i d s e r i a l primary key ; CREATE INDEX G i d x ON G USING g i s t ( t h e g e o m ) ; ALTER TABLE GCLUSTER ON G i d x ; a l t e r t a b l e G add column a r e a d o u b l e p r e c i s i o n ; update G set a r e a = s t a r e a ( t h e g e o m ) ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− u p d a t e r e f e r e n c e s y s t e m o f G −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− UPDATE GSET t h e g e o m = S T SetSR I D ( t h e g eo m , 2 7 4 9 3 ) ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−− B u f f e r a r o u n d p u b l i c s t r e e t −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− drop TABLE i f exists LiDAR . H ; CREATE Table LiDAR . H AS select s t u n i o n ( s t b u f f e r ( t h e g e o m , 1 1 ) ) as the geom from ” C a r t o g r a f i a ” . e s t r a d a ; a l t e r t a b l e LiDAR . H add column g i d s e r i a l primary key ; CREATE INDEX H i d x ON LiDAR . H USING g i s t ( t h e g e o m ) ; ALTER TABLE LiDAR . H CLUSTER ON H i d x ; UPDATE LiDAR . H SET t h e g e o m = S T SetS R I D ( t h e g e o m , 2 7 4 9 3 ) ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−−I : a r e a a r o u n d b u i l d i n g s i n t e r s e c t i o n b e t w e e n H and G drop TABLE i f exists LiDAR . I ; 257 CREATE Table LiDAR . I AS select S T i n t e r s e c t i o n (G . t h e g e o m , LiDAR . H . t h e g e o m ) as the geom from G , LiDAR . H ; a l t e r t a b l e LiDAR . I add column g i d s e r i a l primary key ; CREATE INDEX I i d x ON LiDAR . I USING g i s t ( t h e g e o m ) ; ALTER TABLE LiDAR . I CLUSTER ON I i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− I n t e r s e c t i o n o f b u f f e r I and p o i n t −cloud −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− UPDATE l i d a r . l i d a r 8 4 8 5 s e l 2 m SET t h e g e o m = S T SetS R I D ( t h e g e o m , 2 7 4 9 3 ) ; drop TABLE i f exists tmp4 ; c r e a t e t a b l e tmp4 as SELECT l i d a r 8 4 8 5 s e l 2 m . g i d as idnuvem , I . g i d as idpol from l i d a r . l i d a r 8 4 8 5 s e l 2 m , LiDAR . I WHERE l i d a r 8 4 8 5 s e l 2 m . t h e g e o m && I . t h e g e o m / * U s es GiST i n d e x w i t h t h e p o l y g o n ’ s b o u n d i n g b o x * / AND S T C o n t a i n s ( I . t h e g e o m , l i d a r 8 4 8 5 s e l 2 m . t h e g e o m ) ; / * U s es e x a c t m a t c h i n g * / −−− o u t p u t : Ground 3D p o i n t s drop TABLE i f exists LiDAR . p a v i m e n t o k 1 0 s 1 0 0 ; c r e a t e t a b l e LiDAR . p a v i m e n t o k 1 0 s 1 0 0 as select tmp4 . idnuvem , l i d a r 8 4 8 5 s e l 2 m . * from tmp4 , l i d a r . l i d a r 8 4 8 5 s e l 2 m where tmp4 . idn u vem = l i d a r . l i d a r 8 4 8 5 s e l 2 m . g i d ; a l t e r t a b l e LiDAR . p a v i m e n t o k 1 0 s 1 0 0 258 add constraint i h 9 primary key ( i dnuv e m ) ; CREATE INDEX LiDAR . p a v i m e n t o k 1 0 s 1 0 0 i d x ON LiDAR . p a v i m e n t o k 1 0 s 1 0 0 USING g i s t ( t h e g e o m ) ; ALTER TABLE LiDAR . p a v i m e n t o k 1 0 s 1 0 0 CLUSTER ON LiDAR . p a v i m e n t o k 1 0 s 1 0 0 i d x ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− C r e a t e a t a b l e c s v t o f i l t e r i n g t h e o u t p u t select * from LiDAR . p a v i m e n t o k 1 0 s 1 0 0 ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− c o p y LiDAR . p a v i m e n t o k 1 0 s 1 0 0 from ’ / home / xxx . c s v ’ w i t h d e l i m i t e r ’ , ’ c s v h e a d e r ; 259 260 Appendix E R Algorithm: filtering of selected ground points 261 262 Listing E.1: Filtering Ground Points (Step 2 - Figure 2.33 of Subsection 2.3.1 of Chapter 2) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C a r l a R e b e l o , F e b r u a r y 2 0 1 3 o b j e c t i v o : F i l t e r t h e g r o u n d p o i n t s f o r t h e r e m o v a l o f r e s i d u a l p o i n t s ( ” wrong p o i n t s : w h i c h n o t a r e g r o u n d p o i n t s ” ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 1 . I n p u t : Ground P o i n t s ( f o r m a t c s v ) i n R −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− s e t w d ( ” / home / . . . / D e s k t o p ” ) data1 <−r e a d . t a b l e ( ” g r o u n d k 1 0 L i d a r . c s v ” , h e a d e r=TRUE , s e p = ” , ” , e n c o d i n g =” l a t i n 1 ” ) names ( d a t a 1 ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 2 . A n a l y s e : E m p i r i c a l d e n s i t y c u r v e o f g r o u n d points −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− d<−p l o t ( d e n s i t y ( d a t a 1 $ z ) , main =” E l e v a t i o n Z UAV : b a s e o f b u i l d i n g s ” ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 3 . How many s p i k e s t h e r e a r e i n c u r v e ? ked= s p i k e s number +1 −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− l i b r a r y ( c l u s t e r ) cz <−c b i n d ( d at a 1 $ x , d a t a 1 $ y , data1 $ z ) k=k ed claraclusCp <−c l a r a ( d a t a 1 $ z , k , s a m p l e s =10) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 4 . C r e a t e t h e p l o t o f k−c l u s t e r s d e f i n e d by k −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− p l o t ( cz , c o l = c l a r a c l u s C p $ c l u s t e r , c e x = 0 . 2 , x l a b =” c o o r d i n a t e X(m) ” , y l a b =” c o o r d i n a t e Y (m) ” ) l e g e n d ( ” b o t t o m l e f t ” , l e g e n d = p a s t e ( ” c l u s t e r ” , 1 : k ) , 263 pc h =1 , c o l =1: k , c e x = 0 . 7 ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 5 . P r e p a r a t i o n o f d a t a t o a n a l y z e t h e s t a n d a r d d e v i a t i o n o f e a c h c l u s t e r ; C r e a t e t a b l e w i t h c l u s t e r s c h o s e n −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− l i b r a r y ( s q l d f ) l i b r a r y ( t c l t k ) x<−d a t a . f r a m e ( cz , c l a r a c l u s C p $ cluster ) c o l n a m e s ( x ) <−c ( ” x ” , ” y ” , ” z ” , ” c l u s t e r ” ) s q l c l u s <−h ea d ( x ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 6 . S e l e c t i o n o f e a c h c l u s t e r Ak ’ s , k = 1 , 2 , . . . n by t h i s l i n e c o d e sqlclusAk <−s q l d f ( ” s e l e c t * f r o m x w h e r e c l u s t e r =k ” , row . names=TRUE) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− sqlclusA1 <−s q l d f ( ” s e l e c t * f r o m x w h e r e c l u s t e r =1” , row . names=TRUE) sqlclusAn <−s q l d f ( ” s e l e c t * f r o m x w h e r e c l u s t e r =n ” , row . names=TRUE −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 7 . A n a l y z e t h e s t a n d a r d d e v i a t i o n o f e a c h c l u s t e r sdk , k = 1 , 2 , . . . n −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− s d 1 <−s d ( s q l c l u s A 1 $ z ) sd n <−s d ( s q l c l u s A n $ z ) −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 8 . I f v a l u e i s h i g h e r t h a n v a l u e 1 r em ov e t h e c l u s t e r o f g r o u n d p o i n t s ; c r e a t e t h e o u t p u t −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− sqlcluster <−r b i n d ( s q l c l u s A 1 , s q l c l u s A 2 ) sqlcluster1 <−r b i n d ( s q l c l u s t e r , s q l c l u s A n ) w r i t e . c s v ( s q l c l u s t e r 1 , f i l e =” f i l t g r o u n d k 1 0 l i d a r . c s v ” , row . names=FALSE ) 264 271 272 273 274 275 276 Appendix H Report: UAV imagery processing – Amadora 277 278 Report of image matching process performed for UAV imagery – Amadora – using PIX4D 279 280 Appendix J R algorithm for the calculation and evaluation of estimated building fa¸cade height 287 288 The R algorithm developed for the calculation of building fa¸cade height is presented in listing J.1. Listing J.1: Compute Building Fa¸cade Height for area X using trim mean #################################################### #PART 1 : E d g e s o f r o o f #I n p u t : UAV p o i n t s o f e d g e s b u i l d i n g r o o f ” f i l e . c s v ” #################################################### data <−read .table ( ” AreaA . c s v ” , h e a d e r =TRUE , s e p=” , ” , e n c o d i n g =” l a t i n 1 ” ) #C o n v e r s i o n t o n u m e r i c v a l u e s c c e <−as .numeric (t a p p ly (data $ z , data $ i d p t , FUN = f u n c t i o n ( x ) mean ( x , t r i m = . 4 ) ) ) outputE <−data .frame ( c c e ) colnames ( o u t p u t E ) <−c( ” e d i f ” , ” m e d i a e t 0 . 4 ” ) #E x p o r t r e s u l t s write .csv ( outpu t E , f i l e =”resultsAreaA . csv”) #################################################### #PART 2 : Ground #I n p u t : UAV Ground p o i n t s ” f i l e . c s v ” #################################################### datag <−read .table ( ” AreaAG . c s v ” , h e a d e r =TRUE , s e p=” , ” , e n c o d i n g =” l a t i n 1 ” ) ccg <−as .numeric (tapply ( d a t a g p $ z , d a t a g $ i d p a v , FUN = f u n c t i o n ( x ) mean ( x , t r i m = . 2 ) ) ) outputG <−data .frame ( c c g ) colnames ( o u tpu t G ) <−c( ” e d i f ” , ” m e d i a g t 0 . 2 ” ) # Me rge t h e t w o t a b l e s ( r o w s ) and c o m p u t e b u i l d i n g #F a c a d e H e i g h t resultsM <−merge ( o u t pu tE , outputG , by . x = ” e d i f ” , by . y = ” e d i f ” ) resultsM $ HfachadaUAV <−resultsM $ m e d i a e t 0 . 4 − resultsM $ m e d i a g t 0 . 2 #E x p o r t r e s u l t s write .csv ( r e s u l t s M , f i l e =” r e s u l t s A r e a AG . c s v ” ) The R algorithm developed for the evaluation of building fa¸cade height results achieved for each building based on the calculation of vertical error is presented 289 in listing J.2. Listing J.2: Compute Building Fa¸cade Height using trim mean # I m p o r t t a b l e o f r e f e r e n c e b u i l d i n g h e i g h t v a l u e s d a t r e f <−read .table (”abuildsreference . csv”, h e a d e r=TRUE , s e p=” ; ” , e n c o d i n g =” l a t i n 1 ” ) # Merge t h e t wo t a b l e s ( r o w s ) b y i d e n t i c a l a t t r i b u t e T i l e <−merge ( d a t r e f , r e s u l t s M , by . x = ” p r e d i o i d ” , by . y = ” e d i f ” ) # Compute r e s i d u a l s o f B u i l d i n g H e i g h t T i l e $ residuoHF <−T i l e $ HFacade − T i l e $ HFacadeUAV 290 Appendix K Building fa¸cade height values estimated from UAV point cloud within GRASS 291 292 RESULTS OF SUBSECTION 3.2.2 This appendix presents the results achieved for all the building fa¸cade heights estimated from different block morphologies in Amadora city. AREA A Building blocks of area A. Blue: selected UAV points; Black: Reference elevation point on the ground; Green: Reference elevation point on the rooftop. The UAV points selected for building 4 are presented in the figure below. The results presented are related with the best processing [ (1/point density)x 4]. The building fa¸cade heights that have not been well estimated are highlighted in blue in the next table. These values correspond to the difficulty of filtering points on the rooftop on the ground. The maximum error in area A was 5.60 m for building 4, whose the elevation at the top has ‘wrong points’ (Figure above). The higher vertical errors obtained for all buildings are due to the estimated elevation rooftops. Area A: estimated building fa¸cade height estimated and vertical errors 293 Building Code Rooftop Elevation (exact) Base Elevation (exact) BFH True (m) Rooftop Elevation* (UAV) Base Elevation* (UAV) BFH UAV (m) Residual (Vertical Error) 3 148.00 132.23 15.77 147.93 132.99 14.95 0.82 4148.00 132.23 15.77 142.89 132.71 10.17 5.60 5 148.00 132.24 15.76 148.64 133.23 15.40 0.36 6 148.00 132.28 15.72 147.29 134.40 12.89 2.83 7 148.16 132.39 15.77 147.99 132.23 15.76 0.01 8 148.38 132.32 16.06 147.85 133.55 14.30 1.76 9 148.50 132.28 16.22 147.49 132.57 14.92 1.30 10 151.19 133.36 17.83 150.52 133.13 17.39 0.44 11 150.43 133.33 17.10 149.53 133.37 16.15 0.95 12 151.21 133.36 17.85 150.24 133.17 17.07 0.78 13 153.30 133.56 19.74 149.00 133.26 15.74 4.00 14 153.30 133.59 19.71 152.93 133.19 19.74 -0.03 15 153.72 133.59 20.13 152.91 133.29 19.61 0.52 36 152.47 133.39 19.08 148.72 133.17 15.56 3.52 *Elevation Base based on 0.4 trimmed mean; Elevation Rooftop based on 0.2 trimmed mean AREA B Building blocks of area B. Blue: selected UAV points; Black: Reference elevation point on the ground; Green: Reference elevation point on the rooftop. The UAV points selected for buildings 73 and 80 are shown in the figure below. Analysing the table of errors for area C, we can see that the maximum error was about 15 m for building 80. The higher vertical errors are due estimated ground elevations, which means that the DTM does not have good quality along these areas (points that do not belong to the ground were not completely removed). 294 Area B: Estimated building fa¸cade height and vertical errors. (NB: the wrong points are identified in red.) Building Code Rooftop Elevation (exact) Base Elevation (exact) BFH True (m) Rooftop Elevation* (UAV) Base Elevation* (UAV) BFH UAV (m) Residual (Vertical Error) 17 147.3 132.45 14.85 147.08 133.1 13.97 0.88 18 146.84 131.75 15.09 146.12 131.94 14.19 0.90 19 146.88 131.82 15.06 140.50 133.05 7.45 7.61 23 144.2 130.45 13.75 144.44 132.26 12.18 1.57 24 143.8 130.35 13.45 144.26 138.21 6.05 7.40 34 148.4 133.05 15.35 148.14 133.56 14.58 0.77 38 149.2 134.15 15.05 148.61 140.64 7.98 7.07 39 149.9 134.95 14.95 149.76 136.25 13.51 1.44 43 143.7 128.25 15.45 144.24 135.71 8.53 6.92 45 144 130.35 13.65 144.05 130.76 13.29 0.36 46 144.4 130.55 13.85 144.77 132.21 12.56 1.29 47 145.2 131.75 13.45 145.38 132.61 12.78 0.67 48 146 131.95 14.05 145.82 132.23 13.59 0.46 49 146.2 132.35 13.85 146.44 132.73 13.71 0.14 50 146.6 133.15 13.45 146.07 139.16 6.91 6.54 52 147.4 131.05 16.35 147.67 134.96 12.71 3.64 53 146.7 133.55 13.15 146.82 135.18 11.65 1.50 59 149.4 133.45 15.95 149.42 133.48 15.94 0.01 60 150.1 134.45 15.65 150.22 134.58 15.64 0.01 61 151.6 135.45 16.15 151.26 135.57 15.69 0.46 73 149.7 132.05 17.65 145.52 140.43 5.09 12.56 76 145.7 128.25 17.45 145.81 128.29 17.52 -0.07 77 143.2 127.75 15.45 142.15 128.02 14.12 1.33 79 142.7 127.2 15.5 0 142.61 127.30 15.31 0.19 80 145.8 127.45 18.35 146.01 143.18 2.83 15.52 81 146.28 129.55 16.73 146.49 136.94 9.54 7.19 82 143.4 129.15 14.25 143.46 132.06 11.41 2.84 87 143.75 129.56 14.19 143.39 134.95 8.44 5.75 *Elevation Base based on 0.4 trimmed mean; Elevation Rooftop based on 0.2 trimmed mean The highest building fa¸cade height errors of area B were due to UAV imagery processing, which showed great discontinuities along the boundaries of the buildings. 295 AREA C Building blocks of area C. Blue: selected UAV points; Black: Reference elevation point on the ground; Green: Reference elevation point on the rooftop. The UAV points selected for buildings 66 and 75 are shown. The highest building fa¸cade height errors in area C are due to a wrong estimated ground elevation. The maximum error was about 17 m for building 66 (next table and figure above). Area C: Estimated Building fa¸cade height and vertical errors. The wrong points are identified in red. Building Code Rooftop Elevation (exact) Base Elevation (exact) BFH True (m) Rooftop Elevation* (UAV) Base Elevation* (UAV) BFH UAV (m) Residual (Vertical Error) 25 147.17 130.98 16.19 147.06 137.39 9.68 6.51 31 151.55 138.30 13.25 151.24 139.27 11.98 1.27 32 151.55 138.62 12.93 150.99 138.73 12.26 0.67 62 147.51 133.67 13.84 147.68 147.04 0.64 13.20 64 149.42 136.15 13.27 149.37 141.6 7.77 5.50 66 154.96 132.43 22.53 155.03 149.13 5.91 16.62 67 148.72 136.4 12.32 148.82 136.44 12.38 -0.06 68 150.57 137.8 12.77 150.72 139.5 11.22 1.55 69 150.07 137.6 12.47 149.64 137.91 11.73 0.74 70 149.12 136.4 12.72 149.07 148.22 0.85 11.87 71 150.62 137.01 13.61 150.93 138.79 12.14 1.47 72 150.17 137.42 12.75 149.79 137.18 12.62 0.13 74 157.37 136.2 21.17 151.57 135.83 15.74 5.43 75 156.2 134.62 21.58 155.11 147.57 7.54 14.04 83 147.17 130.87 16.3 145.93 130.76 15.17 1.13 84 147.17 130.49 16.68 145.53 130.51 15.02 1.66 86 144.61 131.28 13.33 144.25 130.93 13.32 0.01 88 152.28 133.38 18.9 152.64 133.94 18.71 0.19 89 153.53 134.32 19.21 154.26 135.12 19.14 0.07 *Elevation Base based on 0.4 trimmed mean; Elevation Rooftop based on 0.2 trimmed mean 296 Appendix M Computing building blocks (height and volume) from UAV data using an algorithm in PostgreSQL/PostGIS 303 304 Listing M.1: Extraction of Eave Roof and Base Points of each building block and compute average/median building block height −−A u t h o r : C a r l a R e b e l o , 2 0 1 3 −−OBJECTIVE : Compute a v e r a g e / m ed i an b u i l d i n g b l o c k h e i g h t −−and b l o c k v o l u m e s f r o m a s e t s o f UAV p o i n t s s e l e c t e d −− t h a t r e p r e s e n t t h e e a v e o f r o o f t o p and b a s e b u i l d i n g −− Description : −− F i r s t p a r t : I m p o r t o r i g i n a l p o i n t c l o u d and c l u s t e r i n g o f −−one a r e a −−S e c o n d p a r t : S e l e c t i o n o f r o o f e a v e p o i n t s f o r e a c h b l o c k −− and c o m p u t e t h e me d ian / a v e r a g e e l e v a t i o n o f t h e s e p o i n t s −− selected ; −−T h i r d p a r t : S e l e c t i o n o f b l o c k b a s e p o i n t s ( g r o u n d ) −− f o r e a c h b l o c k and c o m p u t e t h e m ed i an / a v e r a g e e l e v a t i o n o f t h e s e p o i n t s s e l e c t e d ; −−F o u r t h p a r t : Compute a v e r a g e and med i an b l o c k s ’ h e i g h t and −− b l o c k s ’ v o l u m e −− I n p u t d a t a : o r i g i n a l p o i n t −c l o u d ( p c l ) ; −− c l u s t e r i n g r e s u l t w i t h t h e i d e n t i f i c a t i o n o f b u i l d i n g −− b l o c k s ( p o i n t s ) ; −− r e f e r e n c e l i n e s b a s e d on r e f e r e n c e p o i n t s e l e v a t i o n o f −− b u i l d i n g b l o c k ; −−concave−h u l l r e s u l t ( b u i l d i n g b l o c k b o u n d a r y ) . −−T h e s e l a s t d a t a ca n be i m p o r t e d t o d a t a b a s e fr om QGIS −−( command s p i t ) −−O u t p u t r e s u l t s : r o o f p o i n t s and g r o u n d p o i n t s ; −− b l o c k s ’ h e i g h t , b l o c k s ’ v o l u m e −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−PART 1 : I m p o r t d a t a −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −− C r e a t e t a b l e s o f p o i n t c l o u d d a t a o r i g i n a l and c l u s t e r i n g d a t a CREATE TABLE p c l a r e a ( c a t integer , x d o u b l e p r e c i s i o n , y d o u b l e p r e c i s i o n , z d o u b l e p r e c i s i o n , constraint c k primary key ( c a t ) ) ; c o p y p c l a r e a FROM ’ / home / c r e b e l o / D e s k t o p / p c l C . c s v ’ 305 w i t h d e l i m i t e r ’ , ’ c s v h e a d e r ; CREATE TABLE pcl cluster ( c a t integer , x d o u b l e p r e c i s i o n , y d o u b l e p r e c i s i o n , z d o u b l e p r e c i s i o n , constraint ck primary key ( c a t ) ) ; c o p y p c l c l u s t e r FROM ’ / home / c r e b e l o / D e s k t o p / p c l C l u s t e r C . c s v ’ w i t h d e l i m i t e r ’ , ’ c s v h e a d e r ; −−Add g e o m e t r y f o r t h e p r e v i o u s t a b l e s ALTER TABLE pcl area ADD column t h e g e o m g e o m e t r y ; UPDATE pcl area SET t h e g e o m = S T S e tS R ID ( S T M a k e P o i n t ( x , y , z ) , 3 7 6 3 ) ; ALTER TABLE pcl cluster ADD column t h e g e o m g e o m e t r y ; UPDATE pcl cluster SET t h e g e o m = S T S e tS R ID ( S T M a k e P o i n t ( x , y , z ) , 3 7 6 3 ) ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−PART 2 : S e l e c t i o n o f b l o c k r o o f p o i n t s and c o m p u t e −− t h e m e di a n / a v e r a g e e l e v a t i o n −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−1 ) B u f f e r −1m f ro m b l o c k b o u n d a r y −− I n p u t : b u i l d i n g b o u n d a r y e x t r a c t f r om c o n c a v e −h u l l ( GRASS ) ” b c h u l l ” w i t h a t t r i b u t e c o d e b u i l d i n g ( i d b l o c k ) . −−P a r a m e t e r c an b e c h a n g e i s t h e v a l u e o f b u f f e r UPDATE bchull SET geom = S T Set S R I D ( geom , 3 7 6 3 ) ; DROP TABLE i f exists bchull buffer CASCADE; CREATE TABLE bchull buffer AS SELECT s t u n i o n ( s t b u f f e r ( geom , −1 ) ) as the geom FROM bchull ; ALTER TABLE bchull buffer ADD column g i d s e r i a l primary key ; CREATE INDEX bchull buffer idx ON bchull buffer USING g i s t ( t h e g e o m ) ; 306 ALTER TABLE bchull buffer CLUSTER ON bchull buffer idx ; −−2 ) D i f f e r e n c e b e t w e e n b u f f e r −1m and p o l y g o n o f −−concave−h u l l ( b u i l d i n g b l o c k b o u n d a r y ) DROP TABLE i f exists buff roof CASCADE; CREATE Table buff roof AS SELECT S T D i f f e r e n c e ( b c h u l l . geom , b c h u l l b u f f e r . t h e g e o m ) as t h e g e o m , b c h u l l . i d b l o c k FROM b c h u l l b u f f e r , b c h u l l ; ALTER TABLE buff roof ADD column g i d s e r i a l primary key ; CREATE INDEX buff roof idx ON buff roof USING g i s t ( t h e g e o m ) ; ALTER TABLE buff roof CLUSTER ON buff roof idx ; −− d e f i n i t i o n o f c o o r d i n a t e s y s t e m UPDATE buff roof SET t h e g e o m = S T SetSR I D ( t h e g e o m , 3 7 6 3 ) ; −−3 ) S e l e c t i o n o f p o i n t s t h a t b e l o n g s t h e e a v e r o o f −−o r t h e b u f f e r g e n e r a t e d ( b u f f r o o f ) DROP TABLE i f exists tmp2 CASCADE; CREATE TABLE tmp2 as SELECT p c l c l u s t e r . c a t as idnuvem , b u f f r o o f . g i d as i d p o l , b u f f r o o f . i d b l o c k FROM p c l c l u s t e r , b u f f r o o f WHERE p c l c l u s t e r . t h e g e o m && b u f f r o o f . t h e g e o m AND S T C o n t a i n s ( b u f f r o o f . t h e g e o m , p c l c l u s t e r . t h e g e o m ) ; −−4 ) O u t p u t R e s u l t s −Eave r o o f p o i n t s o f b u i l d i n g s ’ −− b l o c k ( R o o f a r e a ) DROP TABLE i f exists Roof points CASCADE; CREATE TABLE Roof points as SELECT tmp2 . idnuvem , tmp2 . i d b l o c k , p c l c l u s t e r . * FROM tmp2, pclcluster WHERE tmp2 . i d nuvem = p c l c l u s t e r . c a t ; 307 ALTER TABLE Roof points ADD constraint i d 7 s primary key ( i dnuv e m ) ; CREATE INDEX R o o f p o i n t s i d x ON Roof points USING g i s t ( t h e g e o m ) ; ALTER TABLE Roof points CLUSTER ON R o o f p o i n t s i d x ; −−5 ) Compute me d ia n / a v e r a g e e l e v a t i o n o f b l o c k r o o f −−S o u r c e c o d e f o r m e di a n b y u s i n g p l r f u n c t i o n me d ia n p r o v i d e d b y −−J o e co nwa y , −− h t t p : / / www . j o e c o n w a y . com / p l r / d oc / p l r −aggregate −f u n c s . h t m l CREATE or r e p l a c e f u n c t i o n r m e d i a n ( f l o a t 8 ) returns float as ’ m ed i an ( a r g 1 ) ’ l a n g u a g e ’ p l r ’ ; CREATE AGGREGATE m ed i an ( s f u n c = p l r a r r a y a c c u m , b a s e t y p e = f l o a t 8 , s t y p e = f l o a t 8 , f i n a l f u n c = r m e d i a n ) ; DROP t a b l e i f exists R o o f m e a s u r e ; c r e a t e t a b l e Roof measure as SELECT i d b l o c k , s t u n i o n ( t h e g e o m ) as t h e g e o m , avg ( z ) as mean znb , me d ia n ( z ) as med znb from Roof points group by idblock ; −− s e e t h e r e s u l t s SELECT * from R o o f m e a s u r e ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−PART 3 : S e l e c t i o n o f b l o c k b a s e p o i n t s and c o m p u t e −− t h e m e di a n / a v e r a g e e l e v a t i o n −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−1 ) B u f f e r 2 m f r om b l o c k b o u n d a r y 308 −− I n p u t : b u i l d i n g b l o c k b o u n d a r y e x t r a c t f ro m c o n c a v e −h u l l −−( GRASS ) b c h u l l −−P a r a m e t e r c an b e c h a n g e i s t h e v a l u e o f b u f f e r DROP TABLE i f exists tmp1 buff2m CASCADE; CREATE TABLE tmp1 buff2m AS SELECT s t u n i o n ( s t b u f f e r ( geom , 2 ) ) as the geom FROM bchull ; ALTER TABLE tmp1 buff2m ADD column g i d s e r i a l primary key ; CREATE INDEX tmp1 buff2m idx ON tmp1 buff2m USING g i s t ( t h e g e o m ) ; ALTER TABLE tmp1 buff2m CLUSTER ON tmp1 buff2m idx ; −−2 ) BUFFER M u l t i p o l y g o n t o s i n g l e p o l y g o n DROP TABLE i f exists bchull buffer2m CASCADE; CREATE TABLE bchull buffer2m as SELECT ( s t d u m p ( t h e g e o m ) ) . geom as the geom FROM tmp1 buff2m ; ALTER TABLE bchull buffer2m ADD column g i d s e r i a l primary key ; CREATE INDEX bchull buffer2m idx ON bchull buffer2m USING g i s t ( t h e g e o m ) ; ALTER TABLE bchull buffer2m CLUSTER ON bchull buffer2m idx ; UPDATE bchull buffer2m SET t h e g e o m = S T SetSR I D ( t h e g e o m , 3 7 6 3 ) ; −−add a r e a t o b c h u l l b u f f e r 2 m ALTER TABLE bchull buffer2m ADD column a r e a d o u b l e p r e c i s i o n ; UPDATE bchull buffer2m SET a r e a = s t a r e a ( t h e g e o m ) ; 309 −−3 ) D i f f e r e n c e b e t w e e n b u f f e r 2 m and p o l y g o n o f −−concave−h u l l ( b u f f e r o f b u i l d i n g b l o c k b a s e ) DROP TABLE i f exists buff ground CASCADE; CREATE Table buff ground AS SELECT S T D i f f e r e n c e ( b c h u l l b u f f e r 2 m . t h e g e o m , b c h u l l . geom ) as t h e g e o m , b c h u l l . i d b l o c k FROM bchull buffer2m JOIN bchull ON S T I n t e r s e c t s ( b c h u l l b u f f e r 2 m . t h e g e o m , b c h u l l . geom ) ; ALTER TABLE buff ground ADD column g i d s e r i a l primary key ; CREATE INDEX b u f f g r o u n d i d x ON buff ground USING g i s t ( t h e g e o m ) ; ALTER TABLE buff ground CLUSTER ON b u f f g r o u n d i d x ; −−Add r e f e r e n c e s y s t e m UPDATE pinterspav SET t h e g e o m = S T SetSR I D ( t h e g e o m , 3 7 6 3 ) ; −−4 ) I n t e r s e c t b u f f e r g r o u n d w i t h b u f f e r o f r e f e r e n c e −− s i d e o f b u i l d i n g b l o c k ( t h i s l a s t b u f f e r i s b a s e d on −− s t r e e t s l i n e s o f s i d e s o f b u i l d i n g b l o c k ) −−P a r a m e t e r c an b e c h a n g e i s t h e v a l u e o f b u f f e r −− B u f f e r 7m t o t h e r e f e r e n c e l i n e s DROP TABLE i f exists l i n e s r e f e r e n c e ; CREATE Table l i n e s r e f e r e n c e AS SELECT s t u n i o n ( s t b u f f e r ( t h e g e o m , 7 ) ) as the geom FROM l i n e s ; ALTER TABLE l i n e s r e f e r e n c e ADD column g i d s e r i a l primary key ; CREATE INDEX l i n e s r e f e r e n c e i d x ON l i n e s r e f e r e n c e USING g i s t ( t h e g e o m ) ; ALTER TABLE l i n e s r e f e r e n c e CLUSTER ON l i n e s r e f e r e n c e i d x ; 310 −− I n t e r s e c t i o n b e t w e e n b u f f e r r e f e r e n c e l i n e s w i t h −− b u f f e r b u f f g r o u n d DROP TABLE i f exists b u f f g r o u n d s i d e ; CREATE Table b u f f g r o u n d s i d e AS SELECT S T i n t e r s e c t i o n ( b u f f g r o u n d . t h e g e o m , l i n e s r e f e r e n c e . t h e g e o m ) as t h e g e o m , b u f f g r o u n d . i d b l o c k FROM b u f f g r o u n d , l i n e s r e f e r e n c e ; ALTER TABLE b u f f g r o u n d s i d e ADD column g i d s e r i a l primary key ; CREATE INDEX buff groundside idx ON b u f f g r o u n d s i d e USING g i s t ( t h e g e o m ) ; ALTER TABLE b u f f g r o u n d s i d e CLUSTER ON b u f f g r o u n d s i d e i d x ; −−5 ) S e l e c t i o n o f g r o u n d p o i n t s t h a t b e l o n g s t h e −− b u f f e r t h a t r e p r e s e n t s b u i l d i n g b l o c k b a s e −−( b u f f g r o u n d s i d e ) . DROP TABLE i f exists tmp4 CASCADE; CREATE TABLE tmp4 as SELECT p c l a r e a . c a t as idnuvem , b u f f g r o u n d s i d e . g i d as i d p o l , b u f f g r o u n d s i d e . i d b l o c k FROM p c l a r e a , b u f f g r o u n d s i d e WHERE p c l a r e a . t h e g e o m && b u f f g r o u n d s i d e . t h e g e o m / * U s es GiST i n d e x w i t h t h e p o l y g o n ’ s b o u n d i n g b o x * / AND S T C o n t a i n s ( b u f f g r o u n d s i d e . th e g e o m , p c l a r e a . t h e g e o m ) ; / * U s es e x a c t m a t c h i n g * / −−6 ) O u t p u t R e s u l t s −Bas e p o i n t s o f b u i l d i n g s ’ −− b l o c k ( g r o u n d p o i n t s ) DROP TABLE i f e x i s t s CASCADE; CREATE TABLE ground points as SELECT tmp4 . idnuvem , tmp4 . i d b l o c k , p c l a r e a . * FROM tmp4 , p c l a r e a WHERE tmp4 . i d nuvem = p c l a r e a . c a t ; 311 ALTER TABLE ground points ADD constraint i d g primary key ( id n uvem ) ; CREATE INDEX ground points idx ON ground points USING g i s t ( t h e g e o m ) ; ALTER TABLE ground points CLUSTER ON ground points idx ; −−7 ) Compute m e dia n / a v e r a g e e l e v a t i o n o f −− b l o c k b a s e DROP TABLE i f exists ground measure ; CREATE TABLE ground measure as SELECT i d b l o c k , s t u n i o n ( t h e g e o m ) as t h e g e o m , avg ( z ) as m e an zpav , me d ia n ( z ) as med zpav FROM ground points group by idblock ; −− s e e t h e r e s u l t s SELECT * from ground measure ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PART 4 : Compute a v e r a g e and me dia n b l o c k s ’ h e i g h t −−and b l o c k s ’ v o l u m e −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− DROP TABLE i f exists o u t p u t t m p ; CREATE TABLE o u t p u t t m p AS SELECT R o o f m e a s u r e . * , g r o u n d m e a s u r e . m e a n z pav , g r o u n d m e a s u r e . m e d z p a v FROM g r o u n d m e a s u r e , R o o f m e a s u r e where R o o f m e a s u r e . i d b l o c k = g r o u n d m e a s u r e . i d b l o c k −−1 ) add a r e a t o r e s u l t s , t h e name o f t a b l e s h o u l d b e −−re n amed t o a r e a A , B o r C DROP TABLE i f exists o u t p u t a r e a i ; CREATE TABLE output AS 312 Appendix O Evaluation of building block height and volume extracted from UAV data using an algorithm in PostgreSQL/PostGIS 319 320 Listing O.1: Evaluation of Building blocks’ height and volume extracted from UAV point cloud. −−A u t h o r : C a r l a R e b e l o , 2 0 1 3 −−OBJECTIVE : Compute a v e r a g e / m ed i an r e f e r e n c e b u i l d i n g −− b l o c k s ’ h e i g h t and b l o c k s ’ v o l u m e f ro m a s e t s o f e l e v a t i o n −− p o i n t s , w h i c h a r e u s i n g t o c a l c u l a t e d t h e e r r o r s o f −− p a r a m e t e r s e x t r a c t e d f ro m p o i n t c l o u d −− Description : −− F i r s t p a r t : Compute r e f e r e n c e b l o c k s ’ h e i g h t and v o l u m e −−f r om r e f e r e n c e e l e v a t i o n p o i n t s o f e a c h b u i l d i n g −−S e c o n d p a r t : Compute a b s o l u t e e r r o r s and r e l a t i v e e r r o r −− o f b l o c k s ’ h e i g h t and v o l u m e e s t i m a t e d f r om UAV p o i n t c l o u d ; −− I n p u t d a t a : t a b l e o f r e f e r e n c e b u i l d i n g s ’ b l o c k ( b u i l d i n g s ) ; −− b l o c k s ’ h e i g h t and v o l u m e e s t i m a t e d f r om p o i n t c l o u d ; −−O u t p u t r e s u l t s : r e f b l o c k s and e r r o r s −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−PART 1 : Compute r e f e r e n c e b l o c k s ’ h e i g h t and v o l u m e fr o m −− r e f e r e n c e e l e v a t i o n p o i n t s o f e a c h b u i l d i n g −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −−1 ) A g r e g a t e a t t r i b u t e s b y b l o c k SELECT * FROM buildings order by block ; DROP TABLE i f exists tmprefblocks ; CREATE TABLE tmprefblocks as SELECT b l o c k , s t u n i o n ( t h e g e o m ) as t h e g e o m , count ( * )as nbuildings , sum ( a r e a ) as sum area , sum ( nfloors ) as s u m n f l o o r s , avg ( elevationb )as ave refznb , avg ( elevationp ) as ave refznp , me d ia n ( e l e v a t i o n b ) as med refznb , me d ia n ( e l e v a t i o n p ) as med refznp 321 FROM buildings group by block ; SELECT * FROM tmprefblocks ord er by block ; −−2 ) Compute t h e a v e r a g e o f f l o o r s f o r e a c h b l o c k ALTER TABLE tmprefblocks ADD column a v e n f l o o r s d o u b l e p r e c i s i o n ; UPDATE tmprefblocks SET a v e n f l o o r s = s u m f l o o r s / n b u i l d i n g s ; ALTER TABLE tmprefblocks ADD column a v e r e f h f d o u b l e p r e c i s i o n , ADD column a v e r e f v o l d o u b l e p r e c i s i o n , ADD column m e d r e f h f d o u b l e p r e c i s i o n , ADD column m e d r e f v o l d o u b l e p r e c i s i o n ; −−3 ) Compute t h e a v e r a g e / m ed i an b l o c k h e i g h t and v o l u m e −− Height UPDATE tmprefblocks SET a v e r e f h f = a v e r e f z n b −ave refznp , m e d r e f h f = m e d r e f z n b −med refznp ; −−v o l u m e UPDATE tmprefblocks SET a v e r e f v o l = a v e r e f h f * sum area , m e d r e f v o l = m e d r e f h f * sum area ; DROP TABLE i f exists refblocks ; CREATE TABLE refblocks as SELECT b l o c k , n b u i l d i n g s , m e d n f l o o r s as mean npisos , sum area as a r e a r e f , a v e r e f h f , m e d r e f h f , a v e r e f v o l as volrefave block , m e d r e f v o l as volrefmed block , the geom FROM tmprefblocks ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− −PART 2 : Compute absolute errors and relative −− e r r o r o f b l o c k s ’ h e i g h t and v o l u m e e s t i m a t e d −−f r om UAV p o i n t c l o u d ; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 322 −−1 ) Add a l l i n f o r m a t i o n o f e a c h a r e a s o f s t u d y −−I n t h i s c a s e 3 a r e a s A , B , C INSERT INTO output areaA SELECT * FROM o u t p u t a r e a B , o u t p u t a r e a C ; CREATE TABLE uavblocks as SELECT * FROM output areaA ; −−2 )MERGE t h e tw o t a b l e s UAV and R e f e r e n c e DROP TABLE i f exists refblocksuav ; CREATE TABLE refblocksuav as SELECT refblocks . * , u a v b l o c k s . a r e a as a r e a u a v , u a v b l o c k s . a v e h f u a v , u a v b l o c k s . m e d hf ua v , u a v b l o c k s . a v e v o l u a v , u a v b l o c k s . m e d v o l u a v FROM r e f b l o c k s , u a v b l o c k s where r e f b l o c k s . b l o c k = u a v b l o c k s . i d b l o c k ; SELECT * FROM refblocksuav ord er by block asc ; −−3 ) E r r o r s o r r e s i d u a l s b e t w e e n UAV and r e f e r e n c e −− parameters CREATE TABLE errors as SELECT * FROM refblocksuav ; ALTER TABLE errors ADD column r e s H f a v e d o u b l e p r e c i s i o n , ADD column r e s H f m e d d o u b l e p r e c i s i o n , ADD column E r r o r a r e a d o u b l e p r e c i s i o n ; UPDATE errors SET E r r o r a r e a = a r e a r e f −a r e a u a v , r e s H f a v e = a v e r e f h f −ave hfuav , r e s H f m e d= m e d r e f h f −m e d h f u a v ; −−4 ) E r r o r s o f v o l u m e s e s t i m a t e d b y UAV ALTER TABLE errors 323 ADD column E r r o V o l h f u a v m e d d o u b l e p r e c i s i o n , ADD column E r r o V o l h f u a v a v e d o u b l e p r e c i s i o n , ADD column R E L E r r o r V o l h f u a v m e d d o u b l e p r e c i s i o n , ADD column R E L E r r o r V o l h f u a v a v e d o u b l e p r e c i s i o n ; UPDATE errors SET E r r o r V o l h f u a v m e d = v o l r e f m e d b l o c k −med voluav , R E L E r r o V o l h f u a v m e d =( a b s ( v o l r e f m e d b l o c k −m e d v o l u a v ) /volrefmed block ) * 100; UPDATE errors SET E r r o r V o l h f u a v a v e = v o l r e f a v e b l o c k −ave voluav , R E L E r r o V o l h f u a v a v e =( a b s ( v o l r e f a v e b l o c k −ave voluav ) / v o l r e f a v e b l o c k ) * 100; −−5 ) CREATE t a b l e o f a l l e r r o r s a c h i e v e d f o r t h e s t u d y DROP TABLE i f exists evaluation ; CREATE TABLE evaluation as SELECT b l o c k , E r r o r a r e a , r e s H f a v e , r e s H f m e d , E r r o r V o l h f u a v m e d , R E L Er r o V o l h f u a v m e d , E r r o r V o l h f u a v a v e , R E L E r r o V o l h f u a v a v e , t h e g e o m FROM errors ORDER BY bloco ASc ; SELECT * FROM e r r o s v o l u m e s u a v a r e a r e f ORDER BY bloco ASc ; 324