Latest 1.0.3
Homepage https://github.com/holyturt/SwiftOverpassWrapper
License MIT
Platforms ios 10.0, requires ARC
Dependencies AEXML, Alamofire
Authors

This library aims to make a query for the Overpass API easily in Swift.

Usage

Let’s say this is an Overpass XML collects nodes which have the key "name" that equals the value "Gielgen":

<osm-script>
  <query type="node">
    <bbox-query e="7.25" n="50.8" s="50.7" w="7.1"/>
    <has-kv k="name" v="Gielgen"/>
  </query>
  <print/>
</osm-script>

can be written like:

#import SwiftOverpass

let query = SwiftOverpass.query(type: .node)
query.setBoudingBox(s: 50.7, n: 50.8, w: 7.1, e: 7.25)
query.hasTag("name", equals: "Gielgen")

SwiftOverpass.api(endpoint: "http://overpass-api.de/api/interpreter")
  .fetch(query) { (response) in
    // do whatever you want
  }

Example

Overpass XML:

<union>
  <query type="node">
    <has-kv k="name" v="Schloss Neuschwanstein"/>
  </query>
  <recurse type="node-relation"/>
</union>
<print/>

Swift:

let nodeQuery = SwiftOverpass.query(type: .node)
nodeQuery.hasTag("name", equals: "Schloss Neuschwanstein")
let relationQuery = nodeQuery.related(.relation)

SwiftOverpass.api(endpoint: "http://overpass-api.de/api/interpreter")
  .fetch([nodeQuery, relationQuery]) { (response) in
    // do whatever you want
  }

Installation

CocoaPods:

pod 'SwiftOverpass'

Carthage:

github "holyturt/SwiftOverpassWrapper"

License

This software is freely distributable under the MIT License.

Latest podspec

{
    "name": "SwiftOverpass",
    "version": "1.0.3",
    "summary": "A wrapper of Overpass API.",
    "homepage": "https://github.com/holyturt/SwiftOverpassWrapper",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Sho Kamei": "[email protected]"
    },
    "social_media_url": "http://twitter.com/kameaulait",
    "platforms": {
        "ios": "10.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/holyturt/SwiftOverpassWrapper.git",
        "tag": "v1.0.3",
        "submodules": true
    },
    "source_files": "SwiftOverpass/**/*.{h,swift}",
    "dependencies": {
        "AEXML": [
            "~> 4.2.2"
        ],
        "Alamofire": [
            "~> 4.5"
        ]
    },
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This