There is an interest in modeling 3D buildings on OpenStreetMap and in the community. Updates from map providers like Mapbox and Mapzen now support complex 3D building rendering. This diary gives an overview of the process used to add 3D buildings in Baltimore.
I am always looking for ways to improve the map of my hometown. I looked to Baltimore for some buildings to add in 3D. I found two to start.
The buildings, the Hyatt Regency Inner Harbor and One East Pratt Street, are prominent on Baltimore’s Skyline. Their representative shapes in OSM were blocky and missing parts. Having never understood the “simple” 3D mapping technique, I set out to learn how to improve them.
Learning Simple 3D Buildings
Before I could map, I had to learn the best practices. Looking around on the OSM Wiki, most sources point to the Simple 3D buildings article for instructions on how to do this. I read the wiki page a few times, but it didn’t make sense. The article was disjointed and lacked clarity. Before I could learn, I would have to improve the wiki.
I am currently taking an excellent course on Technical Writing. One recurring exercise is simplifying and improving blocks of text that are technical in nature. The Simple 3D buildings article is a perfect candidate for simplification. It appears to have been translated from German and then updated in a piecemeal fashion.
While my cleanup is still a work in progress, I have improved the Building Outline and Building Parts sections. I rewrote these sections objectively, using the Hemingway App and Grammarly to get the paragraphs down to primary school reading level. I added info-boxes and warnings where appropriate, and sliced the bulleted lists into heading separated sections (headings improve readability and searchability). I gave each section a name based on its general method, and added some descriptive text.
Rewriting the article helped me comprehend the process. There are three different ways to map a 3D building in this simple schema, but which is the simplest? The article listed three options but did not recommend one. I reviewed a few 3D buildings in New York City (namely the Consolidated Edison Company Building at 14th and 3rd) and noticed that the flat method seemed to be the most common. Though I like using relations, they can be cumbersome. After looking at buildings with 50 or more faces, I decided against the relation method in my own editing. Lastly, the slice method, though logical seemed unworkable in OSM editors, as overlapping shapes are hard to work with.
The flat method (my name) includes a building outline with legacy 2D tags, and interior building parts, with 3D tags. According to other wiki authors, 3D modelers ignore height information on the outline if there are any parts within, so this method requires covering every part of the outline with a part.
Getting the data together
Now that understood the process, I’d need good data to make it happen. I needed data:
- Street level imagery
- Aerial imagery
- Freely licensed photos
- My own photos
- LiDAR data
Street level imagery was easy to come by with great Mapillary coverage in Downtown Baltimore by users like mdroads. I used both Bing and Maryland’s orthophotos for aerial sources. There are freely licensed photos on Wikimedia Commons that are useful for getting a better view of key facades, and I used some of my own photos over the years (indexed by Google Photos) of these buildings for more detail. Finally, I just needed LiDAR.
LiDAR data is challenging to work with due to the data density, actually finding it, and the tools needed to view it.
In the US, NOAA hosts and provides LiDAR Data freely. Using their Data Access Viewer, I found a 2008 dataset for Baltimore that NOAA published in 2012. While there are sources for rendered LiDAR Digital Elevation Models, this data is useless in 3D building modeling as the buildings are removed. DEMs only show the “natural” surface elevation (see archaeosphere).
I used ArcMap to visualize and gather height information from the LiDAR data. The data is clipped into grid squares and compressed in LAZ format. I looked for the tiles that I’d need on the grid map and downloaded them. LAZ files are compressed and not usable directly in ArcMap in that format. I used the free LASzip tool to decompress the files into LAS format. In ArcMap, I created a new LAS dataset and added the extracted LAS files. The default symbology used for LAS data is a point field, and is not useful for visual review. I opted to use an elevation surface instead, and turned on the option to display the elevation as a Map Tip. The surface made it easy to get the height of a building part by just hovering over it.
With all of the data in place, it was time to map.
There are two useful tools for mapping 3D buildings in JOSM
- The 3D Simple Buildings preset, which makes tagging easier.
- The Kendzi3D JOSM plugin, which adds a 3D world viewer to JOSM for checking the results of 3D tagging on the fly.
Add the Outline
I happened to have worked on a project to import Baltimore’s buildings and addresses a few years ago. We didn’t know of a good height dataset at the time, and didn’t include height data in the import. I did keep the original data in OSM XML format, which included the buildings that were not imported due to intersects with existing data. Since the target buildings geometry as poor, I started by replacing the geometry in OSM with the outlines from the import dataset (preserving tags of course).
Though I rewrote and comprehend the tagging schema, it wasn’t clear if the outline should have the overall height tag. The Kendzi3D plugin suggested that this should be avoided, so I didn’t add the overall height to the outline.
Add the Parts
Adding the parts is crux of the 3D building effort. Using the aerial imagery sources, I traced each part of the buildings and added the height information using the tagging preset.
To determine the height for a part I used ArcMap. I’d hover the cursor over a few places on the building part, note the values, and average them. Jotting this average down, I’d switch back to JOSM and add the result to the building height value (generally rounding to one decimal place). See the wiki for more information about the height tags and when to use them.
The street level (Mapillary) imagery was useful for two reasons. First, I used it to get a sense of how each part fit with the whole, which isn’t always clear in an overhead view. Secondly, I used it for filling in the details for each part, such as the floor count, wall color and wall surface.
A proposal for a fourth dimension is underway in the community. The 4D Roof Table proposal adds temporal data as a fourth dimension and is not for the faint at heart. I did attempt to attempt to use it for the skillion shaped glass roof that covers the lobby at the Hyatt hotel. Mapping to that level of detail involves adding time information to the points on a roof, so that the rendering software can determine the direction of the roof pitch.
Checking the result
The Kendzi3D plugin is an excellent resource for checking how 3D buildings will look on the map. It shows a 3D world view of the currently active OSM layer in a separate window, and even has a few simple editing functions right in the viewer to make adjustments to height and roof pitch.
Uploading and viewing on OSM
After reviewing the parts and outline, I uploaded the data to the map. The default Mapnik viewer does not currently show 3D buildings, but there are a few that do.
- OSM Buildings renders buildings based on the Simple 3D schema, including colors and surfaces. OSM Buildings processes the data and periodically updates the map, so the data is not available immediately.
- Mapbox GL JS recently launched extruded building support, supporting the simple 3D schema. Mapbox GL JS is updated minutely, which means that new changesets are available for 3D viewing almost instantly. Mapbox’s AJ Ashton wrote an illustrated guide on mapping 3D buildings using the slice method, and it includes an embedded Mapbox GL JS viewer which you can use to pan around and view your city in 3D.
- Updated 14 Nov F4map renders 3D OSM data in near real time and supports all of the detailed Simple 3D tagging like wall color and roof color. It also adds some nice visual embellishments to the map.
Mapbox GL JS
F4map (link to location)
Though rich in detail, tagging for 3D is time consuming. I’d like to look for ways to improve existing buildings in Baltimore by intersecting them with the LAS surface and programmatically assigning maximum heights. This would provide a baseline to work with, and would allow mappers to focus in on the most important structures for 3D mapping.
I will also work to understand the methods better. Perhaps I can make a better recommendation after discussing this with peers. Looking at the Simple 3D article editing history, there are some disagreements over what is recommended, be it overlapping parts, slices or a relation.
I will continue to watch and improve the wiki. It needs better flow between sections and more information about the tags, such as the roof height.
Finally, I’ll continue to add 3D buildings as I can. I added a few more around Harbor East, and the Baltimore National Aquarium would be a fun project to try.
Please leave a comment if you know of any useful tips for 3D modeling, have a concern, or if you have any questions!