Skip to main content
`Ctrl`+`K`

# `counties.yml`

YAML File | `counties.yml`
Loader Class | `yaml.SafeLoader`
Dumper Class | `CountyInfoDumper`
Python Module | `ng911ok.lib.counties`
Python Class | `CountyInfo`

## YAML Structure

### Top-Level Keys

The root object of `counties.yml` is a sequence; there are no top-level keys. Each sequence item, however, is a mapping with the following keys:

`state` | …
`name` | …
`fips3` | …
`number` | …

### Tags

No tags are used in `counties.yml`.

### Anchors

No anchors are used in `counties.yml`.

## Python Implementation

### The `CountyInfo` Class

...

### Generating `counties.yml`

The YAML file can be automatically generated by running the `ng911ok.lib.counties` module directly from the command line.

    usage: counties.py [-h] (-s STATE_FIELD | -S STATE_DEFAULT) [-c COUNTY_FIELD] [-f FIPS_FIELD] [-n NUMBER_FIELD] input_feature_class output_yaml

    positional arguments:
      input_feature_class
      output_yaml

    options:
      -h, --help            show this help message and exit
      -s STATE_FIELD, --state-field STATE_FIELD
      -S STATE_DEFAULT, --state-default STATE_DEFAULT
      -c COUNTY_FIELD, --county-field COUNTY_FIELD
      -f FIPS_FIELD, --fips-field FIPS_FIELD
      -n NUMBER_FIELD, --number-field NUMBER_FIELD

Note

Be sure to run as a module (with the `-m` flag) rather than as a script, e.g.,

    python -m ng911ok.lib.counties "path\to\data.gdb\county_feature_class" "path\to\write\counties.yml" -c COUNTY_NAME -f COUNTY_FIPS_NO -n COUNTY_NO -S OKLAHOMA

Hint

If `ModuleNotFoundError: No module named 'ng911ok'` is encountered, change the working directory to the top-level Toolkit directory (the parent of the `ng911ok` directory).