All Projects → thomersch → gosmparse

thomersch / gosmparse

Licence: MIT license
Processing OpenStreetMap PBF files at speed with Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to gosmparse

pydriosm
PyDriosm: an open-source tool for downloading, reading and PostgreSQL-based I/O of OpenStreetMap data
Stars: ✭ 42 (-23.64%)
Mutual labels:  openstreetmap, osm, pbf
osm4scala
Scala and Spark library focused on reading OpenStreetMap Pbf files.
Stars: ✭ 62 (+12.73%)
Mutual labels:  openstreetmap, osm, pbf
literan-moscow
No description or website provided.
Stars: ✭ 18 (-67.27%)
Mutual labels:  openstreetmap, osm
osmcz
JS mapová appka pro openstreetmap.cz (osmcz-app)
Stars: ✭ 35 (-36.36%)
Mutual labels:  openstreetmap, osm
gazetteer
OSM ElasticSearch geocoder and addresses exporter
Stars: ✭ 93 (+69.09%)
Mutual labels:  openstreetmap, osm
osm-parquetizer
A converter for the OSM PBFs to Parquet files
Stars: ✭ 71 (+29.09%)
Mutual labels:  openstreetmap, pbf
maproulette2
MapRoulette back-end / API
Stars: ✭ 46 (-16.36%)
Mutual labels:  openstreetmap, osm
Osmunda
An offline geocode library for android, powered by SQLite, using osm data. 离线地理编码Android库,基于SQLite,使用开放街道地图数据。
Stars: ✭ 37 (-32.73%)
Mutual labels:  openstreetmap, osm
3D-Public-Transport-Simulator
The 3D Public Transport Simulator is a Unity-based simulation, which uses OpenStreetMap data in order to support the simulation of worldwide locations. The development was part of a Bachelor thesis.
Stars: ✭ 87 (+58.18%)
Mutual labels:  openstreetmap, osm
a11yjson
A11yJSON: A standard to describe the accessibility of the physical world.
Stars: ✭ 58 (+5.45%)
Mutual labels:  openstreetmap, osm
NotesReview
📝 Interface for searching and resolving OpenStreetMap notes
Stars: ✭ 34 (-38.18%)
Mutual labels:  openstreetmap, osm
mapcontrib
Thematic OpenStreetMap contribution
Stars: ✭ 63 (+14.55%)
Mutual labels:  openstreetmap, osm
openstreetmap-americana
A quintessentially American map style
Stars: ✭ 89 (+61.82%)
Mutual labels:  openstreetmap, osm
AndroidApp
CityZen Android App, OpenStreetMap base-map
Stars: ✭ 70 (+27.27%)
Mutual labels:  openstreetmap, osm
ciclomapa
Beautiful, interactive & open bike maps of Brazilian cities. Powered by OpenStreetMap.
Stars: ✭ 56 (+1.82%)
Mutual labels:  openstreetmap, osm
openfairdb
Open Fair DB is the CreativCommons Backend of Kartevonmorgen.org
Stars: ✭ 53 (-3.64%)
Mutual labels:  openstreetmap, osm
osm-data-classification
Migrated to: https://gitlab.com/Oslandia/osm-data-classification
Stars: ✭ 23 (-58.18%)
Mutual labels:  openstreetmap, osm
osmot
Preprocessor for make public transit maps from Openstreetmap data
Stars: ✭ 14 (-74.55%)
Mutual labels:  openstreetmap, osm
Delphi OSMMap
Visual control for Delphi and Lazarus to display OSM map
Stars: ✭ 27 (-50.91%)
Mutual labels:  openstreetmap, osm
oshdb
OpenStreetMap History Data Analysis Framework
Stars: ✭ 82 (+49.09%)
Mutual labels:  openstreetmap, osm

OpenStreetMap PBF Parser in Go

GoDoc

gosmparse uses a callback driven API, which is stable (Documentation).

It has been designed with performance and maximum usage convenience in mind; on an Intel Core i7-6820HQ with NVMe flash it is able to process ~75 MB/s, so a planet file can be processed in under 10 minutes. If you find possible speed-ups or other improvements, let me know.

Characteristics

  • fast
  • tested with different files from different sources/generators
  • more than 85% test coverage and benchmarks for all hot spots
  • one dependency only: protobuf package (a few more are used by tests and are included in the module)
  • can read from any io.Reader (e.g. for parsing during download)
  • supports history files

Non-Features

  • Does not build geometries
  • No element cache

Install

go get -u github.com/thomersch/gosmparse

Example Usage

// Implement the gosmparser.OSMReader interface here.
// Streaming data will call those functions.
type dataHandler struct{}

func (d *dataHandler) ReadNode(n gosmparse.Node)         {}
func (d *dataHandler) ReadWay(w gosmparse.Way)           {}
func (d *dataHandler) ReadRelation(r gosmparse.Relation) {}

func ExampleNewDecoder() {
	r, err := os.Open("filename.pbf")
	if err != nil {
		panic(err)
	}
	dec := gosmparse.NewDecoder(r)
	// Parse will block until it is done or an error occurs.
	err = dec.Parse(&dataHandler{})
	if err != nil {
		panic(err)
	}
}

Download & Parse

It is possible to parse during download, so you don't have to wait for a download to finish to be able to start the parsing/processing. You can simply use the standard Go net/http package and pass resp.Body to the decoder.

resp, err := http.Get("http://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf")
if err != nil {
	panic(err)
}
defer resp.Body.Close()
dec := gosmparse.NewDecoder(resp.Body)
err = dec.Parse(&dataHandler{})
if err != nil {
	panic(err)
}

Did it break?

If you found a case, where gosmparse broke, please report it and provide the file that caused the failure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].