A Courtyard is a building with a hole in it.
Or rather, it is the portion of the building that is constructed without a roof. This may combine the shelter and safety from the surroundings provided by the building walls, with the benefits of natural light and a clear view of the sky. What could be more romantic than a candlelit dinner with your favourite person, under the stars, in the courtyard?
But wait! Trouble in paradise. My building with a courtyard just looks like an ordinary building in OpenStreetMap! How do I fix that?
You model the building data with a
What? Relations? Why relations?
The OpenStreetMap data structure has native support for points and polylines. Eveything else is constructed as a combination of those two structures, plus relations. A relation in OpenStreetMap terms is a set of instructions that say how one or more objects are related to each other.
Even areas, in OpenStreetMap data, are simply a special case of closed polyline. There has been discussion of a new, native area data type, but that does not exist in the present version of the OpenStreetMap data API. This article was written in early 2014, when the API was v0.6.
The Basics - an Inside and an Outside
The image above shows a school in Cambridge Ontario, with a courtyard, as modeled in OpenStreetMap data as a relation
The building is defined by two polylines, or
closed ways, one each for the
outer portion of the building. The
outer way defines the outside of the building. The
inner way defines the inside limit of the building. That inside limit of the building creates our courtyard.
The Tools - The JOSM Editor
The tutorial presumes that you are using the JOSM Editor. Download JOSM. JOSM is a complete and mature OpenStreetMap editor for users of any experience level.
Making a Multipolygon Relation
In JOSM, create a closed way for the outside of the building. You've probably already done this for many other buildings and polygon objects that you have contributed to OpenStreetMap.
Create a closed way for the inner limit of the building which will define the courtyard area.
That's it for the closed ways, for now. No tags are required for these building polygons because we will be placing the tags on the multipolygon relation.
Select both of the closed ways. Use SHIFT-Click to select a second and subsequent object when you want to choose more than one in JOSM.
Create a relation
Press CTRL-b to create a new relation from the selected ways.
Press ALT-s to edit the new relation. This will open the
edit relation dialogue box.
The two steps above, create relation and edit relation, have filled in some useful default information for you.
The two closed ways that were selected, are included as members of the relation. The ways have
roles set, as
outer. The relation type is set to
multipolygon. All of those are really useful defaults for this case. If the defaults are not correct for your polygon, this same dialogue box permits correcting them. If they look correct to you, carry on.
Add tags to the relation
The tags normally associated with a building way, are also suitable on a building realtion. So add the building tag, for it is a building, right?
- building = yes (or a more-specific value like school if appropriate)
- name = City School #123 (if appropriate)
- addr:housenumber = 5
- addr:street = Any Street
- operator = Local School Authority
And other tags that would be suitable, depending on the building. An address is almost always suitable and helpful.
Save your contribution
Save early and save often is a good guideline for contributions to OpenStreetMap. This is especially true when creating or editing your first multipolygon relations.
Upload you edit to the OpenStreetMap server. Be sure to include a helpful changeset comment. Something like,
my first multipolygon relation should define the courtyard in my old school. would not be out of line in this case.
And have fun!
Survey more of your neighbourhood and use multipolygon relations for complex models, like buildings with courtyards.
Would you like more tutorials?
If you would like to improve this tutorial, comment below.
If you like this tutorial, comment below, tweet, share or like on the social platform of your choice. And survey more of your neighbourhood to improve OpenStreetMap data.
Some map images include Tiles courtesy MapQuest.com.
Program screenshots are from JOSM - the Java OpenStreetMap editor.