A zone is about to learn which subwatershed it lies in, and the claim needs a machine-readable spelling beside whatever sentence the card shows. atlas.hydro.huc12 carries the USGS twelve-digit hydrologic unit code on a zone, experimental, held to exactly twelve digits. The registry document's parity test learns that a key may carry a digit, which no key had needed to before.
- commit
- 22c207edf1e865d56af71a960377e4e54b2eade4
- parent
- 68b174f5ad3b39f611df4c40e50e96c8fd1695cf
- author
- Dami <dami.etoile@gmail.com>
- kind
- feat risk score 0.8 of 3, Jev's estimate
| M | internal/ | 1 | + |
| M | internal/ | 20 | ++++++++++++++++++++ |
| M | internal/ | 2 | +- |
@@ -29,6 +29,7 @@ breaks; new keys arrive as `experimental` and earn `stable`.
2929 | `atlas.geometry.radius_km` | world | decimal string | experimental | The body's mean radius. |3030 | `atlas.geo.lat` | location | decimal degrees | experimental | True planetary latitude as published (planetocentric). Provenance and card material; rendering derives from the map-level mapping. |3131 | `atlas.geo.lon` | location | decimal degrees | experimental | True planetary longitude as published (east-positive). |32+| `atlas.hydro.huc12` | zone | twelve digits | experimental | The USGS twelve-digit hydrologic unit — the subwatershed — the zone's ground lies wholly within, from the national Watershed Boundary Dataset. A zone spanning subwatersheds carries no key rather than a misleading one. |3233 | `atlas.stroke.width_px` | zone | positive decimal (world px) | experimental | The ground width of a zone whose features are lines: a trail is a line and a weight, and the weight lets a reader draw the path as one continuous stroke. |3334 | `atlas.category.key` | category | slug | experimental | A category's merge identity across sources. Absent, the icon key stands in. |3435 @@ -116,6 +116,13 @@ const (
116116 KeyGeoLat = "atlas.geo.lat"117117 KeyGeoLon = "atlas.geo.lon"118118 119+ // HydroHUC12 names the USGS twelve-digit hydrologic unit -- the120+ // subwatershed -- a zone's ground lies wholly within, from the national121+ // Watershed Boundary Dataset, so watershed membership is machine-readable122+ // beside whatever sentence the zone's card shows. A zone spanning123+ // subwatersheds carries no key rather than a misleading one.124+ KeyHydroHUC12 = "atlas.hydro.huc12"125+119126 // StrokeWidthPx is the ground width of a zone whose features are lines120127 // rather than areas, in world pixels: a trail is a line and a weight,121128 // and declaring the weight lets a reader draw the path as one@@ -196,6 +203,18 @@ func positiveDecimal(value string) error {
196203 return nil197204 }198205 206+func huc12(value string) error {207+ if len(value) != 12 {208+ return fmt.Errorf("%q is not twelve digits", value)209+ }210+ for _, r := range value {211+ if r < '0' || r > '9' {212+ return fmt.Errorf("%q is not twelve digits", value)213+ }214+ }215+ return nil216+}217+199218 func setName(value string) error {200219 set, name, found := strings.Cut(value, "/")201220 if !found || set == "" || name == "" {@@ -239,6 +258,7 @@ var registry = map[string]definition{
239258 KeyGeometryRadiusKM: {EntityWorld, Experimental, decimal},240259 KeyGeoLat: {EntityLocation, Experimental, decimal},241260 KeyGeoLon: {EntityLocation, Experimental, decimal},261+ KeyHydroHUC12: {EntityZone, Experimental, huc12},242262 KeyStrokeWidthPx: {EntityZone, Experimental, positiveDecimal},243263 KeyCategoryKey: {EntityCategory, Experimental, slug},244264 }@@ -131,7 +131,7 @@ func TestRegistryAgreesWithItsDocument(t *testing.T) {
131131 if err != nil {132132 t.Fatal(err)133133 }134- row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z_.]+)` \\| (bundle|world|zone|category|location) \\|.*\\| (stable|experimental) \\|")134+ row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z0-9_.]+)` \\| (bundle|world|zone|category|location) \\|.*\\| (stable|experimental) \\|")135135 documented := make(map[string][2]string)136136 for _, match := range row.FindAllStringSubmatch(string(doc), -1) {137137 documented[match[1]] = [2]string{match[2], match[3]}