Copyright | (c) Azavea 2016 |
---|---|
License | Apache 2 |
Maintainer | Colin Woodbury <cwoodbury@azavea.com> |
Safe Haskell | None |
Language | Haskell2010 |
GIS Vector Tiles, as defined by Mapbox.
This library implements version 2.1 of the official Mapbox spec, as defined here: https://github.com/mapbox/vector-tile-spec/tree/master/2.1
Note that currently this library ignores top-level protobuf extensions, Value extensions, and UNKNOWN geometries.
The order in which to explore the modules of this library is as follows:
Usage
This library reads and writes strict ByteString
s. By importing this module,
you use the default protobuf backend. Given some legal
VectorTile file called roads.mvt
:
import qualified Data.ByteString as BS import Data.Text (Text) import Geography.VectorTile -- | Read in raw protobuf data and decode it into a high-level type. roads :: IO (Either Text VectorTile) roads = do mvt <- BS.readFile "roads.mvt" pure $ decode mvt >>= tile
Or encode a VectorTile
back into a ByteString
:
roadsBytes :: VectorTile -> BS.ByteString roadsBytes = encode . untile
- module Geography.VectorTile.VectorTile
- tile :: RawVectorTile -> Either Text VectorTile
- untile :: VectorTile -> RawVectorTile
- decode :: ByteString -> Either Text RawVectorTile
- encode :: RawVectorTile -> ByteString
High-level Types
This module also provides lenses for data field access,
as VectorTile
s are highly nested objects.
Protobuf Backend
Conversions
tile :: RawVectorTile -> Either Text VectorTile Source #
untile :: VectorTile -> RawVectorTile 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.