imposm.parser
来源:互联网 发布:易宝软件深圳分公司 编辑:程序博客网 时间:2024/06/10 18:58
Concepts
To use imposm.parser you need to understand three basic concepts: Types, Callbacks and Filter
为了使用imposm.parser ,你需要理解其中的三个概念:类型,回调函数和过滤器
Types
Note
In this document Node, Way, Relation with a capital refer to the OSM types and node, way, relation refer to the Imposm types.
在本文中,node,way和relation分别对应osm数据中的node,way和relation。
OSM has three fundamental element types: Nodes, Ways and Relations. imposm.parser distinguishes the OSM Nodes between coords and nodes.
OSM的数据有三种基本的类型元素,分别是Nodes,ways和relations。imposm.parser会将Nodes区分为coords和nodes
coords only store coordinates and there are coords for every OSM Node. nodes also store tags and there are only nodes for OSM Nodes with tags.
coords只存储坐标和,而且OSM仲的每个Node都包含坐标,nodes还会存储tags,所以nodes只是指OSM数据中包含tags属性的Nodes
coords
A tuple with the OSM ID, the longitude and latitude of that node.
Coords是一个由OSM ID和纬度,经度组成的三元组,来表示一个Node
imposm.parser will return a coord for each OSM Node, even if this OSM Node is also a node (i.e. it has tags).
imposm.parser会返回每个OSM Node的coord,即使这个OSM Node也是一个包含tag的Node
nodes
A tuple with the OSM ID, a tags dictionary and a nested tuple with the longitude and latitude of that node.
Nodes是一个由OSM ID,tags的字典,以及一个经纬度的子元组组成的三元组
ways
A tuple with the OSM ID, a tags dictionary and a list of references.
ways是一个由OSM ID ,tags的字典以及一个引用的数组组成的三元组
relations
A tuple with the OSM ID, a tags dictionary and a list of member tuples. Each member tuple contains the reference, the type (one of ‘node’, ‘way’, ‘relation’) and the role.
relations是由ISM ID,tags的字典已经一个元组数组,其中每个元组都包含引用,类别以及关系。这三者组成了relations类型
Callbacks
The parser takes four callback functions for each data type (coords, nodes, ways and relations). The callbacks are optional, i.e. you don’t need to pass a relations callback if you are not interested in relations.
parser包含四个回调函数,他们的类别分别是coords,nodes,ways和relations。这些回调函数是可选的,比如如果你对relations不感兴趣,那就不需要传递relations的回调函数。
The functions should expect a list with zero or more items of the corresponding type.
这些回调函数的参数是对应类型的数组列表
Here is an example callback that prints the coordinates of all Nodes.
这是一个打印所有Nodes的坐标的回调函数的样例
Tag filters
Tag filter are functions that manipulate tag dictionaries. The functions should modify the dictionary in-place, the return value is ignored.
Tag filter是操作tag的字段的函数,这些函数应该在内部修改字典,他们的返回值是没用的,即不能通过返回值来修改字典。
Elements will be handled different, if you remove all tags from the dictionary. nodes and relations with empty tags will not be returned, but ways will be, since they might be needed for building relations.
每种不同的元素会被区别对待的处理,比如你删除了tags里面的所有元素,nodes和relations的空tags不会被返回,但是wats就会,因为他们可能被建筑之间的关系所需要。
Here is an example filter that filters the tags with a whitelist.
下面一个通过白名单过滤标签的样例,它会把白名单之外的标签都删除
- imposm.parser
- sql parser
- SAX Parser
- XML PARSER
- XML parser
- SAX Parser
- Parser Generator
- RM PARSER
- LL parser
- crontab parser
- HTML parser
- easyUI Parser
- Parser总结
- XML Parser
- opensaml parser
- html parser
- ini-parser
- Excel parser
- tensorflow学习三:通过mnist来理解深层神经网络的及优化问题
- Python 多线程,主线程与子线程
- IMS/SIP
- Python内置类型(2)——布尔运算
- iOS中如何实现单个页面支持横竖屏(其他页面只能竖屏)
- imposm.parser
- 生成无重复随机token
- eclipse无法查看源码的解决方案
- angular 获取json字符串
- Linux下php安装Redis扩展
- 三种技术对应的商业模式 – 抢夺IoT市场 三大技术上演争霸赛
- hibernate代理实现懒加载+cglib和jdk动态代理
- windows下,Kiwi_Syslog日志服务器的搭建
- Java 对象锁和类锁全面解析