-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parser and related tools for ESRI shapefile format -- -- A very simple interface for processing data in ESRI shapefile format. -- Includes functions for reading or writing whole .shp and .shx files, -- as well as for generating .shx index files from .shp data files. Also -- includes an interface to read individual records on-demand from -- shapefiles, useful for very large databases. @package shapefile @version 0.0.0.1 module Database.Shapefile.ShapeTypes data ESRIShapeType NullShape :: ESRIShapeType Point :: ESRIShapeType PolyLine :: ESRIShapeType Polygon :: ESRIShapeType MultiPoint :: ESRIShapeType PointZ :: ESRIShapeType PolyLineZ :: ESRIShapeType PolygonZ :: ESRIShapeType MultiPointZ :: ESRIShapeType PointM :: ESRIShapeType PolyLineM :: ESRIShapeType PolygonM :: ESRIShapeType MultiPointM :: ESRIShapeType MultiPatch :: ESRIShapeType Unknown :: Word32 -> ESRIShapeType hasZ :: ESRIShapeType -> Bool hasM :: ESRIShapeType -> Bool identifyShapeType :: ESRIShapeType -> ESRIShapeType isKnownShapeType :: ESRIShapeType -> Bool putShapeType32le :: ESRIShapeType -> Put getShapeType32le :: Get ESRIShapeType instance Show ESRIShapeType instance Read ESRIShapeType instance Ord ESRIShapeType instance Eq ESRIShapeType instance Bounded ESRIShapeType instance Enum ESRIShapeType module Database.Shapefile.Shp data ShpFileHeader ShpFileHeader :: Word32 -> ESRIShapeType -> BBox (Double, Double) -> Maybe (Double, Double) -> Maybe (Double, Double) -> ShpFileHeader -- | File length in 16-bit words. Unsigned, I assume - spec doesn't say. shpFileLength :: ShpFileHeader -> Word32 shpFileShapeType :: ShpFileHeader -> ESRIShapeType shpFileBBox :: ShpFileHeader -> BBox (Double, Double) shpFileZBnd :: ShpFileHeader -> Maybe (Double, Double) shpFileMBnd :: ShpFileHeader -> Maybe (Double, Double) -- | Shape file length in bytes shpFileLengthBytes :: ShpFileHeader -> Integer putShpFileHeader :: ShpFileHeader -> Put getShpFileHeader :: Get ShpFileHeader data ShpRecHeader ShpRecHeader :: Word32 -> Word32 -> ShpRecHeader -- | Index of the record. First index is 1. shpRecNum :: ShpRecHeader -> Word32 -- | Size of the record in 16-bit words, excluding this header. shpRecSize :: ShpRecHeader -> Word32 -- | Size of the record in bytes, excluding the record header shpRecSizeBytes :: ShpRecHeader -> Integer putShpRecHeader :: ShpRecHeader -> Put getShpRecHeader :: Get ShpRecHeader data ShpRec ShpRec :: ShpRecHeader -> ByteString -> ShpRec shpRecHdr :: ShpRec -> ShpRecHeader shpRecData :: ShpRec -> ByteString -- | Total size of the shape record in bytes, including the header shpRecTotalSizeBytes :: ShpRec -> Integer -- | A shape record type isn't part of the header, but every shape -- format starts with a word indicating the shape type. This function -- extracts it. shpRecShapeType :: ShpRec -> ESRIShapeType -- | Pack several raw shape records into ShpRecs, setting proper -- record numbers and sizes. mkShpRecs :: [ByteString] -> [ShpRec] -- | Pack the data for a shape into a ShpRec with the specified -- record number mkShpRec :: Word32 -> ByteString -> ShpRec putShpRec :: ShpRec -> Put getShpRec :: Get ShpRec putShpFile :: ShpFileHeader -> [ShpRec] -> Put getShpFile :: Get (ShpFileHeader, [ShpRec]) instance Eq ShpRec instance Show ShpRec instance Eq ShpRecHeader instance Show ShpRecHeader instance Eq ShpFileHeader instance Show ShpFileHeader module Database.Shapefile.Shx -- | offset and length of corresponding shape in 16-bit words data ShxRec ShxRec :: Word32 -> Word32 -> ShxRec -- | Offset of the corresponding ShpRec in 16-bit words shxOffset :: ShxRec -> Word32 -- | Length of the corresponding ShpRec in 16-bit words shxLength :: ShxRec -> Word32 -- | Construct a ShxRec given the record offset and length in bytes shxRecBytes :: Integer -> Integer -> ShxRec shxOffsetBytes :: ShxRec -> Integer shxLengthBytes :: ShxRec -> Integer putShxRec :: ShxRec -> Put getShxRec :: Get ShxRec -- | Construct an index for the provided .shp file contents shxFromShp :: ShpFileHeader -> [ShpRec] -> (ShpFileHeader, [ShxRec]) putShxFile :: ShpFileHeader -> [ShxRec] -> Put getShxFile :: Get (ShpFileHeader, [ShxRec]) instance Eq ShxRec instance Show ShxRec -- | Primarily for use internally by ShpHandle. Each -- ShpHandle has an ShxHandle that it uses to lookup -- arbitrary shape records from the .shp file. module Database.Shapefile.Shx.Handle data ShxHandle openShx :: FilePath -> Bool -> IO ShxHandle closeShx :: ShxHandle -> IO () shxIsOpen :: ShxHandle -> IO Bool shxHeader :: ShxHandle -> IO ShpFileHeader getShxRecord :: ShxHandle -> Int -> IO ShxRec module Database.Shapefile.Shp.Handle data ShpHandle openShp :: FilePath -> Bool -> IO ShpHandle closeShp :: ShpHandle -> IO () shpIsOpen :: ShpHandle -> IO Bool shpHeader :: ShpHandle -> IO ShpFileHeader shpDbfFields :: ShpHandle -> IO [DbfFieldHandle] getShpRecord :: ShpHandle -> Int -> IO (ShpRec, Maybe DbfRecHandle) module Database.Shapefile data BBox point BBox :: point -> point -> BBox point bbMin :: BBox point -> point bbMax :: BBox point -> point