works.worace.geojson.JtsFeature.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of circe-geojson-jts_2.12 Show documentation
Show all versions of circe-geojson-jts_2.12 Show documentation
Conversions to and from circe-geojson-core types for JTS Geometries
The newest version!
package works.worace.geojson.jts
import org.locationtech.jts.geom.Geometry
import io.circe.{Json, JsonObject, Decoder}
case class JtsFeature(id: Option[String], properties: JsonObject, geometry: Geometry) {
def typed[T](implicit decoder: Decoder[T]): Decoder.Result[TypedJtsFeature[T]] = {
Json
.fromJsonObject(properties)
.as[T](decoder)
.map(props => TypedJtsFeature(id, props, geometry))
}
}