Geoname

public struct Geoname
extension Geoname: Equatable, Hashable

A single geographic place.

This corresponds to a single row in the main “geoname” table described in the GeoNames documentation 1. We exclude fields we don’t need.

  • The geonameid straight from the geoname table.

    Declaration

    Swift

    public var geonameId: Int64
  • The geoname type. This is derived from feature_class and feature_code as a more convenient representation of the type.

    Declaration

    Swift

    public var geonameType: GeonameType
  • The place’s primary name.

    Declaration

    Swift

    public var name: String
  • ISO-3166 two-letter uppercase country code, e.g., “US”.

    Declaration

    Swift

    public var countryCode: String
  • Primary geoname category. Examples:

    “PCLI” - Independent political entity: country “A” - Administrative division: state, province, borough, district, etc. “P” - Populated place: city, village, etc.

    Declaration

    Swift

    public var featureClass: String
  • Secondary geoname category, depends on feature_class. Examples:

    “ADM1” - Administrative division 1 “PPL” - Populated place like a city

    Declaration

    Swift

    public var featureCode: String
  • Administrative divisions. This maps admin division levels (1-based) to their corresponding codes. For example, Liverpool has two admin divisions: “ENG” at level 1 and “H8” at level 2. They would be represented in this map with entries (1, "ENG") and (2, "H8").

    Declaration

    Swift

    public var adminDivisionCodes: [UInt8 : String]
  • Population size.

    Declaration

    Swift

    public var population: UInt64
  • Latitude in decimal degrees (as a string).

    Declaration

    Swift

    public var latitude: String
  • Longitude in decimal degrees (as a string).

    Declaration

    Swift

    public var longitude: String
  • Declaration

    Swift

    public init(
        /**
         * The `geonameid` straight from the geoname table.
         */geonameId: Int64, 
        /**
         * The geoname type. This is derived from `feature_class` and
         * `feature_code` as a more convenient representation of the type.
         */geonameType: GeonameType, 
        /**
         * The place's primary name.
         */name: String, 
        /**
         * ISO-3166 two-letter uppercase country code, e.g., "US".
         */countryCode: String, 
        /**
         * Primary geoname category. Examples:
         *
         * "PCLI" - Independent political entity: country
         * "A" - Administrative division: state, province, borough, district, etc.
         * "P" - Populated place: city, village, etc.
         */featureClass: String, 
        /**
         * Secondary geoname category, depends on `feature_class`. Examples:
         *
         * "ADM1" - Administrative division 1
         * "PPL" - Populated place like a city
         */featureCode: String, 
        /**
         * Administrative divisions. This maps admin division levels (1-based) to
         * their corresponding codes. For example, Liverpool has two admin
         * divisions: "ENG" at level 1 and "H8" at level 2. They would be
         * represented in this map with entries `(1, "ENG")` and `(2, "H8")`.
         */adminDivisionCodes: [UInt8: String], 
        /**
         * Population size.
         */population: UInt64, 
        /**
         * Latitude in decimal degrees (as a string).
         */latitude: String, 
        /**
         * Longitude in decimal degrees (as a string).
         */longitude: String)
  • Declaration

    Swift

    public static func == (lhs: Geoname, rhs: Geoname) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)