요소 (elements 또는 data primitives)는 오픈스트리트맵의 실제 세계를 다루는 데이터 모델의 기본 구성요소다. 다음과 같이 구성되어 있다.
- 노드 (node, 공간 상의 점을 정의),
- 웨이 (way, 선형 피쳐(linear feature)과 지역의 경계를 정의),
- 관계 (relation, 다른 요소가 어떻게 같이 작동하는지 설명하는데 쓰임).
위에 있는 모든 것은 한 개 이상의 연관된 태그 (특정 요소의 의미를 설명하는데 쓰임)를 가질 수 있다.
- 주요 문서：Node
노드는 지표면 위의 위도와 경도로 표현되는 한 점을 나타낸다. 노드는 id를 나타내는 수와 좌표쌍으로 구성되어 있으며, 다른 요소도 포함할 수 있다.
노드는 독립된 점 피쳐(point feature)를 정의하는 데 쓸 수 있다. 예를 들어보면 노드로 공원 벤치나 우물을 나타낼 수 있다.
- 주요 문서：Way
웨이는 다중선(polyline)을 정의하는 2개에서 2000개의 노드의 정렬된 목록이다. 웨이는 강이나 도로 같은 선형 피쳐(linear feature)를 나타내는 데 쓰인다.
Ways can also represent the boundaries of areas (solid polygons) such as buildings or forests. 이 경우 웨이의 첫 번째 노드와 마지막 노드가 같을 것이다. 이를 "closed way"라고 한다.
Note that closed ways occasionally represent loops, such as roundabouts on highways, rather than solid areas. The way's tags must be examined to discover which it is.
Areas with holes, or with boundaries of more than 2,000 nodes, cannot be represented by a single way. Instead, the feature will require a more complex multipolygon relation data structure.
- 주요 문서：Relation
- A route relation, which lists the ways that form a major (numbered) highway, a cycle route, or a bus route.
- A turn restriction that says you can't turn from one way into another way.
- A multipolygon that describes an area (whose boundary is the 'outer way') with holes (the 'inner ways').
Thus, relations can have different meanings. The relation's meaning is defined by its tags. Typically, the relation will have a 'type' tag. The relation's other tags need to be interpreted in light of the type tag.
The relation is primarily an ordered list of nodes, ways, or other relations. These objects are known as the relation's members.
Each element can optionally have a role within the relation. For example, a turn restriction would have members with "from" and "to" roles, describing the particular turn that is forbidden.
A single element such as a particular way may appear multiple times in a relation.
- 주요 문서：Tag
All types of data element (nodes, ways and relations) can have tags. Tags describe the meaning of the particular element to which they are attached.
A tag consists of two free format text fields; a 'key' and a 'value'. Each of these are Unicode strings of up to 255 characters. For example, highway=residential defines the way as a road whose main function is to give access to people's homes.
There is no fixed dictionary of tags, but there are many conventions documented on this wiki (starting with the Map Features page). Tag usage can be measured with the Taginfo application. If there is more than one way to tag a given feature, it's probably best to use the most common approach.
Within the OSM database, we store these attributes for nodes, ways and relations. Your application may not need to make use of all of them, and some third-party extracts produced from OSM data may not reproduce them all.
|id||integer||Used for identifying the element. Element types have their own ID space, so there could be a node with id=100 and a way with id=100, which are unlikely to be related or geographically near to each other.|
|user||string||The display name of the user who last modified the object. A user can change their display name|
|uid||integer||The numeric user id. of the user who last modified the object. The user id. number will remain constant.|
|timestamp||W3C Date and Time Formats||마지막 수정 시간|
|whether the object is deleted or not in the database, if visible="false" then the object should only be returned by history calls.|
|version||integer||The edit version of the object. Newly created objects start at version 1 and the value is incremented by the server when a client uploads a new version of the object. The server will reject a new version of an object if the version sent by the client does not match the current version of the object in the database.|
|changeset||integer||The changeset in which the object was created or updated.|
Of course in addition we store the tags, and also a full editing history of every element.