ProductPromotion
Logo

Kotlin

made by https://0x3d.site

GitHub - formation-res/overpass-kotlin-client: A simple client for overpass that uses ktor-client and kotlinx.serialization for parsing JSON responses. We are using this at FORMATION to be able to run some simple queries against OpenStreetMap.
A simple client for overpass that uses ktor-client and kotlinx.serialization for parsing JSON responses. We are using this at FORMATION to be able to run some simple queries against OpenStreetMap. ...
Visit Site

GitHub - formation-res/overpass-kotlin-client: A simple client for overpass that uses ktor-client and kotlinx.serialization for parsing JSON responses. We are using this at FORMATION to be able to run some simple queries against OpenStreetMap.

GitHub - formation-res/overpass-kotlin-client: A simple client for overpass that uses ktor-client and kotlinx.serialization for parsing JSON responses. We are using this at FORMATION to be able to run some simple queries against OpenStreetMap.

Java CI with Gradle

Overpass Kotlin Client

A simple client for overpass that uses ktor-client and kotlinx.serialization for parsing JSON responses. We are using this at FORMATION to be able to run some simple queries against OpenStreetMap.

Gradle

This library is published to our own maven repository.

repositories {
    mavenCentral()
    maven("https://maven.tryformation.com/releases") {
        // optional but it speeds up the gradle dependency resolution
        content {
            includeGroup("com.jillesvangurp")
            includeGroup("com.github.jillesvangurp")
            includeGroup("com.tryformation")
        }
    }
}

And then you can add the dependency:

    // check the latest release tag for the latest version
    implementation("com.jillesvangurp:overpass-kotlin-client:x.y.z")

Look up the latest release from the releases on Github.

Usage

To use, add the client dependency to your project. If you are not using Java, also add a suitable ktor client implementation for your platform.

import java.net.http.HttpClient

// has some optional parameters for the endpoint and other things
val client = OverpassClient(
    // pick a ktor client for your platform and make sure to add the dependencies for that
    // see here for selecting the right client for your platform
    // https://ktor.io/docs/eap/client-engines.html#java
    httpClient = HttpClient(Java),
    overpassEndpoint = "https://overpass.kumi.systems/api/interpreter"
)

// define a query
val toiletsBboxKoelnCenter = """
    |[out:json];
    |(
    |   node[amenity=toilets]
    |       (50.91775326845564,6.9158935546875,50.95410145108779,6.979408264160155);
    |   way[amenity=toilets]
    |       (50.91775326845564,6.9158935546875,50.95410145108779,6.979408264160155);
    |);
    |out body;
    |>;
    |out body;
""".trimMargin()

// returns a feature collection
val featureCollection = client.getGeoJson(toiletsBboxKoelnCenter)
// or copy it somewhere like geojson.io to view on a map
println(featureCollection)

// you can also get parse overpass response if you want.
val overpassResponse = client.callAndParse(toiletsBboxKoelnCenter)
println(overpassResponse)

val rawString = client.call(toiletsBboxKoelnCenter)
println(rawString)

Please be mindful of not running expensive queries needlessly when testing against the public overpass servers or run your own server if possible.

Multi-Platform

It's a multi-platform project, so you can build it for IOS, Android, JVM, Browser/Node.js, etc. Wasm support is currently blocked on a few libraries not having wasm builds yet.

Development Status

Quick and dirty job as I needed a client and a parser. But it should work fine as long as you ask overpass for json.

I might build out more features here later. But for now this serves my needs.

Limitations:

  • Relations are not fully supported for geojson yet (TODO)

About FORMATION Gmbh

FORMATION is a Berlin based company that is empowering workforces around the world with maps.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory