Recent diary entries
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.
Questions & Comments
Please leave a comment if you know of any useful tips for 3D modeling, have a concern, or if you have any questions!
A relative of mine recently moved to the Rose Hill neighborhood of New York City, NY. As any mapper would, I was looking around the neighborhood on OpenStreetMap and found a missing street!
Broadway Alley_0575 by Lindsey Anderson on Flickr
broadway_alley by Callumb on Flickr
The alley remains a named street because it has a single address, 8 Broadway Alley, as evidenced by the NYC building and address import. The alley is also gated on each side, as it is a private road. Suffice to say, I added it to the map, have a look.
Update 11 Jan 2016: My friend took ten photos of the alley and shared them. Check out the gallery on Dropbox
Last year I began importing Maryland Department of Natural Resources lands but my progress slowed as I reached the populated areas of Central Maryland. Today I have restarted the process a bit with a custom translation for Paul Norman's ogr2osm tool.
Here are some beautiful new parks on the map:
- Patapsco Valley State Park, Howard County side (partially incomplete)
- Gambrill State Park, the state owned part
- Patuxent River State Park
Adding the parks is fairly manual but produces great looking map data. Let me know if you want to help out!
This week I had an off day and decided to get some exercise. It is hard for me to even think about working out anymore without also considering mapping. Ever since Strava started using OSM for its routing engine and for exercise maps, I've been motivated to use it because a) Strava is a lot of fun, and b) I like contributing back to OSM with it.
A new player in the OSM space that I am enthusiastic about is Mapillary. Mapillary is a service / app that allows users to shoot their own street-view imagery, and use it for OSM without fear of licensing issues. The typical use would be to attach a camera to a personal automobile and shoot street-view, but it works on a bicycle as well.
Since I enjoy touring around on my bike, I thought it'd be a great to get some Mapillary images at the same time! I purchased the Topeak iPhone 5 Mount and attached it to my handlebar. The Topeak mount comes with a special case, and it can hold the iPhone in practically any orientation.
Tuesday's Canton Ride
Driving around a neighborhood in a car seems boring to me, and is a waste of fossil fuel. On the other hand, exploring a neighborhood on foot or on a bike is fun and healthy. I decided that I would survey as much of my neighborhood as I could during the course of an afternoon with my Mapillary bike mount. It made for an interesting GPX track!
Seeing the track as a workout on the Strava iOS app, which uses OSM data via Mapbox to create the tiles was also cool to see:
In the end, I covered 16.5 miles without ever leaving my neighborhood, and rode in at least one direction on every street within the area I planned to survey.
Riding around on the bicycle and shooting Mapillary is fun! There are some limitations to using the iPhone app for capture though.
The battery. My old iPhone battery does not last long. I brought a backup battery charger for this reason, though it did come disconnected a few times, causing me to have several segments on my trip. Luckily the app doesn't seem to lose data when the phone dies.
Rolling shutter blur. Unfortunately, the iPhone camera suffers from motion blur (see below) when using it as an action cam. The a jolt from a bump in the road can cause a section of the image to look blurry. The only work around for this is to get a better action camera, or get a better action camera, like the GoPro or Garmin Virb.
Once the data is in Mapillary, it is really beneficial for mapping. Now users can view the images right in iD, as I did in the screenshot below. I have already fixed some incorrect roads in the neighborhood that I hadn't noticed before. With my images I was able to clearly see the street name, and where it ended based on the GPX.
Now get out there, get some exercise, and get mapping!
I made a relation for the former right of way of the Maryland & Pennsylvania railroad. Check it out here: http://www.openstreetmap.org/browse/relation/3058279
Abandoned rail rights of way are one of OSM's strong suits. These old paths are often used for trails or roads in modern times, thus they are beneficial.
Making this relation was pretty easy because all the ways were already there. I just connected them. There are some spurs that I could still add, and as I was scanning along the route, I was suprised by how many populated areas are not mapped well. I'll add them as map notes!
I attended State of the Map US in San Francisco from June 6 to June 10, 2013. Here is a summary of my thoughts on the events and the speakers. Firstly I want to thank OpenStreetMap US for the scholarship to attend this conference.
My first day at the conference consisted mostly of giving an hour long workshop on adding bus relations to OSM, one of my pet projects. Click the following links for the slides and the data. Please note that the data is no longer up to date. I have since added all the MTA 64 routes.
The workshop was an attempt to introduce folks to the basics of bus routes and their relations in OpenStreetMap. In effect, I was teaching the new public transport schema.
I think it went pretty well, though I have a few lessons learned. If I were to do this again, in the course of an hour, I’d do much less of a presentation at the beginning. Since people were paying to come to the talk, I thought I had to cram more info into the workshop. Instead, a lightning talk to start would have been good.
Some of the participants had never used JOSM, which is a pretty complex software at first glance. This meant that during my talk at SOTMUS, the whole group was slowed down by a few users that had trouble getting JOSM running. If I do this again, I’ll get there early and do at least 30 minutes of JOSM familiarization for folks. For instance, the right click and drag to scroll functionality isn’t intuitive to most.
The heart of the workshop was to make a bus route relation, but with the time setbacks, we didn’t end up accomplishing much. Still, I heard from folks afterwards and they said it helped them so they could know where to get started. My favorite feedback was this tweet from Ian V over at MapBox.