{"id":17945332,"url":"https://github.com/westnordost/osmapi-overpass","last_synced_at":"2025-03-24T19:34:06.497Z","repository":{"id":57731060,"uuid":"225929963","full_name":"westnordost/osmapi-overpass","owner":"westnordost","description":"Java client for the Overpass API","archived":false,"fork":false,"pushed_at":"2023-11-24T22:22:53.000Z","size":91,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T04:35:45.006Z","etag":null,"topics":["java","osm","overpass-api"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/westnordost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-04T18:19:03.000Z","updated_at":"2024-03-04T22:14:01.000Z","dependencies_parsed_at":"2022-09-26T22:01:44.443Z","dependency_job_id":"2bafb7c7-916d-49ee-9b42-7c2524e722b3","html_url":"https://github.com/westnordost/osmapi-overpass","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westnordost%2Fosmapi-overpass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westnordost%2Fosmapi-overpass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westnordost%2Fosmapi-overpass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westnordost%2Fosmapi-overpass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/westnordost","download_url":"https://codeload.github.com/westnordost/osmapi-overpass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222004817,"owners_count":16914877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","osm","overpass-api"],"created_at":"2024-10-29T06:43:03.835Z","updated_at":"2024-10-29T06:43:04.490Z","avatar_url":"https://github.com/westnordost.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# osmapi-overpass\r\n\r\nosmapi-overpass is a client for the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API), building on top of [osmapi](https://github.com/westnordost/osmapi).\r\n\r\n## Copyright and License\r\n\r\n© 2019-2023 Tobias Zwick. This library is released under the terms of the [GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl-3.0.html) (LGPL).\r\n\r\n## Installation\r\n\r\nAdd [`de.westnordost:osmapi-overpass:3.0`](https://mavenrepository.com/artifact/de.westnordost/osmapi-overpass/3.0) as a Maven dependency or download the jar from there.\r\n\r\n### Android\r\n\r\nOn Android, you need to exclude kxml2 from the dependencies in your `gradle.kts` since it is already built-in, like so:\r\n```kotlin\r\nconfigurations {\r\n    all {\r\n        // it's already included in Android\r\n        exclude(group = \"net.sf.kxml\", module = \"kxml2\")\r\n        exclude(group = \"xmlpull\", module = \"xmlpull\")\r\n    }\r\n}\r\n```\r\n\r\nThis library uses classes from the Java 8 time API, like [`Instant`](https://developer.android.com/reference/java/time/Instant) etc., so if your app supports Android API levels below 26, you need to enable [Java 8+ API desugaring support](https://developer.android.com/studio/write/java8-support#library-desugaring).\r\n\r\n## Example Usage\r\n\r\nFirst, initialize the `OverpassMapDataApi`\r\n\r\n```java\r\n\tOsmConnection connection = new OsmConnection(\"https://overpass-api.de/api/\", \"my user agent\");\r\n\tOverpassMapDataApi overpass = new OverpassMapDataApi(connection);\r\n```\r\n\r\nthen...\r\n\r\n### Get all shops on Malta as OSM elements\r\n\r\n```java\r\n    overpass.queryElements(\r\n        \"[bbox:13.8,35.5,14.9,36.3]; nwr[shop]; out meta;\",\r\n        handler\r\n    );\r\n```\r\n\r\n### Get all shops on Malta as OSM elements together with their geometry\r\n\r\n```java\r\n    overpass.queryElementsWithGeometry(\r\n        \"[bbox:13.8,35.5,14.9,36.3]; nwr[shop]; out meta geom;\",\r\n        handler\r\n    );\r\n```\r\n\r\n### Get all shops on Malta and return their name plus type of shop as table rows\r\n\r\n```java\r\n    overpass.queryTable(\r\n        \"[out:csv(name, shop)][bbox:13.8,35.5,14.9,36.3]; nwr[shop]; out body;\",\r\n        handler\r\n    );\r\n```\r\n\r\n### Count the number of shops on Malta.\r\n\r\n```java\r\n    ElementCount count = overpass.queryCount(\r\n        \"[bbox:13.8,35.5,14.9,36.3]; nwr[shop]; out count;\"\r\n    );\r\n```\r\n\r\nThe query string is just passed through to the Overpass API. For how the query string needs to look like, consult the [documentation for Overpass API Query Language](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestnordost%2Fosmapi-overpass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwestnordost%2Fosmapi-overpass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestnordost%2Fosmapi-overpass/lists"}