geonames

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadGeonamesCities

func LoadGeonamesCities() (map[int]Feature, error)

LoadGeonamesCities loads cities from geonameses

Example
package main

import (
	"fmt"

	"github.com/front-matter/commonmeta/geonames"
)

func main() {
	cities, _ := geonames.LoadGeonamesCities()
	s := cities[2950159]
	fmt.Println(s.Name)
}
Output:
Berlin

func LoadGeonamesCountries

func LoadGeonamesCountries() (map[string]Country, error)

LoadGeonamesCountries loads countries from geonamesnames

Example
package main

import (
	"fmt"

	"github.com/front-matter/commonmeta/geonames"
)

func main() {
	countries, _ := geonames.LoadGeonamesCountries()
	s := countries["DK"]
	fmt.Println(s.Name)
}
Output:
Denmark

Types

type Country

type Country struct {
	GeonameID       int64   `json:"geoname_id"`
	Name            string  `json:"name"`
	ISO             string  `json:"iso"`
	ISO3            string  `json:"iso3"`
	ISONumeric      string  `json:"isonumeric"`
	FIPS            string  `json:"fips"`
	ContinentCode   string  `json:"continent_code"`
	Capital         string  `json:"capital"`
	AreaKm2         float64 `json:"areakm2"`
	Population      uint64  `json:"population"`
	TLD             string  `json:"tld"`
	CurrencyCode    string  `json:"currency_code"`
	CurrencyName    string  `json:"currency_name"`
	Phone           string  `json:"phone"`
	PostalCodeRegex string  `json:"postalcode_regex"`
	Languages       string  `json:"languages"`
	Neighbours      string  `json:"neighbours"`
}

Countr represents Geonames Country Info

type Feature

type Feature struct {
	GeonameID        int64     `json:"geoname_id"`        // geoname_id        : integer id of record in geonames database
	Name             string    `json:"name"`              // name              : name of geographical point (utf8) varchar(200)
	ASCIIName        string    `json:"ascii_name"`        // asciiname         : name of geographical point in plain ascii characters, varchar(200)
	AlternateNames   []string  `json:"alternate_names"`   // alternate names   : alternate names, comma separated, ascii names automatically transliterated, convenience attribute from alternatename table, varchar(10000)
	Latitude         float64   `json:"latitude"`          // latitude          : latitude in decimal degrees (wgs84)
	Longitude        float64   `json:"longitude"`         // longitude         : longitude in decimal degrees (wgs84)
	Class            string    `json:"class"`             // feature class     : see http://www.geonames.org/export/codes.html, char(1)
	Code             string    `json:"code"`              // feature code      : see http://www.geonames.org/export/codes.html, varchar(10)l, varchar(10)
	CountryCode      string    `json:"country_code"`      // country code      : ISO-3166 2-letter country code, 2 characters
	Cc2              string    `json:"cc2"`               // cc2               : alternate country codes, comma separated, ISO-3166 2-letter country code, 200 characters
	Admin1Code       string    `json:"admin1_code"`       // admin1 code       : fipscode (subject to change to iso code), see exceptions below, see file admin1Codes.txt for display names of this code; varchar(20)ames of this code; varchar(20)
	Admin2Code       string    `json:"admin2_code"`       // admin2 code       : code for the second administrative division, a county in the US, see file admin2Codes.txt; varchar(80)
	Admin3Code       string    `json:"admin3_code"`       // admin3 code       : code for third level administrative division, varchar(20)
	Admin4Code       string    `json:"admin4_code"`       // admin4 code       : code for fourth level administrative division, varchar(20)el administrative division, varchar(20)
	Population       *int      `json:"population"`        // population        : bigint (8 byte int))
	Elevation        *int      `json:"elevation"`         // elevation         : in meters, integer
	Dem              int       `json:"dem"`               // dem               : digital elevation model, srtm3 or gtopo30, average elevation of 3”x3” (ca 90mx90m) or 30”x30” (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat.elevation of 3”x3” (ca 90mx90m) or 30”x30” (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat.
	TimeZone         string    `json:"time_zone"`         // timezone          : the timezone id (see file timeZone.txt) varchar(40)r(40)
	ModificationDate time.Time `json:"modification_date"` // modification date : date of last modification in yyyy-MM-dd formatModificationDate time.Time
}

Feature represents a single Geonames administrative object - for example, a city

Jump to

Keyboard shortcuts

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