读取OSM数据
在上一篇我们叙述了OSM数据的主要数据结构,包括Node,Way,Relation,因此读取OSM数据的关键就是如何将Node,Way,Relation的数据读取出来,并组成我们所需要的数据结构。
由于时间紧张,我们直接采用了OsmSharp提供的数据解析功能解析数据,在这里要感谢原作者的辛勤劳动。OsmSharp的项目地址位于https://github.com/xivk/OsmSharp,大家可以去关注以下。
转换为Geojson数据
读取OSM数据以后,可以将通过自己编写的程序直接将数据转换为geojson数据并保存到本地。
实现思路如下:

接口定义如下:

实现效果




网友评论