worace / shp4s

Pure-Scala streaming Shapefile codec based on scodec and fs2

Version Matrix

shp4s - Pure Scala Shapefile Codec

Based on scodec and fs2.

import cats.effect.{IO, ContextShift}
import works.worace.shp4s

implicit val csIO: ContextShift[IO] =
  IO.contextShift(scala.concurrent.ExecutionContext.Implicits.global)

// Read features into Vector
shp4s.Core.readAllSync("test.shp")

// fs2.Stream[IO, Feature]
streamShapefile(path: String)

Types - 14

  • NullShape
  • Point
  • PolyLine
  • Polygon
  • MultiPoint
  • PointZ
  • PolylineZ
  • PolygonZ
  • MultiPointZ
  • PointM
  • PolyLineM
  • PolygonM
  • MultiPointM
  • MultiPatch
  • DBF
  • DBF proper resource handling (cats bracket? closing in finally?)

TODO Edge Cases

  • Verify PointZ file with M values
  • Verify MultiPointZ with M values
  • Convert MultiPointZ to hold Vector[PointZ] values
  • PolylineZ with M Values
  • *-Z encoding with empty M values -- should omit entirely rather than encoding 0's
  • PolyLineZ Sample File

Releasing

  • no version setting in build.sbt
  • push a git tag (e.g. v0.0.1) to release a version
  • other commits to master will be pushed as snapshots