Copyright | (c) Azavea, 2016 |
---|---|
License | Apache 2 |
Maintainer | Colin Woodbury <cwoodbury@azavea.com> |
Safe Haskell | None |
Language | Haskell2010 |
High-level types for representing Vector Tiles.
- newtype VectorTile = VectorTile {}
- data Layer = Layer {}
- data Feature g = Feature {
- _featureId :: Int
- _metadata :: Map Text Val
- _geometries :: Vector g
- data Val
- layers :: Functor f => (Map Text Layer -> f (Map Text Layer)) -> VectorTile -> f VectorTile
- version :: Functor f => (Int -> f Int) -> Layer -> f Layer
- name :: Functor f => (Text -> f Text) -> Layer -> f Layer
- points :: Functor f => (Vector (Feature Point) -> f (Vector (Feature Point))) -> Layer -> f Layer
- linestrings :: Functor f => (Vector (Feature LineString) -> f (Vector (Feature LineString))) -> Layer -> f Layer
- polygons :: Functor f => (Vector (Feature Polygon) -> f (Vector (Feature Polygon))) -> Layer -> f Layer
- extent :: Functor f => (Int -> f Int) -> Layer -> f Layer
- featureId :: Functor f => (Int -> f Int) -> Feature g -> f (Feature g)
- metadata :: Functor f => (Map Text Val -> f (Map Text Val)) -> Feature g -> f (Feature g)
- geometries :: Functor f => (Vector g -> f (Vector g)) -> Feature g -> f (Feature g)
Types
newtype VectorTile Source #
A high-level representation of a Vector Tile. Implemented internally
as a Map
, so that access to individual layers can be fast if you
know the layer names ahead of time.
A layer, which could contain any number of Feature
s of any Geometry
type.
This codec only respects the canonical three Geometry
types, and we split
them here explicitely to allow for more fine-grained access to each type.
A geographic feature. Features are a set of geometries that share some common theme:
- Points: schools, gas station locations, etc.
- LineStrings: Roads, power lines, rivers, etc.
- Polygons: Buildings, water bodies, etc.
Where, for instance, all school locations may be stored as a single
Feature
, and no Point
within that Feature
would represent anything
else.
Note: Each Geometry
type and their Multi* counterpart are considered
the same thing, as a Vector
of that Geometry
.
Feature | |
|
Legal Metadata Value types. Note that S64
are Z-encoded automatically
by the underlying Data.ProtocolBuffers library.
Lenses
This section can be safely ignored if one isn't concerned with lenses. Otherwise, see the following for a good primer on Haskell lenses: http://hackage.haskell.org/package/lens-tutorial-1.0.1/docs/Control-Lens-Tutorial.html
These lenses are written in a generic way to avoid taking a dependency on one of the lens libraries.
layers :: Functor f => (Map Text Layer -> f (Map Text Layer)) -> VectorTile -> f VectorTile Source #
Lens' VectorTile (Map Text Layer)
points :: Functor f => (Vector (Feature Point) -> f (Vector (Feature Point))) -> Layer -> f Layer Source #
Lens' Layer (Vector (Feature Point))
linestrings :: Functor f => (Vector (Feature LineString) -> f (Vector (Feature LineString))) -> Layer -> f Layer Source #
Lens' Layer (Vector (Feature LineString)))
polygons :: Functor f => (Vector (Feature Polygon) -> f (Vector (Feature Polygon))) -> Layer -> f Layer Source #
Lens' Layer (Vector (Feature Polygon)))
featureId :: Functor f => (Int -> f Int) -> Feature g -> f (Feature g) Source #
Lens' (Feature g) Int