clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

feat: register the subwatershed key

Dami committed 22c207e
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
3 files changed, +22 -1
Minternal/semconv/REGISTRY.md1+
Minternal/semconv/semconv.go20++++++++++++++++++++
Minternal/semconv/semconv_test.go2+-
M internal/semconv/REGISTRY.md +1 -0
M internal/semconv/semconv.go +20 -0
@@ -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 }
M internal/semconv/semconv_test.go +1 -1