Logo

0x3d.Site

is designed for aggregating information.
Welcome
check repository here

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.

Kotlin
Kotlin
Kotlin is a modern programming language interoperable with Java, designed for Android development. It offers a concise syntax and powerful features like null safety and coroutines, streamlining app development.
Kotlin | The Kotlin Blog
Kotlin | The Kotlin Blog
Build software better, together
Build software better, together
Build software better, together
Build software better, together
GitHub - z-huang/InnerTune: A Material 3 YouTube Music client for Android
GitHub - z-huang/InnerTune: A Material 3 YouTube Music client for Android
Build software better, together
Build software better, together
quasar/quasar-kotlin at master · puniverse/quasar
quasar/quasar-kotlin at master · puniverse/quasar
Kotlin Programming Language
Kotlin Programming Language
GitHub - KotatsuApp/Kotatsu: Manga reader for Android
GitHub - KotatsuApp/Kotatsu: Manga reader for Android
GitHub - iamr0s/Dhizuku: A Android Application for share DeviceOwner
GitHub - iamr0s/Dhizuku: A Android Application for share DeviceOwner
Kotlin: An Illustrated Guide
Kotlin: An Illustrated Guide
GitHub - cansik/kotlin-latex-listing: A syntax highlighting template for the Kotlin language in LaTeX listings.
GitHub - cansik/kotlin-latex-listing: A syntax highlighting template for the Kotlin language in LaTeX listings.
GitHub - qwertukg/xml-builder: Simplest XML builder for Kotlin
GitHub - qwertukg/xml-builder: Simplest XML builder for Kotlin
GitHub - cesarferreira/kotlin-pluralizer: :sunny: Kotlin extension to pluralize and singularize strings
GitHub - cesarferreira/kotlin-pluralizer: :sunny: Kotlin extension to pluralize and singularize strings
Kotlin Cheat Sheet
Kotlin Cheat Sheet
GitHub - vert-x3/vertx-lang-kotlin: Vert.x for Kotlin
GitHub - vert-x3/vertx-lang-kotlin: Vert.x for Kotlin
GitHub - hotchemi/khronos: An intuitive Date extensions in Kotlin.
GitHub - hotchemi/khronos: An intuitive Date extensions in Kotlin.
GitHub - icela/FriceEngine: :video_game: JVM game engine based on Swing/JavaFX.
GitHub - icela/FriceEngine: :video_game: JVM game engine based on Swing/JavaFX.
GitHub - holgerbrandl/jsonbuilder: A small artefact to build json with kotlin
GitHub - holgerbrandl/jsonbuilder: A small artefact to build json with kotlin
Kotlin Standard Functions cheat-sheet
Kotlin Standard Functions cheat-sheet
GitHub - MarkusAmshove/Kluent: Fluent Assertion-Library for Kotlin
GitHub - MarkusAmshove/Kluent: Fluent Assertion-Library for Kotlin
GitHub - jershell/kbson: Mongo BSON support for kotlinx.serialization.
GitHub - jershell/kbson: Mongo BSON support for kotlinx.serialization.
GitHub - sepatel/tekniq: A framework designed around Kotlin providing Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more
GitHub - sepatel/tekniq: A framework designed around Kotlin providing Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more
GitHub - Ahoo-Wang/Simba: Distributed lock service | 分布式锁服务
GitHub - Ahoo-Wang/Simba: Distributed lock service | 分布式锁服务
GitHub - JetBrains/intellij-community: IntelliJ IDEA Community Edition & IntelliJ Platform
GitHub - JetBrains/intellij-community: IntelliJ IDEA Community Edition & IntelliJ Platform
GitHub - seniorjoinu/reliable-udp: Multiplexed, coroutine-powered reliable UDP for Kotlin using fountain codes
GitHub - seniorjoinu/reliable-udp: Multiplexed, coroutine-powered reliable UDP for Kotlin using fountain codes
GitHub - hypercube1024/firefly: Firefly is an asynchronous web framework for rapid development of high-performance web application.
GitHub - hypercube1024/firefly: Firefly is an asynchronous web framework for rapid development of high-performance web application.
GitHub - davidepianca98/KMQTT: Kotlin Multiplatform MQTT client & embeddable and standalone broker
GitHub - davidepianca98/KMQTT: Kotlin Multiplatform MQTT client & embeddable and standalone broker
GitHub - L-Briand/KTM: Mustache template engine in kotlin multiplatform
GitHub - L-Briand/KTM: Mustache template engine in kotlin multiplatform
GitHub - sergeshustoff/dikt: Simple and powerful DI for kotlin multiplatform
GitHub - sergeshustoff/dikt: Simple and powerful DI for kotlin multiplatform
GitHub - ParserKt/ParserKt: Naive one-pass recursive descent, scannerless parser framework for Kotlin
GitHub - ParserKt/ParserKt: Naive one-pass recursive descent, scannerless parser framework for Kotlin
Kotlin
More on Kotlin

Programming Tips & Tricks

Code smarter, not harder—insider tips and tricks for developers.

Error Solutions

Turn frustration into progress—fix errors faster than ever.

Shortcuts

The art of speed—shortcuts to supercharge your workflow.
  1. Collections 😎
  2. Frequently Asked Question's 🤯

Tools

available to use.

Made with ❤️

to provide resources in various ares.