Swiftpack.co - hlemai/SwiftReverseGeoCode as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hlemai.
hlemai/SwiftReverseGeoCode 2.0.1
Local reverse geocoding with swift
⭐️ 0
🕓 4 weeks ago
iOS macOS
.package(url: "https://github.com/hlemai/SwiftReverseGeoCode.git", from: "2.0.1")


Offline GeoCoding class based on GeoNames data. This package provide a fast and efficient way for translating GPS Coordinate in textual location.

Adapted from Lucas Spiller offline-geocoder project. Thanks to him for the clean documentation and explanations.


As explain Lucas Spiller, " This uses data from the GeoNames project, which is free to use under the Creative Commons Attribution 3.0 license. To enable this to work offline, the data is imported into a SQLite database which is roughly 12 MB, so easily embeddable within an application. "

Database Setup

First you should build a sqlite database that contains all the relevant point of interest.

cd Data

This script download data on geonames web site, and fill the sql database. In comment you can choose to get only important cities or a full coverage of worldwide location. It's easy to adapt the script to download only one country.


The librairy is available within swift package manager. the url of the package is

.package(url: "https://github.com/hlemai/SwiftReverseGeoCode.git", from : "1.0.0"),

The name of the librairy is SwiftReverseGeoCode.

The result are provided in a LocationDescription Struct. The nearest point of interest in the database is returned.

let reverseService = ReverseGeoCodeService(database: "path/to/geocitydb.sqlite")

let location = try reverseService.reverseGeoCode(latitude: 37.78772166666667, longitude: -122.40679166666666)

// location.countryCode == "US"
// location.name == "Chinatown"


This library is licensed under the MIT license.

You don't need to give this library attribution, but you must do so for GeoNames if you use their data!


Stars: 0
Last commit: 3 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Version 2.0.1
2 weeks ago

Ready to production version.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics