Zh-hans:OSM file formats

From OpenStreetMap Wiki
Jump to navigation Jump to search

地图数据

下面是最主要的几种地图格式:

  • PBF Format – 压缩度高,优化的二进制格式,与API相似,推荐进行数据处理
  • OSM XML – API提供的XML格式。请尽量使用PBF格式。
  • OSM JSON - API提供的JSON格式,基于Overpass API JSON格式。
  • o5m – 快速处理用途,使用PBF编码,与XML格式相同结构,软件部分支持
  • Overpass JSON – OSM XML的JOSN变体,被Overpass API使用
  • Level0L – 更可读的OSM XML,没有“<>”,更少的冗余

Conversion between different OSM map data formats

Software OSM XML OSM JSON/

Overpass JSON

PBF o5m Discussion / comments
Osmium 是 没有 是 read only use the Osmium command line tool or see osmium_convert in examples directory
osmconvert 是 没有 是 是 own PBF implementation (does not use a library)
Osmosis 是 没有 是 没有 software unmaintained but still in wide use
osm4j 是 没有 是 没有

ToDO: Add matrix which tool converts with format to which target format...

Splitting one big file into different geographical regions

Filter for specific tags

File formats for diffs

Format Pros Cons Supported by
OsmChange
  • Streamable

When sorted properly this file is a continuous stream of changes that can be played in order. In osmosis the option --sort-change will put the change into streamable order.

  • Doesn't indicate source of data
o5c
  • streamable
  • can be processed very fast (uses PBF like encoding, similar to .o5m format)
  • small file sizes even when not compressed
  • not human-readable
  • cannot be modified directly with texteditors
Augmented Diffs id-sorted version
  • streamable
  • real diff as before and after values are included
JOSM_file_format
  • Supports placeholders
  • Indicates the source of the data
  • Not streamable

TODO: Insert content from XML#Flavours (pros + cons, etc)

Tools for applying diffs to map data files

Tools for creating diff files

Other variants of OSM map data

  • JOSM file format – non-indexed xml-format similar to the API
  • Spaten - Spaten format by Thomas Skowron (based on PBF and WKB)
  • OSM Express on-disk format based on LMDB and S2
  • mapsplit compact tiled raw OSM data in pbf format suitable for editors and other applications that need fast, offline access.

Application specific formats which are not intended to carry complete OSM data

See also