-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings for GEOS. -- -- This is a Haskell binding to Geos, the open-source geometry library, -- which includes geometry types, predicate functions and other -- operations, spatially indexed geometries, and parsers for WKB and WKT -- formats. @package geos @version 0.2.2 module Data.Geometry.Geos.Geometry data Geometry a [PointGeometry] :: Point -> SRID -> Geometry Point [LineStringGeometry] :: LineString -> SRID -> Geometry LineString [LinearRingGeometry] :: LinearRing -> SRID -> Geometry LinearRing [PolygonGeometry] :: Polygon -> SRID -> Geometry Polygon [MultiPointGeometry] :: MultiPoint -> SRID -> Geometry MultiPoint [MultiLineStringGeometry] :: MultiLineString -> SRID -> Geometry MultiLineString [MultiPolygonGeometry] :: MultiPolygon -> SRID -> Geometry MultiPolygon newtype Point Point :: Coordinate -> Point newtype LinearRing LinearRing :: CoordinateSequence -> LinearRing newtype LineString LineString :: CoordinateSequence -> LineString -- | In a polygon, the fist LinearRing is the shell, and any following are -- holes. newtype Polygon Polygon :: Vector LinearRing -> Polygon newtype MultiPoint MultiPoint :: Vector Point -> MultiPoint newtype MultiLineString MultiLineString :: Vector LineString -> MultiLineString newtype MultiPolygon MultiPolygon :: Vector Polygon -> MultiPolygon data Some :: (* -> *) -> * [Some] :: f a -> Some f data Coordinate Coordinate2 :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> Coordinate Coordinate3 :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> Coordinate -- | In all geometry types, SRID is used for compatability and is NOT used -- in calculations. For example, the distance between two -- PointGeometry with an SRID of `Just 4326` will return a distance -- between two points in Euclidean space in the units the PointGeometry -- is initialized with. It will not calculate the distance on a spheroid. type SRID = Maybe Int binaryPredicate :: (GeomConst -> GeomConst -> Geos Bool) -> Geometry a -> Geometry b -> Bool convertGeometryFromRaw :: (Geometry a, CoordSeqInput a ~ cb, CoordinateSequence cb) => a -> Geos (Some Geometry) convertGeometryToRaw :: (Geometry a, CoordSeqInput a ~ cb, CoordinateSequence cb) => Geometry b -> Geos a convertMultiPolygonFromRaw :: (Geometry a, CoordSeqInput a ~ ca, CoordinateSequence ca) => a -> Geos MultiPolygon ensurePoint :: Some Geometry -> Geometry Point ensureLineString :: Some Geometry -> Geometry LineString ensureLinearRing :: Some Geometry -> Geometry LinearRing ensurePolygon :: Some Geometry -> Geometry Polygon ensureMultiPoint :: Some Geometry -> Geometry MultiPoint ensureMultiPolygon :: Some Geometry -> Geometry MultiPolygon ensureMultiLineString :: Some Geometry -> Geometry MultiLineString -- | Given a distance, returns the point (or closest point) within the -- geometry LineString that distance. interpolate :: Geometry LineString -> Double -> Geometry Point -- | Like interpolate, but takes the distance as a double between -- 0 and 1. interpolateNormalized :: Geometry LineString -> Double -> Geometry Point -- | Returns the distance from the origin of LineString to the point -- projected on the geometry (that is to a point of the line the closest -- to the given point). project :: Geometry LineString -> Geometry Point -> Double -- | Like project, but returns the distance as a Double between 0 -- and 1. projectNormalized :: Geometry LineString -> Geometry Point -> Double -- | Returns True if the two geometries are exactly equal, up to a -- specified tolerance. The tolerance value should be a floating point -- number representing the error tolerance in the comparison, e.g., -- equalsExact g1 g2 0.001 will compare equality to within one -- thousandth of a unit. equalsExact :: Geometry a -> Geometry a -> Double -> Bool equals :: Geometry a -> Geometry a -> Bool area :: Geometry a -> Double -- | Returns the length of this geometry (e.g., 0 for a Point, the length -- of a LineString, or the circumference of a Polygon). geometryLength :: Geometry a -> Double -- | NOTE: distance calculations are linear – in other words, -- distance does not perform a spherical calculation even if the -- SRID specifies a geographic coordinate system. distance :: Geometry a -> Geometry a -> Double hausdorffDistance :: Geometry a -> Geometry a -> Double -- | Returns the closest points of the two geometries. The first point -- comes from g1 geometry and the second point comes from g2. nearestPoints :: Geometry a -> Geometry a -> (Coordinate, Coordinate) withSomeGeometry :: Some Geometry -> (forall a. Geometry a -> b) -> b instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.MultiPolygon instance Data.Data.Data Data.Geometry.Geos.Geometry.MultiPolygon instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.MultiPolygon instance GHC.Show.Show Data.Geometry.Geos.Geometry.MultiPolygon instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.MultiPolygon instance GHC.Read.Read Data.Geometry.Geos.Geometry.MultiPolygon instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.MultiLineString instance Data.Data.Data Data.Geometry.Geos.Geometry.MultiLineString instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.MultiLineString instance GHC.Show.Show Data.Geometry.Geos.Geometry.MultiLineString instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.MultiLineString instance GHC.Read.Read Data.Geometry.Geos.Geometry.MultiLineString instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.MultiPoint instance Data.Data.Data Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Show.Show Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Read.Read Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.Polygon instance Data.Data.Data Data.Geometry.Geos.Geometry.Polygon instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.Polygon instance GHC.Show.Show Data.Geometry.Geos.Geometry.Polygon instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.Polygon instance GHC.Read.Read Data.Geometry.Geos.Geometry.Polygon instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.LineString instance Data.Data.Data Data.Geometry.Geos.Geometry.LineString instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.LineString instance GHC.Show.Show Data.Geometry.Geos.Geometry.LineString instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.LineString instance GHC.Read.Read Data.Geometry.Geos.Geometry.LineString instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.LinearRing instance Data.Data.Data Data.Geometry.Geos.Geometry.LinearRing instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.LinearRing instance GHC.Show.Show Data.Geometry.Geos.Geometry.LinearRing instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.LinearRing instance GHC.Read.Read Data.Geometry.Geos.Geometry.LinearRing instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.Point instance Data.Data.Data Data.Geometry.Geos.Geometry.Point instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.Point instance GHC.Show.Show Data.Geometry.Geos.Geometry.Point instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.Point instance GHC.Read.Read Data.Geometry.Geos.Geometry.Point instance GHC.Generics.Generic Data.Geometry.Geos.Geometry.Coordinate instance Data.Data.Data Data.Geometry.Geos.Geometry.Coordinate instance GHC.Classes.Eq Data.Geometry.Geos.Geometry.Coordinate instance GHC.Show.Show Data.Geometry.Geos.Geometry.Coordinate instance GHC.Classes.Ord Data.Geometry.Geos.Geometry.Coordinate instance GHC.Read.Read Data.Geometry.Geos.Geometry.Coordinate instance GHC.Classes.Eq (Data.Geometry.Geos.Geometry.Geometry a) instance GHC.Show.Show (Data.Geometry.Geos.Geometry.Geometry a) instance GHC.Show.Show (Data.Geometry.Geos.Geometry.Some Data.Geometry.Geos.Geometry.Geometry) instance GHC.Base.Semigroup Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Base.Monoid Data.Geometry.Geos.Geometry.MultiPoint instance GHC.Base.Semigroup Data.Geometry.Geos.Geometry.LineString instance GHC.Base.Monoid Data.Geometry.Geos.Geometry.LineString instance GHC.Base.Semigroup Data.Geometry.Geos.Geometry.LinearRing instance GHC.Base.Monoid Data.Geometry.Geos.Geometry.LinearRing -- | Functions to compute the buffer of a geometry, for both positive and -- negative buffer distances. -- -- In GIS, the positive (or negative) buffer of a geometry is defined as -- the Minkowski sum (or difference) of the geometry with a circle with -- radius equal to the absolute value of the buffer distance. In the -- CAD/CAM world buffers are known as offset curves. In morphological -- analysis the operation of positive and negative buffering is referred -- to as erosion and dilation. -- -- The buffer operation always returns a polygonal result. The negative -- or zero-distance buffer of lines and points is always an empty -- Polygon. -- -- Since true buffer curves may contain circular arcs, computed buffer -- polygons can only be approximations to the true geometry. The user can -- control the accuracy of the curve approximation by specifying the -- number of linear segments with which to approximate a curve. module Data.Geometry.Geos.Buffer -- | Returns a Geometry that represents all points whose distance from this -- geometry is less than or equal to the given width. buffer :: Geometry a -> Double -> BufferParams -> Some Geometry defaultBufferParams :: BufferParams data BufferParams BufferParams :: BufferJoinStyle -> BufferCapStyle -> Double -> Int -> Bool -> BufferParams [joinStyle] :: BufferParams -> BufferJoinStyle [capStyle] :: BufferParams -> BufferCapStyle [mitreLimit] :: BufferParams -> Double -- | Sets the number of line segments used to approximate an angle fillet. -- -- -- -- For round joins, quadrantSegments determines the maximum error in the -- approximation to the true buffer curve. -- -- The default value of 8 gives less than 2% max error in the buffer -- distance. -- -- For a max error of < 1%, use QS = 12. For a max error of < 0.1%, -- use QS = 18. The error is always less than the buffer distance (in -- other words, the computed buffer curve is always inside the true -- curve). [quadrantSegments] :: BufferParams -> Int -- | Sets whether the computed buffer should be single-sided. A -- single-sided buffer is constructed on only one side of each input -- line. -- -- The side used is determined by the sign of the buffer distance: -- -- -- -- The End Cap Style for single-sided buffers is always ignored, and -- forced to the equivalent of FlatCap. [singleSided] :: BufferParams -> Bool data BufferJoinStyle RoundJoin :: BufferJoinStyle MitreJoin :: BufferJoinStyle BevelJoin :: BufferJoinStyle data BufferCapStyle -- | the usual round end caps RoundCap :: BufferCapStyle -- | end caps are truncated flat at the line ends SquareCap :: BufferCapStyle -- | end caps are squared off at the buffer distance beyond the line ends FlatCap :: BufferCapStyle module Data.Geometry.Geos.Relatable class Relatable a contains :: Relatable a => a -> Geometry b -> Bool coveredBy :: Relatable a => a -> Geometry b -> Bool covers :: Relatable a => a -> Geometry b -> Bool crosses :: Relatable a => a -> Geometry b -> Bool disjoint :: Relatable a => a -> Geometry b -> Bool intersects :: Relatable a => a -> Geometry b -> Bool overlaps :: Relatable a => a -> Geometry b -> Bool touches :: Relatable a => a -> Geometry b -> Bool within :: Relatable a => a -> Geometry b -> Bool instance Data.Geometry.Geos.Relatable.Relatable (Data.Geometry.Geos.Geometry.Geometry a) -- | An interface for classes which prepare Geometrys in order to optimize -- the performance of repeated calls to specific geometric operations. -- -- A given implementation may provide optimized implementations for only -- some of the specified methods, and delegate the remaining methods to -- the original Geometry operations. An implementation may also only -- optimize certain situations, and delegate others. See the implementing -- classes for documentation about which methods and situations they -- optimize. module Data.Geometry.Geos.Prepared prepare :: Geometry a -> PreparedGeometry contains :: Relatable a => a -> Geometry b -> Bool -- | The containsProperly predicate has the following equivalent -- definitions: -- -- Every point of the other geometry is a point of this geometry's -- interior. In other words, if the test geometry has any interaction -- with the boundary of the target geometry the result of -- containsProperly is false. This is different semantics to the -- contains predicate, in which test geometries can intersect -- the target's boundary and still be contained. -- -- The advantage of using this predicate is that it can be computed -- efficiently, since it avoids the need to compute the full topological -- relationship of the input boundaries in cases where they intersect. -- -- An example use case is computing the intersections of a set of -- geometries with a large polygonal geometry. Since intersection is a -- fairly slow operation, it can be more efficient to use -- containsProperly to filter out test geometries which lie wholly inside -- the area. In these cases the intersection is known a priori to be -- exactly the original test geometry. containsProperly :: PreparedGeometry -> Geometry a -> Bool coveredBy :: Relatable a => a -> Geometry b -> Bool covers :: Relatable a => a -> Geometry b -> Bool crosses :: Relatable a => a -> Geometry b -> Bool disjoint :: Relatable a => a -> Geometry b -> Bool intersects :: Relatable a => a -> Geometry b -> Bool overlaps :: Relatable a => a -> Geometry b -> Bool touches :: Relatable a => a -> Geometry b -> Bool within :: Relatable a => a -> Geometry b -> Bool instance Data.Geometry.Geos.Relatable.Relatable Data.Geometry.Geos.Raw.Prepared.PreparedGeometry -- | A query-only R-tree created using the Sort-Tile-Recursive (STR) -- algorithm. For two-dimensional spatial data. -- -- The STR packed R-tree is simple to implement and maximizes space -- utilization; that is, as many leaves as possible are filled to -- capacity. Overlap between nodes is far less than in a basic R-tree. -- However, once the tree has been built (explicitly or on the first call -- to query), items may not be added or removed. -- -- Described in: P. Rigaux, Michel Scholl and Agnes Voisard. Spatial -- Databases With Application To GIS. Morgan Kaufmann, San Francisco, -- 2002. module Data.Geometry.Geos.STRTree foldr :: Storable a => (a -> b -> b) -> b -> STRTree a -> b toList :: Storable a => STRTree a -> [a] toVector :: Storable a => STRTree a -> Vector a fromList :: Storable b => [(Geometry a, b)] -> STRTree b empty :: STRTreeBuilder a build :: STRTreeBuilder a -> STRTree a insert :: Storable a => Geometry b -> a -> STRTreeBuilder a -> () -- | fromFoldable creates an STRTree with a default node capacity of -- 10. For finer-grained control over the node capacity, -- fromFoldable_ accepts a node-capacity argument. fromFoldable :: (Foldable f, Storable b) => f (Geometry a, b) -> STRTree b fromFoldable_ :: (Foldable f, Storable b) => Int -> f (Geometry a, b) -> STRTree b -- | Queries the index for all items whose extents intersect the given -- search Envelope. Note that some kinds of indexes may also return -- objects which do not in fact intersect the query envelope. lookup :: Storable b => Geometry a -> STRTree b -> Vector b -- | A query-only data structure data STRTree a -- | A mutable data structure. Must build into an STRTree before -- querying. data STRTreeBuilder a -- | Functions to read and write geometries in WKB and WKT formats. -- -- The WKB format is specified in the OGC Simple Features for SQL -- specification. This implementation supports the extended WKB standard -- for representing 3-dimensional coordinates. The presence of 3D -- coordinates is signified by setting the high bit of the wkbType word. -- Empty Points cannot be represented in WKB; an IllegalArgumentException -- will be thrown if one is written. The WKB specification does not -- support representing LinearRing, they will be written as -- LineString module Data.Geometry.Geos.Serialize readHex :: ByteString -> Maybe (Some Geometry) readLotsOfHex :: [ByteString] -> [Some Geometry] writeHex :: Geometry a -> ByteString readWkt :: Maybe Int -> ByteString -> Maybe (Some Geometry) writeWkt :: Geometry a -> ByteString module Data.Geometry.Geos.Topology -- | Returns a Polygon that represents the bounding envelope of this -- geometry. Note that it can also return a Point if the input geometry -- is a point. envelope :: Geometry a -> Some Geometry -- | Returns a Geometry representing the points shared by both geometries. intersection :: Geometry a -> Geometry b -> Some Geometry -- | Returns the smallest Polygon that contains all the points in the -- geometry. convexHull :: Geometry a -> Geometry Polygon -- | Returns a Geometry representing the points making up this geometry -- that do not make up other. difference :: Geometry a -> Geometry b -> Some Geometry -- | Returns a Geometry combining the points in this geometry not in other, -- and the points in other not in this geometry. symmetricDifference :: Geometry a -> Geometry b -> Some Geometry boundary :: Geometry a -> Some Geometry -- | Returns a Geometry representing all the points in both geometries. -- -- Computes the union of all the elements of this geometry. Heterogeneous -- GeometryCollections are fully supported. -- -- The result obeys the following contract: -- -- Unioning a set of LineStrings has the effect of fully noding and -- dissolving the linework. Unioning a set of Polygons will always return -- a Polygonal geometry (unlike {link #union(Geometry)}, which may return -- geometrys of lower dimension if a topology collapse occurred. union :: Geometry a -> Geometry b -> Some Geometry unaryUnion :: Geometry a -> Some Geometry -- | Computes and returns a Point guaranteed to be on the interior of this -- geometry. pointOnSurface :: Geometry a -> Geometry Point -- | Returns a Point object representing the geometric center of the -- geometry. The point is not guaranteed to be on the interior of the -- geometry. centroid :: Geometry a -> Geometry Point node :: Geometry a -> Some Geometry -- | Return a Delaunay triangulation of the vertex of the given geometry -- g, where tol is the snapping tolerance to use. delaunayTriangulation :: Geometry a -> Double -> Geometry MultiLineString