|Recommended for advanced users only.|
Your country has a boundary with the tags (boundary = administrative) and (admin_level = 2). If you want to define lesser units such as provinces or states, counties or municipalities, feel free to draw those boundaries yourself. However be sure to tag your boundaries with the appropriate "admin_level" and include them in appropriate relations.
- 1 Before you start
- 2 Drawing boundaries
- 3 Grouping boundaries into relations
- 4 Naming the administrative unit
- 5 Finding the area on OGF:Area_table
- 6 Which units are visible at different zoom levels?
Before you start
| Before drawing administrative boundaries, remember that:
So in order to create realistic boundaries, it's usually a good idea to plan the overall layout of your country first (possibly using our country planning tutorial) so that you know where the high-density and low-density areas will be, as well as the location of major rivers and mountain ranges that would likely form many of the boundaries.
In other words, it's much easier to plan your country's natural layout and population pattern first, and then draw boundaries in logical places; as opposed to drawing boundaries first, and then trying to figure out a natural layout and population pattern that make sense given those boundaries.
Administrative boundaries are drawn as ways and tagged as:
- boundary = administrative
- admin_level = x (= 2, 4, 6 or 8)
Which admin_level to use
Since each country has its own hierarchy of administrative divisions, the "admin_level" numbers must be adapted to fit each national system.
The general pattern is: low number = large unit, high number = small unit.
|country||independent country / "Staat"|
|(semi independent unit)||(e.g. united kingdoms)|
||state, province||first level under country / "Land"|
||county||level under state / "Kreis"|
||municipality||cities**, towns, villages, other municipal units / "Stadtteil, Gemeinde"|
| *The admin_levels 3, 5 and 7 are reserved for special cases (semi-independent areas, etc.) and may not be displayed on the map. For more information see OSM wiki for usage of the admin_level tag in real world countries.|
**Some cities may qualify for other levels. For example Washington DC is the equivalent of a state, so its level is 4. Baltimore is a county equivalent, so its level is 6.
For boundary ways serving multiple units with different admin_levels, the lowest admin_level number should be used. For example, if a boundary way forms part of a national boundary and a provincial boundary, then its admin_level should be 2.
If three (or more) boundaries meet at a point, then each way must end there. If not, you will get a problem later on with the relations of your areas. If a newly drawn boundary meets an existing boundary way, then the existing boundary way must be divided into two segments (use the scissor-tool) splitting the way at the point of intersection.
If the existing boundary way was already included in relations, the editor automatically adds both new segments to all their existing relations — therefore you do not need to do anything. The relations are updated automatically.
Grouping boundaries into relations
In some cases, boundaries may appear correct on the map even if they are not included in a relation. However every boundary should be included in the appropriate relations. Relations group the boundaries together and tell us which areas they are enclosing. Relations are also used by the automatic area calculation program which displays its results at List of OGF polygon areas. Correct relations for an area are also important to ensure that the name of the area is shown on the map.
Normally a boundary way is part of two relations, one on each side of the boundary. (Boundaries bordering the open sea may have only one relation, since there is no country on the other side of the boundary.) Often a boundary way is part of many more relations, at different admin_levels. For example if a way is part of a state boundary and also a county boundary, then it is included in 4 relations (State A and State B, County C and County D). If it is part of national, state and county boundaries, then it is included in 6 relations (Country 1 and Country 2, State A and State B, County C and County D).
Each relation normally contains 6 tags:
- type = boundary
- boundary = administrative
- admin_level = x (= 2, 4, 6 or 8)
- place = state (for level 4), county (for level 6) or city/town/suburb/etc. (for level 8)
- ref = the short reference (standard abbreviation, usually 2 or 3 capital letters)*
- name = the name of your administrative unit
*The "ref" tag is especially useful for states/provinces, because at a lower zoom level (zoom level 4) the OGF map will display the reference instead of the full name of the state/province. In other cases it is useful to define the relation. The reference normally is two or three capital letters, such as MA for "Montes Azul" or MYP for "My province" or "XX_01" (where XX means the country and the number the province), but this depends on the country.
Add all segments (ways) of the boundary of an area to the relation, making sure to label each one as "outer." It is important that all the boundary ways around the administrative unit are included in the same one relation, so that the members of the relation form a fully enclosed polygon around the administrative unit.
To create a relation in iD 1.3.6
Select a boundary way, click the "+" button beneath "All relations" and select "New Relation..." to create a new relation. Then click the "Boundary" button, enter the name of the administrative unit under "Name," select "administrative" for Type, and enter the admin_level and other tags as appropriate. Once the relation is created, you can add other boundary ways to the relation by selecting them, clicking the "+" button beneath "All relations" and simply selecting the relation from the list.
To create a relation in JOSM
Select a boundary way, click the "Create a new relation" button in the "Relations" panel, add tags as appropriate under "Key" and "Value" (type=boundary, boundary=administrative, admin_level=x, etc.) then move the way from the "Selection" panel to the "Members" list by using one of the arrow buttons. Under "Role," type "outer" and then click OK to save changes. To add another boundary way to the relation, simply select the boundary way and the appropriate relation in the "Relations" panel, then click the "Call relation editor for selected relation" button . Then move the way from "Selection" to "Members" list, using an arrow button as before, and again typing "outer" under "Role" and click OK to close.
To create a relation in Potlatch 2
Select a boundary way and go into "Advanced" mode, where you can click "Add to," which opens a new window displaying the existing relations in the area. If the relation you need is on the list, simply select it. In case you need to make a new relation, click on "New Relation." Scroll down the right sidebar of the new window to the bottom, where the edit buttons are located. In "Advanced" mode, you can access another window where you can write your tags for the new relation. Once you have finished the last tag, close the window.
Naming the administrative unit
In order for the name of your administrative unit to appear on the map in different map styles, you must also create a place (with a simple place node) for the name. Please tag this place as:
- place = state (level 4), county (level 6) or city/town/suburb/etc. (level 8)
- ref = the "ref" tag for this area (if it refers to a relation with a "ref" tag)
- name = the name of the relation for this area
And congratulations, you're done!
Finding the area on OGF:Area_table
If your relations are correct, the OGF:Area_table will tell you the area of each one in km² — for all areas, at all admin_levels.
If a relation is not correct, however, the list will show the area as being "0" km².
There are different reasons why this may have happened:
- The relation may have a gap, where one piece of boundary is not included in the relation. If you click the relation's number in the "id" column of the area table, you will see a gap in the red line on the map. You can fix the problem by including the missing segment in the relation.
- The relation may include a piece of boundary which is not part of the area (usually this is caused by forgetting to cut a boundary at a three-way intersection).
- A boundary way may be duplicated (this is not easy to discover - move one node in the boundary, and you may see the other).
- A boundary way may not have been been declared as "outer."
- The boundary ways may not fully meet at an intersection (you may not spot this unless you zoom in to the 20m level or so).
- Instead of one relation, the area may be enclosed by two or more relations, each forming only part of the perimeter.
Which units are visible at different zoom levels?
When looking at the map on the OGF website, the "layers" button on the right hand side allows you to view the map in different styles. These styles show the names and boundaries of administrative units differently at various zoom levels. For example, although "county" boundaries can be seen at various zoom levels, "county" names will not appear in the Standard map style or in the TopoMap style, but can be seen in the "Histor"-style.
|Country name||2||displayed at zoom 3 - 5||not displayed||displayed at zoom 2 - 6 (in ALL CAPS)|
|Country boundary||2||displayed at zoom 4 and higher||displayed at zoom 6 and higher||displayed at zoom 4 and higher|
|State reference (abbreviation)||4||displayed at zoom 4||not displayed||displayed at zoom 4|
|State name||4||displayed at zoom 5 - 8||not displayed||displayed at zoom 5 - 8|
|State boundary||4||displayed at zoom 4 and higher||displayed at zoom 6 and higher||displayed at zoom 4 and higher|
|County name||6||not displayed||not displayed||displayed at zoom 9 and higher|
|County boundary||6||displayed at zoom 11 and higher||displayed at zoom 10 and higher||displayed at zoom 9 and higher|
|special unit - boundary||7||displayed at zoom 12 and higher||not displayed||displayed at zoom 10 and higher|
|Municipality name||8||displayed at zoom 12 and higher||displayed at zoom 13 and higher||displayed at zoom 12 and higher|
|Municipality boundary||8||displayed at zoom 12 and higher||not displayed||displayed at zoom 12 and higher|
If there are more questions, please ask on the Discussion page of this article.