All Downloads are FREE. Search and download functionalities are using the official Maven repository.

geotrellis.vector.io.json.GeoJson.scala Maven / Gradle / Ivy

Go to download

GeoTrellis is an open source geographic data processing engine for high performance applications.

There is a newer version: 0.10.3
Show newest version
package geotrellis.vector.io.json

import spray.json._
import spray.json.JsonFormat

/** An object whose methods parse string representations as GeoJson */
object GeoJson {

  /** Parse a string as Json */
  def parse[T: JsonReader](json: String) =
    json.parseJson.convertTo[T]

  /** Parse a file's contents as Json */
  def fromFile[T: JsonReader](path: String) = {
    val src = scala.io.Source.fromFile(path)
    val txt =
      try {
        src.mkString
      } finally {
        src.close
      }
    parse[T](txt)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy