Copyright | (c) Azavea 2016 |
---|---|
License | Apache 2 |
Maintainer | Colin Woodbury <cwoodbury@azavea.com> |
Safe Haskell | None |
Language | Haskell2010 |
Most of the details of Protobuf conversion are kept in Geometry.VectorTile.Protobuf.Internal, a module which is not intended to be imported.
A user's main concern here should be the Protobuffable
class, and its
VectorTile
instance. With it, one can do the following:
import Geography.VectorTile.Protobuf decode bytes >>= fromProtobuf -- Either Text VectorTile
which in fact is sugared in the top-level module of this library as:
decode bytes >>= tile
- class Protobuffable a where
- decode :: ByteString -> Either Text RawVectorTile
- encode :: RawVectorTile -> ByteString
- decodeIO :: FilePath -> IO (Either Text RawVectorTile)
- encodeIO :: RawVectorTile -> FilePath -> IO ()
Types
class Protobuffable a where Source #
A type which can be converted to and from an underlying Protobuf type,
according to the Protobuf
type family.
fromProtobuf :: Protobuf a -> Either Text a Source #
toProtobuf :: a -> Protobuf a Source #
ByteString Encoding / Decoding
decode :: ByteString -> Either Text RawVectorTile Source #
Attempt to decode a ByteString
of raw protobuf data into a mid-level
representation of a RawVectorTile
.
encode :: RawVectorTile -> ByteString Source #
Encode a mid-level representation of a RawVectorTile
into raw protobuf data.
decodeIO :: FilePath -> IO (Either Text RawVectorTile) Source #
Given a filename, attempt to decode bytes read from that file.
encodeIO :: RawVectorTile -> FilePath -> IO () Source #
Write a mid-level representation of a RawVectorTile
to a file as raw
protobuf data.