geonames
is a Go library for Geonames Web Services (geonames.org). The GeoNames geographical database covers all countries and contains over eleven million placenames.
To use this client library with your geonames account, you will need a unique username. Go to the geonames login and register.
import github.com/qba73/geonames
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
}
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
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!