Copyright | (c) Azavea 2017 - 2020 |
---|---|
License | BSD3 |
Maintainer | Colin Woodbury <colin@fosskers.ca> |
Safe Haskell | None |
Language | Haskell2010 |
This library provides the ability to read and process OpenStreetMap data via the streaming ecosystem. Since streaming allows for very little RAM overhead despite file size, we can process very large OSM PBF files just by providing a file path:
import Streaming import Streaming.Osm import qualified Streaming.Prelude as S -- | Count all nodes. count :: IO () count = do len <- runResourceT . S.length_ . nodes . blocks $ blobs "yourfile.osm.pbf" print len
Synopsis
- blobs :: FilePath -> Stream (Of Blob) RIO ()
- blocks :: Stream (Of Blob) RIO () -> Stream (Of Block) RIO ()
- nodes :: Stream (Of Block) RIO () -> Stream (Of Node) RIO ()
- ways :: Stream (Of Block) RIO () -> Stream (Of Way) RIO ()
- relations :: Stream (Of Block) RIO () -> Stream (Of Relation) RIO ()
- type RIO = ResourceT IO
Streams
blocks :: Stream (Of Blob) RIO () -> Stream (Of Block) RIO () Source #
Every Block
of ~8000 Elements.
Util
type RIO = ResourceT IO Source #
A friendly alias. All Stream
s in this module are constrained to this
type for optimal performance. The opposite, say:
nodes :: Monad m => Stream (Of Block) m () -> Stream (Of Node) m ()
will actually run significantly slower.
After evaluating your Stream
to some final RIO
, you can further
escape back to IO
via runResourceT
.