Skip to content
/ geonames Public

Go client library for Geonames Web Services (geonames.org)

License

Notifications You must be signed in to change notification settings

qba73/geonames

Repository files navigation

Go Go Report Card GitHub GitHub go.mod Go version GitHub tag (latest SemVer) Go Reference Known Vulnerabilities

geonames

geonames is a Go library for Geonames Web Services (geonames.org). The GeoNames geographical database covers all countries and contains over eleven million placenames.

Setting your username

To use this client library with your geonames account, you will need a unique username. Go to the geonames login and register.

Using the Go library

import github.com/qba73/geonames

Creating a client

Export ENV Var GEONAMES_USER

client, err := geonames.NewClient(os.Getenv("GEONAMES_USER"))
if err != nil {
    // handle error
}

Provide username directly:

client, err := geonames.NewClient("dummy_user")
if err != nil {
    // handle error
}

Complete example programs

You can see complete example programs which retrive coordinates and postal codes in the examples folder.

Bugs and feature request

If you find a bug in the geonames client library, please open an issue. If you'd like a feature added or improved, let me know via an issue.

The project is under development, and not all the functionality of the GeoNames Web Services is implemented yet.

Pull requests welcome!