remove redundant scala modules

This commit is contained in:
frillweeman
2025-09-24 14:11:25 -06:00
parent 194289c206
commit d3b8cb19a2
2 changed files with 0 additions and 49 deletions

View File

@@ -29,7 +29,6 @@ object ShotgunServer {
implicit val executionContext: ExecutionContextExecutor = system.dispatcher
val logging = Logging(system, getClass)
val client = new services.OverpassClient()
val nominatim = new services.NominatimClient()
val githubClient = new services.GithubClient()
@@ -56,16 +55,6 @@ object ShotgunServer {
val apiRoutes = pathPrefix("api") {
concat (
path("alpr") {
get {
parameters("minLat".as[Double], "minLng".as[Double], "maxLat".as[Double], "maxLng".as[Double]) { (minLat, minLng, maxLat, maxLng) =>
val bBox = services.BoundingBox(minLat, minLng, maxLat, maxLng)
onSuccess(client.getALPRs(bBox)) { json =>
complete(json)
}
}
}
},
path("geocode") {
get {
parameters("query".as[String]) { query =>

View File

@@ -1,38 +0,0 @@
package services
import org.apache.pekko
import org.apache.pekko.actor.ActorSystem
import pekko.http.scaladsl.Http
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.unmarshalling.Unmarshal
import spray.json._
import scala.concurrent.{ExecutionContextExecutor, Future}
case class BoundingBox(minLat: Double, minLng: Double, maxLat: Double, maxLng: Double)
class OverpassClient(implicit val system: ActorSystem, implicit val executionContext: ExecutionContextExecutor) {
val baseUrl = "https://overpass-api.de/api/interpreter"
def getALPRs(bBox: BoundingBox): Future[JsValue] = {
val query = s"""[out:json][bbox:${bBox.minLat},${bBox.minLng},${bBox.maxLat},${bBox.maxLng}];node["man_made"="surveillance"]["surveillance:type"="ALPR"];out body;>;out skel qt;"""
val formData = FormData("data" -> query).toEntity
val request = HttpRequest(
method = HttpMethods.POST,
uri = baseUrl,
entity = formData
)
Http().singleRequest(request).flatMap { response =>
response.status match {
case StatusCodes.OK =>
Unmarshal(response.entity).to[String].map { jsonString =>
jsonString.parseJson
}
case _ =>
response.discardEntityBytes()
Future.failed(new Exception(s"Failed to get ALPRs: ${response.status}"))
}
}
}
}