Skip to content

andy/onwater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onwater.io golang API wrapper

godoc license Build Status

Onwater.io is an API for determining if a point (latitude and longitude) is on water or land. This library is a small wrapper around for working with that API.

Installation

go get github.com/andy/onwater

Example

package main

import (
  "context"
  "os"

  "github.com/andy/onwater"
)

func main() {
  client := onwater.New(os.Getenv("ONWATER_API_KEY")) // "" for an unpaid API Key with rate limits

  isWater, err := client.OnWater(context.Background(), 55.753675, 37.621339)
  if err != nil {
    // handle error which is most likely a http error or reply status code was not 200
  }

  if isWater {
    // lat/lng is on water
  } else {
    // lat/lng is on land
  }
}

Note that there is also client.OnLand which is just an opposite for client.OnWater

About

Golang wrapper around onwater.io API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages