Help us shape the future of Go! Take the 2026 Go Developer Survey

geoosm

package module
v0.0.0-...-d987dcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2017 License: MIT Imports: 3 Imported by: 0

README

OpenStreetMap Geolocation in Golang

This package provides access to Nominatim, a tool to search OSM data by name and address.

Install

Simply run go get github.com/nicostuhlfauth/geoosm

Use the package

Example:

package main

import (
	"fmt"

	"log"

	"github.com/nicostuhlfauth/geoosm"
)

func main() {
	data, err := geoosm.NewOSMData().GetJSON("Times+Square,+New+York,+USA")
	if err != nil {
		log.Println(err)
	}
	fmt.Println(data[0].Lat + "," + data[0].Lon)
}

License

MIT.

Data License

The OpenStreetMap data is provided under the terms of Open Database License (ODbL).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OSMData

type OSMData []struct {
	PlaceID     string   `json:"place_id"`
	Licence     string   `json:"licence"`
	OsmType     string   `json:"osm_type"`
	OsmID       string   `json:"osm_id"`
	Boundingbox []string `json:"boundingbox"`
	Lat         string   `json:"lat"`
	Lon         string   `json:"lon"`
	DisplayName string   `json:"display_name"`
	Class       string   `json:"class"`
	Type        string   `json:"type"`
	Importance  float64  `json:"importance"`
}

OSMData Stores information of OSM JSON response

type OSMSlice

type OSMSlice OSMData

OSMSlice Stores OSMData

func NewOSMData

func NewOSMData() *OSMSlice

NewOSMData Generates a new OSMSlice

func (*OSMSlice) GetJSON

func (osmdata *OSMSlice) GetJSON(query string) (OSMData, error)

GetJSON Writes JSON response to OSMData object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL