The MS Building Footprint dataset is now available to use with Daylight. I am part of the Microsoft Open Maps team, and I work with the team that produces the MS Buildings OSC. Seeing some questions and feedback from the OSM community regarding how to use the dataset, my goal is to make it an option for users to easily import the building footprints.
The goal of the MS Buildings OSC effort is to make sure that the building footprint IDs did not collide with current or future OSM Ids. Negative IDs were used in the ms-ml-buildings-v0.3.osc.bz2 and prior versions as it is discussed as a useful approach in the OSM wiki https://wiki.openstreetmap.org/wiki/OsmChange. Unfortunately, some of the tools used to work directly with planet files and changesets do not fully support working with negative IDs so here are some approaches using the existing tools for community members to use the MS building OSC. I investigated some workflows that use a changeset with negative IDs ms-ml-buildings-v0.3.osc.bz2, and for this release there is also a second changeset that uses positive IDs ms-ml-buildings-v0.3-positive.osc.bz2.
There are two different workflows that were tested that work with the Daylight Distribution and MS Building Footprints to create map tiles using only open source tools.
Use Osmium to apply .osc to the Daylight pbf and fix negative IDs before importing them to PostgreSQL database.
Use Osmium to apply the changes to the planet file. Example: “osmium apply-changes planet-v0.3.osm.pbf ms-ml-buildings-v0.3.osc.bz2 -o daylight-and-ms-ml-buildings-v0.3.pbf”
Use Osmium to reorder IDs. Example: “osmium renumber daylight-and-ms-ml-buildings-v0.3.pbf -o ordered-daylight-and-ms-ml-buildings-v0.3.pbf”
Use osm2pgsql to import the output PBF from previous steps
Import Daylight pbf then import MS Buildings
Use osm2pgsql to import Daylight pbf
Use osm2pgsql to import MS Buildings OSC using –append option
Both workflows result in a postgresql database with Daylight and MS Buildings data, but there are some tradeoffs. The first one requires a lot more RAM to process due to the size of the Daylight file and the MS Buildings OSC. However, this does produce a single PBF that tools like osmconvert can work with. The second approach is a little less computationally resource intensive, though it took longer with my setup. Using the MS Buildings OSC with negative IDs results in a postgresql database that has mixed positive and negative IDs, which worked but throws warnings and other tools that use the database may not all be compatible.
If you are following one of the ‘Creating_your_own_tiles’ guides on the OSM wiki https://wiki.openstreetmap.org/wiki/Creating_your_own_tiles, you can substitute the planet file from OSM with the Daylight Distribution + Buildings with either of the previous approaches. I used a Mapnik and Mod_tile guide to test, and from the Workflows above I created some rendered maps using Daylight and MS Buildings.
If you have any questions or feedback about the MS Buildings osc, you can reach me on the OSM US Slack, or in the #daylightdistro_feedback Slack channel in OSM US
Comment from mmd on 4 September 2020 at 12:20
Re negative ids and osm2pgsql: Are you aware of https://github.com/openstreetmap/osm2pgsql/issues/1097 ?