Module: NaturalEarth::Geometries

Extended by:
ISO3166
Defined in:
lib/natural_earth/geometries.rb

Overview

:nodoc:

Constant Summary collapse

COUNTRY_PATH =
'geometries/%<iso3166_1>s/%<iso3166_1>s.json'
SUBDIVISION_PATH =
'geometries/%<iso3166_1>s/%<iso3166_2>s.json'

Class Method Summary collapse

Methods included from ISO3166

as_iso3166_1, as_iso3166_2

Class Method Details

.country(iso3166) ⇒ Object

Raises:

  • (KeyError)


14
15
16
17
18
# File 'lib/natural_earth/geometries.rb', line 14

def country(iso3166)
  raise KeyError unless Countries.supported?(iso3166)

  load(path(COUNTRY_PATH, iso3166_1: as_iso3166_1(iso3166)))
end

.subdivision(iso3166) ⇒ Object

Raises:

  • (KeyError)


20
21
22
23
24
# File 'lib/natural_earth/geometries.rb', line 20

def subdivision(iso3166)
  raise KeyError unless Subdivisions.supported?(iso3166)

  load(path(SUBDIVISION_PATH, iso3166_1: as_iso3166_1(iso3166), iso3166_2: as_iso3166_2(iso3166)))
end