geojson-2.0.0: A thin GeoJSON Layer above the aeson library

Copyright(C) 2014-2018 HS-GeoJSON Project
LicenseBSD-style (see the file LICENSE.md)
MaintainerAndrew Newman
Safe HaskellNone
LanguageHaskell2010

Data.LineString

Contents

Description

Refer to the GeoJSON Spec http://geojson.org/geojson-spec.html#linestring

A LinearString is a List with at least 2 elements

Synopsis

Type

data LineString a Source #

a LineString has at least 2 elements

Instances

data ListToLineStringError Source #

When converting a List to a LineString, here is a list of things that can go wrong:

  • The list was empty
  • The list only had one element

Constructors

ListEmpty 
SingletonList 

data VectorToLineStringError Source #

When converting a Vector to a LineString, here is a list of things that can go wrong:

  • The vector was empty
  • The vector only had one element

Functions

toVector :: Storable a => LineString a -> Vector a Source #

create a vector from a LineString. LineString 1 2 [3,4] --> Vector [1,2,3,4]

combineToVector :: (Storable a, Storable b) => (a -> a -> b) -> LineString a -> Vector b Source #

create a vector from a LineString by combining values. LineString 1 2 3,4 --> Vector [(1,2),(2,3),(3,4)]

fromVector :: (Validate v, Storable a) => Vector a -> v VectorToLineStringError (LineString a) Source #

creates a LineString out of a vector of elements, if there are enough elements (needs at least 2) elements

fromLineString :: Storable a => LineString a -> [a] Source #

This function converts it into a list and appends the given element to the end.

fromList :: (Validate v, Storable a) => [a] -> v ListToLineStringError (LineString a) Source #

creates a LineString out of a list of elements, if there are enough elements (needs at least 2) elements

map :: (Storable a, Storable b) => (a -> b) -> LineString a -> LineString b Source #

foldr :: Storable a => (a -> b -> b) -> b -> LineString a -> b Source #

This will run through the entire ring, closing the loop by also passing the initial element in again at the end.

foldMap :: (Monoid m, Storable a) => (a -> m) -> LineString a -> m Source #

makeLineString Source #

Arguments

:: Storable a 
=> a

The first element

-> a

The second element

-> Vector a

The rest of the optional elements

-> LineString a 

Creates a LineString makeLineString x y zs creates a LineString homomorphic to the list [x, y] ++ zs

lineStringHead :: LineString a -> a Source #

returns the element at the head of the string

lineStringLast :: Storable a => LineString a -> a Source #

returns the last element in the string

lineStringLength :: Storable a => LineString a -> Int Source #

returns the number of elements in the list, including the replicated element at the end of the list.