Using VBA and ArcMap to Create and Export 3D Buildings

Similar documents
Esri UC2013. Technical Workshop. Type Presentation Name Here

GEOGRAPHIC INFORMATION SYSTEMS Lecture 25: 3D Analyst

From 2D to 3D at Esri

Introduction to GIS 2011

An ESRI Technical Paper May 2007 Techniques for Consuming 3D Textured Objects in ArcGlobe and ArcScene

3D Analyst Visualization with ArcGlobe. Brady Hoak, ESRI DC

COPYRIGHTED MATERIAL. Introduction to 3D Data: Modeling with ArcGIS 3D Analyst and Google Earth CHAPTER 1

3D Data Modelling at Esri. Paul Hardy Business Development Consultant Esri Europe

Steps for Modeling a Proposed New Reservoir in GIS

3D Analysis Tools and Visualization with ArcGIS. Jie Chang Jinwu Ma

LAB #7 Creating TIN and 3D scenes (ArcScene) GISC, UNIVERSITY OF CALIFORNIA BERKELEY

Potential analysis for rooftop farming and rooftop PV in New Cairo

3D Modeling of Roofs from LiDAR Data using the ESRI ArcObjects Framework

Integrating CAD Data with ArcGIS

Surrey City Centre Digital 3D Building Model

Creating, managing and utilizing a 3D Virtual City in ArcGIS Tamrat Belayneh Eric Wittner

Surface Analysis with 3D Analyst

Display Layers in Geosoft 3D View

From 2D to 3D at Esri

Sharing 3D Content on the Web

Visualization with ArcGlobe. Brady Hoak

3D CITY MODELLING WITH CYBERCITY-MODELER

Exporting ArcScene to 3D Web Scenes. Documents. An Esri White Paper November 2013

Surface Creation & Analysis with 3D Analyst

Generation of 3D Models from Stereo-Digitized Vertex Points CE 503 Photogrammetry I Fall 2006, Updated Fall 2007

Your Prioritized List. Priority 1 Faulted gridding and contouring. Priority 2 Geoprocessing. Priority 3 Raster format

GIS IN ECOLOGY: VISUALIZING IN 3D

GIS IN ECOLOGY: VISUALIZING IN 3D

PUG List. Raster Analysis 3D Analysis Geoprocessing. Steve Kopp

Lab 18c: Spatial Analysis III: Clip a raster file using a Polygon Shapefile

The 3D Analyst extension extends ArcGIS to support surface modeling and 3- dimensional visualization. 3D Shape Files

Tools, Tips, and Workflows LP360 Under the Hood: Cross-sections LP360

Data Interoperability Advanced Use

Visualizing 2D Data in a 3D World

Introducing ArcScan for ArcGIS

Outline of Presentation. Introduction to Overwatch Geospatial Software Feature Analyst and LIDAR Analyst Software

Files Used in this Tutorial

Introduction to 3D Analysis. Jinwu Ma Jie Chang Khalid Duri

Feature Analyst Quick Start Guide

TOPOSCOPY, A CLOSE RANGE PHOTOGRAMMETRIC SYSTEM FOR ARCHITECTS AND LANDSCAPE DESIGNERS

Getting Started. Extruding Features. Convert to feature class

Setting up a 3D Environment for the City of Portland

3DCity: Create 3D city features

Contents What is 3D Mapping Creating g the 3D Dataset Ingredients of a 3D Virtual City Publishing 3D Globes The Road ahead Questions and Answers

Lidar Working with LAS Datasets

THE HONG KONG POLYTECHNIC UNIVERSITY DEPARTMENT OF LAND SURVEYING & GEO-INFORMATICS LSGI521 PRINCIPLES OF GIS

3D GIS MODELING APPLICATION FOR DEVELOPING THE BUTUAN CITY 3D MODEL

Building 3D models with the horizons method

GeoEarthScope NoCAL San Andreas System LiDAR pre computed DEM tutorial

Tutorial 17: Desert City Tutorial

A Second Look at DEM s

Answer the following general questions: 1. What happens when you right click on an icon on your desktop? When you left double click on an icon?

BASE FLOOD ELEVATION DETERMINATION MODULE

START>PROGRAMS>ARCGIS>

MODULE 1 BASIC LIDAR TECHNIQUES

ArcGIS Pro Editing: An Introduction. Jennifer Cadkin & Phil Sanchez

SPATIAL DATA MODELS Introduction to GIS Winter 2015

Measuring the Lengths of Receiving Polygon Edges

Lidar and GIS: Applications and Examples. Dan Hedges Clayton Crawford

Objectives Learn how GMS uses rasters to support all kinds of digital elevation models and how rasters can be used for interpolation in GMS.

Tools, Tips and Workflows LP360 Under the Hood - The Conflation Point Cloud Task LP360

Server Usage & Third-Party Viewers

Exelis Visual Information Solutions Capability Overview Presented to NetHope October 8, Brian Farr Academic & NGO Program Manager

CSTools Guide (for ArcGIS version 10.2 and 10.3)

ArcGIS Pro Editing. Jennifer Cadkin & Phil Sanchez

Creating and Maintaining Your 3D Basemap. Brian Sims Dan Hedges Gert van Maren

Getting Started With LP360

Leica 3D Disto PROJECTOR function for stair case applications

Translating your CAD Model to a VRML Model

Basic Tasks in ArcGIS 10.3.x

GPS/GIS Activities Summary

Digital Elevation Models (DEM)

Lab 7: Bedrock rivers and the relief structure of mountain ranges

New Features in TerraScan. Arttu Soininen Software developer Terrasolid Ltd

ArcMap - EXPLORING THE DATABASE Part I. SPATIAL DATA FORMATS Part II

Automatic generation of 3-d building models from multiple bounded polygons

About LIDAR Data. What Are LIDAR Data? How LIDAR Data Are Collected

GEO/GY461 Applied GIS: Environmental Geology of the Cheaha Mountain, AL, 7.5' Quadrangle Project

Building 3D Cities Using Esri CityEngine STUDENT EDITION

An Introduction to Using Lidar with ArcGIS and 3D Analyst

Tools, Tips, and Workflows Breaklines, Part 4 Applying Breaklines to Enforce Constant Elevation

Glacier Mapping and Monitoring

TERRA VISTA CONTENT CREATION

Digital Elevation Model & Surface Analysis

In this lab, you will create two maps. One map will show two different projections of the same data.

Converting AutoCAD Map 2002 Projects to ArcGIS

Bouncing ball animation made up of 6 frames

TrueOrtho with 3D Feature Extraction

Point Cloud Classification

I.1. Digitize landslide region and micro-topography using satellite image

for ArcSketch Version 1.1 ArcSketch is a sample extension to ArcGIS. It works with ArcGIS 9.1

Technical Specifications

Feature Analyst Quick Start Guide

Tutorial 18: 3D and Spatial Analyst - Creating a TIN and Visual Analysis

Delineating Watersheds from a Digital Elevation Model (DEM)

National Science Foundation Engineering Research Center. Bingcai Zhang BAE Systems San Diego, CA

Review of Cartographic Data Types and Data Models

Georeferencing & Spatial Adjustment

New Features in SOCET SET Stewart Walker, San Diego, USA

Objectives Learn how to work with projections in SMS, and how to combine data from different coordinate systems into the same SMS project.

Transcription:

Using VBA and ArcMap to Create and Export 3D Buildings Abstract Brian Bradshaw Layers in ArcScene containing polygon features can be extruded to create 3D blocks for display in the current scene. While this is useful for representing flat-roofed buildings within ArcScene it does not create a new, 3D shapefile and cannot create buildings with peaked or curved roofs. A method to create 3D shapefiles representing buildings with complex roofs and then export these objects to VRML was developed using a combination of VBA scripts and innovative editing of 3D shapefiles in ArcMap. Introduction Visual simulation systems use 3D databases composed of three main data sets: a digital elevation model (DEM) depicting the surface elevation, imagery and maps depicting the surface texture, and 3D objects representing cultural features. Photon Research Associates (PRA) develops 3D databases for a variety of high-end visual simulation systems. Various formats are used for the 3D objects in these systems including our own proprietary format and OpenFlight, the de-facto industry standard. While the final data is delivered to our customers in the format suitable for their simulation systems, much of the development work is performed using GIS software such as ESRI's ArcGIS and ERDAS Imagine. For many of our databases our customers are able to provide us with a GIS database of the area. Some of the more useful datasets from these GIS databases are polygon shapefiles representing building footprints. To take advantage of the building footprints a method was developed to convert the polygon shapefiles into 3D objects for use in simulation systems external to ArcGIS. A system was needed that could convert a single polygon shapefile representing the footprints of multiple buildings into a set of files representing individual 3D buildings in various external formats. Initially ArcScene was investigated to see if it could perform these functions. ArcScene provides the ability to extrude polygons to create 3D blocks for display in the current scene. This new scene with the 3D blocks can then be exported to Virtual Reality Modeling Language (VRML) format. While this technique can create simple, flat-roofed buildings it cannot create buildings with peaked or curved roofs. In addition, this technique does not create a new 3D shapefile, which limits the export format to VRML. Creation of a new 3D shapefile would provide the option of converting the shapefile to Drawing Exchange Format (DXF), a widely recognized format used in CAD systems. Finally, exporting the entire scene of extruded polygons from ArcScene to VRML creates a single file with all the objects. The

simulation systems used at PRA expect a separate file for each individual 3D object. Furthermore, these systems expect each object to use a self-referenced coordinate system, rather than the coordinates of a projection system, with the location of each object within the scene provided in a separate file. Methodology Initially it was uncertain how, or if, ArcGIS could be used to create buildings with complex rooftops. Investigating various methods for creating and editing 3D objects in ArcGIS all seemed to lead to dead ends. 3D Analyst and ArcScene provide the ability to create and view 3D objects, but there is no editing capability. ArcMap provides editing but it can only display features in the x-y plane. 3D Analyst provides a function for converting features to 3D however, for polygons this simply creates a polygonz feature, which is just a surface, not a true 3D object. Extruding polygons up to a roof height creates a multipatch feature, which is a true 3D object; however, ArcMap does not provide any functionality for editing multipatch features. Writing code to create the roofs or modify the multipatch features did not seem a viable alternative due to the complexity of the rooftops. After discussions with ESRI tech support and further investigation the method described in this paper was conceived based on two key capabilities in ArcGIS. First, while ArcMap doesn't allow editing of multipatch features it does provide editing of polygonz features. Second, just as polygons can be extruded upward to create flat roof buildings, polygonz features that have been edited to define a roof can be extruded down to the ground. With these two capabilities as a foundation, a multi-step process was developed which alternates between editing shapefiles in ArcMap and running Visual Basic for Applications (VBA) scripts. The shapefile editing in ArcMap consists of verifying building footprints match the underlying imagery, modifying footprint locations as needed, digitizing new building footprints if necessary, defining building height attributes, digitizing roof features, and editing z-values of the roof features. VBA scripts were written to access the ArcObjects functionality in 3D Analyst for polygon extrusion and format conversion. Included in these scripts is the separation of each building into an individual multipatch shapefile, which can then be converted to VRML or DXF format. Upon conversion to VRML the coordinates of each object are changed from the coordinates of the shapefile projection to a selfreferenced coordinate system with the origin at the center of the object. An additional script was written to create a file with the coordinates of each building in the scene. A form was developed to access each script to improve the user interface and all the forms were placed together as a set of menu items on a toolbar. The toolbar with the menu items, referred to as the 3D Building Generator, is shown as it appears in ArcScene in Figure 1.

Figure 1. 3D Building Generator Toolbar Edit Polygon Shapefile The first step in generating 3D buildings is to edit the polygon shapefiles that represent the building footprints. Most importantly, the polygons must match the location of the buildings in the imagery used in the simulation system. If a pre-existing set of data is available these footprints are compared directly to the image data and modified as necessary. When no polygon data exists, building footprints are digitized in ArcMap using the imagery. For the purpose of this paper, building polygons were digitized from a sample IKONOS image provided by Space Imaging. Next the height of the building walls and roofs must be defined as an attribute of the shapefile. These heights can be determined using shadows in the imagery or, if available, attributes in the pre-existing shapefiles. Heights can be calculated from shadow lengths using the solar elevation for the location,

time, and date of the imagery. NOAA has a convenient website, the NOAA Solar Position Calculator, for determining solar elevation. The user inputs latitude, longitude, date, and time and the site provides solar azimuth and solar elevation. Building height is then calculated using the equation h = s tan α, where h = building height, s = shadow length, and α = solar elevation. This technique is used to determine the heights of the building walls and the heights of the roofs above the wall. These heights are then added as an attribute to the shapefile. For buildings with complex roof structures at various heights it is helpful to cut the building polygon into several pieces. The separate polygons can then be given the proper height attributes. Figure 2 shows a set of polygons outlined in green representing the building footprints in the underlying image. The footprint of the building in the bottom of the image consists of several polygons. Each of these polygons corresponds to a different roof structure and is assigned a different height in the attribute table based on the shadows in the imagery.

Figure 2. Edited Polygons Displayed in ArcMap (IKONOS image courtesy of Space Imaging) Convert Polygon to PolygonZ Once the polygon shapefiles representing the building footprints are completed they are converted to polygonz format. The polygonz format enables each vertex of a polygon to have a z-value in addition to the x and y values of a simple polygon. The polygonz format does not allow multiple z-values for the same x, y position however, so it is basically a 2.5D surface like a triangulated irregular network (TIN). Conversion to polygonz format is done using a menu item provided with the 3D Analyst toolbar. This function is accessed by selecting "Convert" from the 3D Analyst toolbar and then selecting "Features to 3D..." This same function has been added as the first menu item in the 3D Building Generator toolbar. Figure 3 shows the form provided for this function. Figure 3. Convert Features to 3D Form The form lets the user specify the 2D shapefile to use for input and the name of the "3D" shapefile to be created. Heights used for the conversion can come from a surface such as a DEM, an attribute in the shapefile, or a constant value specified by the user. For our purpose we use an attribute specific to each

polygon representing the height of the building wall. The conversion from polygon to polygonz format assigns this same height to the z-value of each vertex in a given feature, resulting in a flat surface elevated above the ground. Figure 4 shows a set of polygons and the polygonz features created from them in a perspective view in ArcScene to illustrate this point. The original polygon features are shown in red and the polygonz features are shown in blue "floating" above them. Figure 4. Perspective View of Polygon and PolygonZ Features in ArcScene Edit PolygonZ Shapefile The new polygonz files simply represent a flat surface at the top of the building wall, or the ceiling. For a flat roof building this is sufficient to proceed to the next step, but for other buildings these polygonz files must be edited to define the varying heights of the roof. It should be noted that the 3D Building Generator toolbar shown in Figure 1 shows a menu item titled Add Roofs to PolygonZ Files. This menu item is simply a placeholder in anticipation of a future script that will automate this task. For now, editing the polygonz files involves digitizing to create the roof structure and editing the z-values of the

vertices in the edit sketch property dialog box. Figure 5 shows an edit sketch dialog box and results from editing the polygonz features to define the roof heights. Figure 5. Edited PolygonZ Roofs Displayed in ArcMap (IKONOS image courtesy of Space Imaging) The green outlines show the original polygons while the red lines show the editing done to the polygonz features. The peaked roofs in the bottom of the image are created by cutting a polygon into two pieces and editing the z-values of the new vertices in the edit sketch properties dialog box. The curved roof of

the hangar in the top of the image is created in a similar manner. In this case however, the original polygon was cut into multiple pieces to create a more gradual variation in heights. Figure 5 shows the edit sketch properties dialog box for one of the new polygons of the curved roof after the z-values of the new vertices have been edited. The other buildings shown in the image all have flat roofs so these features were not edited. Figure 6 shows the polygonz files in a perspective view in ArcScene to show the difference in the Z dimension before and after editing. These edited roof features represent one of the key elements of the process presented in this paper. Figure 6. Perspective View of PolygonZ Roof Features in ArcScene Extrude PolygonZ to Multipatch After the 2.5D polygonz files have been edited to define the rooftops they are ready to be extruded to create true 3D objects in multipatch format. A VBA script was written to perform this extrusion and the form shown in Figure 7 was created to execute this script. Code to open this form was added to the 3D Building Generator toolbar to create the Extrude PolygonZ to Multipatch menu item. This function

extrudes the polygonz roof features from the rooftops down to a base building height. The user specifies the polygonz shapefile to use for input, the name of the 3D multipatch shapefile to be created, and the base height of the building to extrude down to. Figure 7. Extrude PolygonZ to Multipatch Form The key elements of the VBA code written to extrude the polygonz features are as follows: Define interface for input polygon Dim pinpolyz As IPolygon Set pinpolyz = points to geometry feature from input shapefile Define interface to geometry environment to extrude features Dim pext As IExtrude Set pext = New GeometryEnvironment Acquire interface to output multipatch and extrude input polygon feature ' to dinz (base building height on form) to create multipatch feature. Dim poutmpatch As IMultipatch Set poutmpatch = pext.extrudeabsolute(dinz, pinpolyz)

Figure 8 shows the new multipatch objects extruded from the polygonz features shown in Figures 6 and 7. Figure 8. Perspective View of Multipatch Objects Extruded from PolygonZ in ArcScene (IKONOS image courtesy of Space Imaging)

Export Multipatch to VRML In order to use the newly created 3D objects in a simulation system outside of ArcScene they are exported to VRML format using the Export Multipatch Features to VRML form shown in Figure 9. This form was created to execute the VBA script written to perform the export. Code written to open the form was used to create the Export Multipatch to VRML menu item on the 3D Building Generator toolbar. This function converts a multipatch shapefile with multiple features into a set of single feature files in both VRML and multipatch shapefile format. Defining the output on this form is done slightly different than the previous forms. The user specifies the directory to create the files in and defines the file names using attributes from the input shapefile following a pre-defined naming convention. The output file names consist of the feature ID, building number, roof material, and wall material. This naming convention creates a unique file name for each building and identifies the material properties to use for that object in the simulation system. In order to use these objects in a simulation system they are converted from VRML to our own proprietary format using a C++ program. The conversion and subsequent use of these objects is outside the scope of this paper.

Figure 9. Export Multipatch Features to VRML Form The key elements of the VBA code written to export the shapefiles to VRML are as follows: ' Define the scene to export Dim psxdoc As ISxDocument Dim pscene As IScene Set psxdoc = ThisDocument Set pscene = psxdoc.scene ' Acquire interface from VRML exporter Dim pvrmlexporter As IVRMLExporter Set pvrmlexporter = New VRMLExporter ' Define VRML attributes With pvrmlexporter.indentation = True.Quality = 75.SaveOnlyVisible = False.UseElevationGrid = False.IsYUp = False.UseGeoVRML = False.MoveToOrigin = True End With ' Access 3d Scene Exporter methods for VRML exporter using Query Interface Dim p3dexporter As ISceneExporter3d Set p3dexporter = pvrmlexporter ' Export scene to VRML p3dexporter.exportscene pscene Create Object Center Coordinates File The conversion from multipatch shapefile to VRML format changes the x and y coordinates of the objects. The object coordinates are changed from a projection coordinate system to a self-referenced coordinate system for each object with the origin in the center of the object. In order to use the objects in a simulation system the location of the center of the objects in the scene must be defined. A VBA script and user form was created and added as a menu item to the 3D Building Generator toolbar to define the object locations. The form shown in Figure 10 creates a text file that defines the center coordinates of

the features in a shapefile with reference to the background image used in the simulation system. The coordinate file has three columns: the name of the object, and the x and y coordinates of the object center. The object name uses the same naming convention used when converting the multipatch shapefile to VRML format. The object center coordinates are defined from the scene center in pixel units. In order to calculate coordinates in this manner the user specifies the resolution of the background image and the center coordinates of the image in the same projection coordinates used for the shapefile. Conclusion Figure 10. Define Feature Center Coordinates Form ArcMap and VBA scripts that access the functionality of ArcObjects can be used to generate fairly complex 3D objects to represent a number of buildings over a large area, as shown in the image of

Edwards Air Force Base, CA in Figure 11. There are some limitations, however, in using this approach. ArcMap only allows editing of 2D or 2.5D features such as polygon and polygonz features but not 3D multipatch features. Since ArcMap is essentially a 2D editing system it is a bit cumbersome compared to 3D graphic editing tools such as CAD systems. For instance, ArcMap only provides graphic editing in the x and y dimensions. Changing a feature in the z dimension requires editing the z-value of vertices in a separate text box. Figure 11. Perspective View of Buildings in ArcScene (IKONOS image courtesy of Space Imaging)

Despite these limitations, ArcMap and ArcObjects is a useful method of creating 3D objects in certain situations. When imagery with building shadows and a pre-existing set of building footprints in the form of shapefiles are available this is a reasonable approach. For dense urban areas this approach may not be as useful. For dense urban areas it may be difficult to obtain valid shadow lengths from image data. Also, the awkward process of 3D editing in ArcMap may be too inefficient for the large number of complex buildings found in an urban area. Based on the success of this technique, further development is planned to increase the capabilities and improve the functionality of the 3D Building Generator. Additional VBA scripts are planned to apply textures to the buildings, encode surface normals for smooth shading, and create simple roof structures without the need for editing in ArcMap. Acknowledgements The initial development of the tools and processes presented in this paper was performed in support of the Small Business Innovative Research (SBIR) Phase II contract with Edwards Air Force Flight Test Center (AFFTC), contract number F04611-00-C-0053. The image of Edwards Air Force Base, CA was obtained from Imagery Samples CD version 3.1, from Space Imaging. The image is a one-meter, true color, 8-bit sample of data collected by the IKONOS satellite. Brian Bradshaw Mapping Scientist Photon Research Associates, Inc. 5720 Oberlin Drive San Diego, CA 92121 (858) 455-9741 ext. 204 bradshaw@photon.com www.gisexpress.com www.photon.com