Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qba73/geonames
Go client library for Geonames Web Services (geonames.org)
https://github.com/qba73/geonames
geonames geonames-data gis go go-library go-module
Last synced: about 1 month ago
JSON representation
Go client library for Geonames Web Services (geonames.org)
- Host: GitHub
- URL: https://github.com/qba73/geonames
- Owner: qba73
- License: apache-2.0
- Created: 2021-11-12T21:04:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-02T05:30:03.000Z (10 months ago)
- Last Synced: 2024-06-19T13:46:37.662Z (7 months ago)
- Topics: geonames, geonames-data, gis, go, go-library, go-module
- Language: Go
- Homepage:
- Size: 70.3 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Go](https://github.com/qba73/geonames/workflows/Tests/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/qba73/geonames)](https://goreportcard.com/report/github.com/qba73/geonames)
![GitHub](https://img.shields.io/github/license/qba73/geonames)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/qba73/geonames)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/qba73/geonames)
[![Go Reference](https://pkg.go.dev/badge/github.com/qba73/geonames.svg)](https://pkg.go.dev/github.com/qba73/geonames)# geonames
`geonames` is a Go library for [Geonames Web Services](http://www.geonames.org) (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](https://www.geonames.org/login) and register.
## Using the Go library
```go
import github.com/qba73/geonames
```## Creating a client
Export ENV Var ```GEONAMES_USER```
```go
client, err := geonames.NewClient(os.Getenv("GEONAMES_USER"))
if err != nil {
// handle error
}
```Provide username directly:
```go
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](examples/) folder.
- postal codes lookup example: [examples/postal](examples/postal/main.go)
- coordinates lookup example: [examples/wikipedia](examples/wikipedia/main.go)## Bugs and feature request
If you find a bug in the ```geonames``` client library, please [open an issue](https://github.com/qba73/geonames/issues). 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!