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.
- postal codes lookup example: examples/postal
- coordinates lookup example: examples/wikipedia
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!