vectortiles 1.2.0 → 1.2.0.1
raw patch · 5 files changed
+18/−35 lines, 5 files
Files
- Geography/VectorTile/Geometry.hs +0/−11
- Geography/VectorTile/Protobuf.hs +0/−8
- Geography/VectorTile/Protobuf/Internal.hs +4/−5
- Geography/VectorTile/VectorTile.hs +9/−9
- vectortiles.cabal +5/−2
Geography/VectorTile/Geometry.hs view
@@ -1,10 +1,4 @@-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeSynonymInstances #-}-{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DeriveGeneric #-} -- |@@ -38,11 +32,6 @@ type Point = (Int,Int) pattern Point :: Int -> Int -> (Int, Int) pattern Point{x, y} = (x, y)---- | Points are just vectors in R2, and thus form a Vector space.-instance Monoid Point where- mempty = Point 0 0- (Point a b) `mappend` (Point a' b') = Point (a + a') (b + b') -- | /newtype/ compiles away to expose only the `U.Vector` of unboxed `Point`s -- at runtime.
Geography/VectorTile/Protobuf.hs view
@@ -1,11 +1,3 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE TypeSynonymInstances #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeFamilyDependencies #-}- -- | -- Module : Geography.VectorTile.Protobuf -- Copyright : (c) Azavea, 2016
Geography/VectorTile/Protobuf/Internal.hs view
@@ -54,7 +54,6 @@ import Control.DeepSeq (NFData) import Control.Monad.Trans.State.Lazy import Data.Bits-import qualified Data.ByteString as BS import Data.Foldable (foldrM, foldlM) import Data.Int import Data.List (nub, elemIndex)@@ -200,7 +199,7 @@ -- | A valid `RawFeature` of points must contain a single `MoveTo` command -- with a count greater than 0. instance ProtobufGeom G.Point where- fromCommands (MoveTo ps : []) = Right . U.convert $ evalState (U.mapM expand ps) (0,0)+ fromCommands [MoveTo ps] = Right . U.convert $ evalState (U.mapM expand ps) (0,0) fromCommands (c:_) = Left $ [st|Invalid command found in Point feature: %s|] (show c) fromCommands [] = Left "No points given!" @@ -307,8 +306,8 @@ -- and Z-encoded Parameter integer forms. uncommands :: [Command] -> [Word32] uncommands = U.toList . U.concat . map f- where f (MoveTo ps) = (U.cons $ unparseCmd (1, U.length ps)) $ params ps- f (LineTo ls) = (U.cons $ unparseCmd (2, U.length ls)) $ params ls+ where f (MoveTo ps) = U.cons (unparseCmd (1, U.length ps)) $ params ps+ f (LineTo ls) = U.cons (unparseCmd (2, U.length ls)) $ params ls f ClosePath = U.singleton $ unparseCmd (7,1) -- ClosePath, Count 1. {- FROM PROTOBUF -}@@ -353,7 +352,7 @@ getMeta :: [Text] -> [RawVal] -> [Word32] -> Either Text (M.Map Text VT.Val) getMeta keys vals tags = do kv <- map (both fromIntegral) <$> pairs tags- foldrM (\(k,v) acc -> (\v' -> M.insert (keys !! k) v' acc) <$> (fromProtobuf $ vals !! v)) M.empty kv+ foldrM (\(k,v) acc -> (\v' -> M.insert (keys !! k) v' acc) <$> fromProtobuf (vals !! v)) M.empty kv {- TO PROTOBUF -}
Geography/VectorTile/VectorTile.hs view
@@ -70,32 +70,32 @@ -- | > Lens' Layer Int version :: Functor f => (Int -> f Int) -> Layer -> f Layer-version f l = fmap (\v -> l { _version = v }) $ f (_version l)+version f l = (\v -> l { _version = v }) <$> f (_version l) {-# INLINE version #-} -- | > Lens' Layer Text name :: Functor f => (Text -> f Text) -> Layer -> f Layer-name f l = fmap (\v -> l { _name = v }) $ f (_name l)+name f l = (\v -> l { _name = v }) <$> f (_name l) {-# INLINE name #-} -- | > Lens' Layer (Vector (Feature Point)) points :: Functor f => (V.Vector (Feature Point) -> f (V.Vector (Feature Point))) -> Layer -> f Layer-points f l = fmap (\v -> l { _points = v }) $ f (_points l)+points f l = (\v -> l { _points = v }) <$> f (_points l) {-# INLINE points #-} -- | > Lens' Layer (Vector (Feature LineString))) linestrings :: Functor f => (V.Vector (Feature LineString) -> f (V.Vector (Feature LineString))) -> Layer -> f Layer-linestrings f l = fmap (\v -> l { _linestrings = v }) $ f (_linestrings l)+linestrings f l = (\v -> l { _linestrings = v }) <$> f (_linestrings l) {-# INLINE linestrings #-} -- | > Lens' Layer (Vector (Feature Polygon))) polygons :: Functor f => (V.Vector (Feature Polygon) -> f (V.Vector (Feature Polygon))) -> Layer -> f Layer-polygons f l = fmap (\v -> l { _polygons = v }) $ f (_polygons l)+polygons f l = (\v -> l { _polygons = v }) <$> f (_polygons l) {-# INLINE polygons #-} -- | > Lens' Layer Int extent :: Functor f => (Int -> f Int) -> Layer -> f Layer-extent f l = fmap (\v -> l { _extent = v }) $ f (_extent l)+extent f l = (\v -> l { _extent = v }) <$> f (_extent l) {-# INLINE extent #-} instance NFData Layer@@ -119,17 +119,17 @@ -- | > Lens' (Feature g) Int featureId :: Functor f => (Int -> f Int) -> Feature g -> f (Feature g)-featureId f l = fmap (\v -> l { _featureId = v }) $ f (_featureId l)+featureId f l = (\v -> l { _featureId = v }) <$> f (_featureId l) {-# INLINE featureId #-} -- | > Lens' (Feature g) (Map Text Val) metadata :: Functor f => (M.Map Text Val -> f (M.Map Text Val)) -> Feature g -> f (Feature g)-metadata f l = fmap (\v -> l { _metadata = v }) $ f (_metadata l)+metadata f l = (\v -> l { _metadata = v }) <$> f (_metadata l) {-# INLINE metadata #-} -- | > Lens' (Feature g) (Vector g) geometries :: Functor f => (V.Vector g -> f (V.Vector g)) -> Feature g -> f (Feature g)-geometries f l = fmap (\v -> l { _geometries = v }) $ f (_geometries l)+geometries f l = (\v -> l { _geometries = v }) <$> f (_geometries l) {-# INLINE geometries #-} instance NFData g => NFData (Feature g)
vectortiles.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: vectortiles-version: 1.2.0+version: 1.2.0.1 synopsis: GIS Vector Tiles, as defined by Mapbox. description: GIS Vector Tiles, as defined by Mapbox. .@@ -15,7 +15,9 @@ The order in which to explore the modules of this library is as follows: . 1. "Geography.VectorTile.VectorTile" (high-level types)+ . 2. "Geography.VectorTile.Geometry" (typical GIS geometry types)+ . 3. "Geography.VectorTile.Protobuf" (mid-level representation of parsed protobuf data with conversion functions) homepage: https://github.com/fosskers/vectortiles@@ -59,7 +61,8 @@ -- hs-source-dirs: default-language: Haskell2010--- ghc-options: -Wall++ ghc-options: -fwarn-unused-imports -fwarn-unused-binds test-suite vectortiles-test type: exitcode-stdio-1.0