OpenStreetMap初探(二)——osm的数据结构

更新时间:2023-06-04 01:02:34 阅读: 评论:0

OpenStreetMap初探(⼆)——osm的数据结构
在(⼀)中⼤体了解了OpenStreetMap。
地图是如何花花绿绿地呈现出来的呢?⾸先,看⼀下OpenStreetMap的数据结构:
OpenStreetMap的元素(数据基元)主要包括三种:点()、路()和关系(R),这三种原始构成了整个地图画⾯。其中,定义了空间中点的位置;定义了线或区域;R(可选的)定义了元素间的关系。
Node
通过经纬度定义了⼀个地理坐标点。同时,还可以=*标⽰物体所海拔;通
Way
和平协议通过2-2000个点(nodes)构成了way。way可表⽰如下3种图形事物(⾮闭合线、闭合线、区域)。对于超过2000 nodes的way,可以通过分割来处理。
Open polyline
⾮闭合线:收尾不闭合的线段。通常可⽤于表⽰现实中的道路、河流、铁路等。
Clod polyline
太空有多少个星球
闭合线:收尾相连的线。例如可以表⽰现实中的环线地铁。
Area
区域:闭合区域。通常使⽤=*来标⽰区域等。
Relation
⼀个可由⼀系列nodes, ways 或者其他的relations来组成,相互的关系通过来定义。⼀个元素可以在relation中被多次使⽤,⽽⼀个relation可以包含其他的relation。
Tag
标签不是地图基本元素,但是各元素都通过tag来记录数据信息。通过'key' and a 'value'来对数据进⾏记录(了解xml或者数据库的应该都⽐较清楚了吧?)。例如,可以通过=来定义居住区道路;同时,可以使⽤附加的命名空间来添加附加信息,例如:=*就表⽰冬天的最⾼限速。
简单的说:
OSM数据由以下元素组成:
节点(Nodes): 最基本的要素,是其它要素的组成部分.
路线(Ways): 有⽅向性的节点序列, 在编辑器⾥显⽰成连接起来的线段.体育活动总结
闭合路线(Clod Ways): 闭合路线是完全闭合的路线. ⼀般⽤来表⽰区域如公园,湖泊,岛屿等.
所以这些元素都有标签,以描述地名,道路类型等信息。你可以⽤各种编辑器来创建元素和标签。
共同属性
Nodes, Ways 和 Relations 具有如下共同属性值:
name value description
ur string The display name of the ur who last modified the object. A ur can change their display name
uid integer The numeric ur id. of the ur who last modified the object. The ur id. number will remain constant.
timestamp time of the last modification
抹茶红豆蛋糕卷visible "true"
"fal"
whether the object is deleted or not in the databa, if visible="fal" 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 rver when a client uploads a new version of the object. The rver will reject a new version of an object if the version nt by the client does not match the current version of the object in the databa.
changet integer The  in which the object was created or updated.
从别⼈的博客偷⼏个例⼦过来(望博主不要⽣⽓,呵呵):
Nodes
<osm version="0.6" generator="OpenStreetMap rver">
<node id="483034256" lat="55.9458449" lon="-3.2035477" version="1"
changet="2369219" ur="spytfyre" uid="166957" visible="true"
timestamp="2009-09-04T13:35:42Z">
<tag k="name" v="The Blue Blazer" />
<tag k="amenity" v="pub" />
</node>
</osm>
显⽰效果:
Ways
<osm version="0.6" generator="OpenStreetMap rver">
<way id="43157302" visible="true" timestamp="2009-10-26T10:45:09Z"
version="1" changet="2954960" ur="Ed Avis" uid="31257">
<nd ref="540653724" />
<nd ref="25507043" />
<nd ref="107762" />
<nd ref="25507038" />
<nd ref="107759" />
<tag k="highway" v="primary" />
小雪花图片
<tag k="lcn_ref" v="6a" />
<tag k="name" v="Parliament Street" />
</way>
</osm>
ref =* 代表了连接成线的点。
Relations
<osm version="0.6" generator="OpenStreetMap rver">
<relation id="113421" visible="true" timestamp="2009-11-03T10:08:27Z"        version="2" changet="3023369" ur="Jonathan Bennett" uid="5352">        <member type="node" ref="270186" role="via" />
<member type="way" ref="4418767" role="from" />
<member type="way" ref="4641665" role="to" />
斐讯k2<tag k="restriction" v="no_right_turn" />
<tag k="type" v="restriction" />
怎么养蚕
</relation>
</osm>
表⽰:从id为"4418767"的way,经
tag
<osm version="0.6" generator="OpenStreetMap rver">
<node id="107775" lat="51.5072647" lon="-0.1278328" version="29"
changet="2628959" ur="EdinburghGael" uid="170586" visible="true"
timestamp="2009-09-25T23:04:28Z">
<tag k="place" v="city" />
<tag k="name:zh" v="伦敦" />
<tag k="name:sv" v="London" />
<tag k="name:sk" v="Londyn" />
<tag k="name:ru" v="Лондон" />
<tag k="name:fi" v="Lontoo" />
<tag k="name:es" v="Londres" />
<tag k="name:gv" v="Lunnin" />
<tag k="name:zh_pyt" v="Lúndūn" />
...
<tag k="is_in" v="England, United Kingdom, UK, Great Britain,Europe" />
<tag k="capital" v="yes" />
<tag k="name:fr" v="Londres" />
<tag k="name:cy" v="Llundain" />
黑板的英语怎么读
</node>
</osm>
使⽤tag,定义了伦敦市。
参考⽂献:
注:本博⽂多为⾃⼰参看资料整理翻译所得,能⼒所限,难免错误。欢迎各位同仁讨论批评指正。

本文发布于:2023-06-04 01:02:34,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/854003.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:闭合   定义   元素   区域   道路
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图