| Copyright | (c) Azavea, 2016 |
|---|---|
| License | Apache 2 |
| Maintainer | Colin Woodbury <cwoodbury@azavea.com> |
| Safe Haskell | None |
| Language | Haskell2010 |
Geography.VectorTile.Raw
Contents
Description
Raw Vector Tile data is stored as binary protobuf data. This module reads and writes raw protobuf ByteStrings between a data type which closely matches the current Mapbox vector tile spec defined here: https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto
As this raw version of the data is hard to work with, in practice we convert
to a more canonical Haskell type for further processing.
See VectorTile for the user-friendly version.
Please import this module qualified to avoid namespace clashes:
import qualified Geography.VectorTile.Raw as R
- data RawVectorTile = RawVectorTile {}
- data RawLayer = RawLayer {}
- data RawVal = RawVal {}
- data RawFeature = RawFeature {}
- data GeomType
- = Unknown
- | Point
- | LineString
- | Polygon
- class Geometry g => Geom g where
- decode :: ByteString -> Either Text RawVectorTile
- encode :: RawVectorTile -> ByteString
- decodeIO :: FilePath -> IO (Either Text RawVectorTile)
- encodeIO :: RawVectorTile -> FilePath -> IO ()
Types
Contains a pseudo-map of metadata, to be shared across all RawFeatures
of this RawLayer.
Constructors
| RawLayer | |
The Value types of metadata fields.
Constructors
| RawVal | |
The four potential Geometry types. The spec allows for encoders to set
Unknown as the type, but our decoder ignores these.
Constructors
| Unknown | |
| Point | |
| LineString | |
| Polygon |
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.