vectortiles-1.0.0: GIS Vector Tiles, as defined by Mapbox.

Copyright(c) Azavea, 2016
LicenseApache 2
MaintainerColin Woodbury <cwoodbury@azavea.com>
Safe HaskellNone
LanguageHaskell2010

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

Synopsis

Types

data RawLayer Source #

Contains a pseudo-map of metadata, to be shared across all RawFeatures of this RawLayer.

Instances

Eq RawLayer Source # 
Show RawLayer Source # 
Generic RawLayer Source # 

Associated Types

type Rep RawLayer :: * -> * #

Methods

from :: RawLayer -> Rep RawLayer x #

to :: Rep RawLayer x -> RawLayer #

NFData RawLayer Source # 

Methods

rnf :: RawLayer -> () #

Decode RawLayer Source # 
Encode RawLayer Source # 

Methods

encode :: RawLayer -> Put #

type Rep RawLayer Source # 

data RawVal Source #

The Value types of metadata fields.

Instances

Eq RawVal Source # 

Methods

(==) :: RawVal -> RawVal -> Bool #

(/=) :: RawVal -> RawVal -> Bool #

Show RawVal Source # 
Generic RawVal Source # 

Associated Types

type Rep RawVal :: * -> * #

Methods

from :: RawVal -> Rep RawVal x #

to :: Rep RawVal x -> RawVal #

NFData RawVal Source # 

Methods

rnf :: RawVal -> () #

Decode RawVal Source # 
Encode RawVal Source # 

Methods

encode :: RawVal -> Put #

type Rep RawVal Source # 

data RawFeature Source #

A set of geometries unified by some theme.

data GeomType Source #

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 

Instances

Enum GeomType Source # 
Eq GeomType Source # 
Show GeomType Source # 
Generic GeomType Source # 

Associated Types

type Rep GeomType :: * -> * #

Methods

from :: GeomType -> Rep GeomType x #

to :: Rep GeomType x -> GeomType #

NFData GeomType Source # 

Methods

rnf :: GeomType -> () #

Decode GeomType Source # 
Encode GeomType Source # 

Methods

encode :: GeomType -> Put #

type Rep GeomType Source # 
type Rep GeomType = D1 (MetaData "GeomType" "Geography.VectorTile.Raw" "vectortiles-1.0.0-9253U2nfEGPHQq8Yl4euFw" False) ((:+:) ((:+:) (C1 (MetaCons "Unknown" PrefixI False) U1) (C1 (MetaCons "Point" PrefixI False) U1)) ((:+:) (C1 (MetaCons "LineString" PrefixI False) U1) (C1 (MetaCons "Polygon" PrefixI False) U1)))

class Geometry g => Geom g where Source #

A Geom can recover its GeomType from its Geometry instance.

Minimal complete definition

geomType

Methods

geomType :: g -> GeomType Source #

The g here is a proxy argument to discern the type.

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.