mugiss
is a small web service for doing offline reverse geocoding (and possibly more in the future). Given a latitude and longitude pair, mugiss
will return you the corresponding city and country name.
While various alternatives are available for this type of tasks, they usually tend to be based on the use of an external database.
The goal of mugiss
is to be simple to use, without complicated setup process, lightweight and fast.
Warning: mugiss
is currently in alpha stage.
On Debian/Ubuntu:
# apt-get install libgeos-dev
$ git clone https://github.com/fg1/mugiss.git
$ cd mugiss
$ go get
$ go build
A CSV file with the country and cities you're interested in is needed. mugiss-extract
can be used for this purpose, or you can use files from the gisgraph website.
You can then start the webserver:
$ ./mugiss -d FR.tar.bz2
The server will then load the file (FR.tar.bz2
in this case), and start serving HTTP requests once finished.
Example:
$ curl -s http://127.0.0.1:8080/rg/48.858222/2.2945 | aeson-pretty -s
{
"city": "Paris",
"country": "France",
"country_iso3166-2": "FR",
"country_iso3166-3": "FRA",
"type": "city"
}
Further examples:
- City administrative boundaries: gisgraphy.com
- Country administrative boundaries: delight-im/FreeGeoDB
- ISO-3166 country codes: lukes/ISO-3166-Countries-with-Regional-Codes
Here is a list of possible future improvements.
- Better memory management
- Automatically download the GIS data
- Embed a world map in the server to determine which country to download
- Download the country data via a script or directly from the server
- Add parsers for data from other sources (ex: Natural Earth, Global Administrative Areas)
- Add more informations in the returned object
- Add an info page to manage the server
- Geocoding (address to lat/lng)
Contributions are welcome. Have a look at the TODO list above, or come with your own features.
- Fork the repository
- Create your feature branch (
git checkout -b my-feature
) - Format your changes (
go fmt
) and commit it (git commit -am 'Commit message'
) - Push to the branch (
git push origin my-feature
) - Create a pull request