Repository navigation
Description
π Final Status β 2026-04-29 (Phase 8 Triage β Closed
wontfix)Disposition: closed as
wontfix. After deep evaluation during Phase 8 triage, the heuristic coordinate-extraction utility proposed in this issue's Option A is not being adopted. The empirical observation worth preserving (six naming conventions across the OSHConnect-Python fleet) has been recorded indocs/research/references.md"Research Findings Not Adopted, Finding 1". The architecturally correct successor (SWE Commonβaware extraction) is tracked at #171, filed deferred from day one.Why no library change
Unit ambiguity is a silent data-loss footgun. The proposed
GeoLocation = { lat, lon, alt? }collapses heterogeneous units into one untypednumber:
- ISS SGP4 emits
alt_kmβ kilometers- OpenSky ADS-B emits
altitudeβ meters or feet (varies)- UAS localizer emits
Location.altβ unspecifiedThe function would happily return
{lat, lon, alt: 408}whether408means 408 km, 408 m, or 408 ft. Consumers pulling values into a typedaltfield would have no signal that unit conversion is needed. Fixing this requires analtUnitfield on the return type, which means consumers can no longer "just plot it" β defeating the convenience pitch the heuristic was trying to make.Heuristic false positives are unbounded. A datastream with measurement variables coincidentally named
lat/lon(e.g. a sensor calibration report with "latitude offset" parameters, or scientific data usinglat/lonas variable abbreviations unrelated to geography) would silently match. Range validation (lat β [-90, 90]) doesn't help β false positives within range are possible.The architecturally correct answer is SWE Common, not field-name matching. OGC 23-002 references SWE Common for result schemas; SWE Common defines
Vectortypes with properreferenceFrame(CRS) and per-componentuom. A schema-aware extractor reading the datastream'sresultStructureis the right path. The original issue acknowledged this as Option B and rejected it as too large β but the alternative isn't "Option A is fine," it's "this doesn't belong in the library yet." Tracked at #171.Maintenance trap by construction. Six conventions today; a seventh tomorrow when someone files an issue with
geo.lat, an eighth for GeoJSON-coordinates-in-result, a ninth forposition[0]/position[1]arrays. Each new convention is a minor version bump downstream consumers must adopt to see the new publisher class. The Explorer's local 30-line function can be edited in place; an exported library function cannot.Same N=1 / N=2 problem as #168. The seven publishers in the convention table are exactly the OSHConnect-Python publisher fleet β a single deployment we operate. We have no evidence that arbitrary CSAPI consumers in the wild hit these specific six conventions. We have direct evidence the Explorer needs them. Same story as Closed (wontfix): library is spec-correct; server-side root cause tracked at connected-systems-go#11; institutional knowledge preserved in references.mdΒ #168: package up our operational knowledge as the library's opinion.
Risk to PR D-1: Resolve
SystemTypeUrisname collision between model.ts and constants.tsΒ #136. Adding a public method whose JSDoc essentially says "matches the conventions we've seen across our 10-publisher fleet" is exactly the opinionated CSAPI surface upstream has been trimming (cf. #122-class feedback).Sampling-feature ambiguity. For most CSAPI publishers, geographic positioning belongs on
SamplingFeatureorSystem.position, not embedded in observationresult. The ISS publisher and localizer use result-embedded coordinates because the position itself is the observation β but that's a narrow class. A library-level coordinate-extraction helper would normalize away an architectural decision that publishers should make consciously.What was preserved instead
- Six-convention naming-diversity table β captured in
docs/research/references.md"Research Findings Not Adopted, Finding 1" with the publishers, unit-ambiguity finding, and defensive guidance for consumers.- Architecturally correct future path β tracked at #171: SWE Commonβaware result-vector extraction, deferred until trigger conditions are met.
- Consumer-side ergonomic note β an Explorer-side TODO will be filed to keep the existing 30-line
extractLatLonFromResult()in place until the SWE Common path is available, with a marker to replace it then.Commit:
a3424a8onphase-8.Cross-references
- Architecturally correct successor: #171 β SWE Commonβaware extraction, deferred from day one.
- Same-pattern predecessor: #168 β N=1-consumer ergonomic helper rejected for the same class of reasons.
- Research catalog:
docs/research/references.mdβ Research Findings Not Adopted, Finding 1.Institutional learning
The original body below this banner remains accurate as a record of the research that surfaced the conventions. The lesson worth carrying forward: research issues that produce useful operational knowledge but no library change are still valuable β the knowledge belongs in the research catalog, not in the API surface. "We learned six conventions" is a finding worth keeping; "we shipped a heuristic that handles those six conventions" is a maintenance commitment we should not make.
Finding
The library's parseObservation() treats the result field as opaque unknown, requiring every map-based consumer to independently implement geographic coordinate extraction logic across 6+ naming conventions used by real-world CSAPI publishers.
Review Source: Live integration testing against connected-systems-go and OSH SensorHub from the ogc-csapi-explorer demo app β ISS orbital position investigation and full publisher fleet map rendering.
Severity: P4-Informational
Category: API Design
Ownership: Ours
Problem Statement
The Observation interface in model.ts defines result?: unknown by design β observation results are schema-dependent and vary by datastream. The parseObservation() function in part2.ts correctly passes the result through without transformation.
However, a very common consumer need is extracting geographic coordinates from observation results for map rendering. During the ISS investigation, the Explorer built a 30-line extractLatLonFromResult() utility that handles 6 different naming conventions observed across the 10-publisher fleet:
Affected code β model.ts L595:
// src/ogc-api/csapi/model.ts
export interface Observation {
// ...
/** Inline result value (type depends on observed property). */
result?: unknown; // β Opaque by design β no coordinate extraction
// ...
}Affected code β part2.ts L505:
// src/ogc-api/csapi/formats/part2.ts β parseObservation()
return {
// ...
...(obj.result !== undefined ? { result: obj.result } : {}),
// β Result is passed through as-is β consumer must parse
};What consumers must build independently:
The Explorer's MapViewPage.vue (lines 1263β1295) implements this extraction:
function extractLatLonFromResult(result: any): { lat: number; lon: number; alt?: number } | null {
if (!result || typeof result !== 'object') return null
// Convention 1: Direct lat/lon (GPS location datastreams)
if (typeof result.lat === 'number' && typeof result.lon === 'number')
return { lat: result.lat, lon: result.lon, alt: result.alt }
// Convention 2: Nested Location object
if (result.Location && typeof result.Location.lat === 'number')
return { lat: result.Location.lat, lon: result.Location.lon, alt: result.Location.alt }
// Convention 3: Nested location object (lowercase)
if (result.location && typeof result.location.lat === 'number')
return { lat: result.location.lat, lon: result.location.lon, alt: result.location.alt }
// Convention 4: Full-word latitude/longitude (triangulated positions, geodetic outputs)
if (typeof result.latitude === 'number' && typeof result.longitude === 'number')
return { lat: result.latitude, lon: result.longitude, alt: result.altitude }
// Convention 5: Title-case Latitude/Longitude
if (typeof result.Latitude === 'number' && typeof result.Longitude === 'number')
return { lat: result.Latitude, lon: result.Longitude, alt: result.Altitude }
// Convention 6: Suffixed variants (ISS tracker: lat_deg, lon_deg, alt_km)
if (typeof result.lat_deg === 'number' && typeof result.lon_deg === 'number')
return { lat: result.lat_deg, lon: result.lon_deg, alt: result.alt_km }
return null
}Real-world naming conventions encountered:
| Publisher | Result Field Names | Convention |
|---|---|---|
| ISS Position (SGP4) | lat_deg, lon_deg, alt_km |
Suffixed |
| OpenSky ADS-B | latitude, longitude, altitude |
Full-word |
| USGS Earthquake | latitude, longitude |
Full-word |
| NWS Surface Obs | lat, lon |
Direct |
| NDBC Buoy | lat, lon |
Direct |
| CO-OPS Tide | lat, lon |
Direct |
| UAS Localizer | Location.lat, Location.lon |
Nested object |
Impact: Any CSAPI consumer building a map view (the most common visualization for Connected Systems data) will need to re-discover and re-implement this extraction logic. The 6 conventions are not documented in the OGC spec β they emerge from real-world publisher diversity.
Ownership Verification
$ git diff upstream/main phase-7 -- src/ogc-api/csapi/model.ts | grep "result"
+ result?: unknown;
$ git diff upstream/main phase-7 -- src/ogc-api/csapi/formats/part2.ts | grep "result"
+ ...(obj.result !== undefined ? { result: obj.result } : {}),
Conclusion: This code is ours. The Observation interface, parseObservation(), and all CSAPI model types were authored as part of our contribution. The upstream camptocamp/ogc-client has zero CSAPI code. The proposed utility would be new code.
Files to Modify
| File | Action | Est. Lines | Purpose |
|---|---|---|---|
src/ogc-api/csapi/formats/part2.ts |
Modify | ~35 | Add extractGeoLocation() utility function |
src/ogc-api/csapi/model.ts |
Modify | ~10 | Add GeoLocation interface ({ lat: number; lon: number; alt?: number }) |
src/ogc-api/csapi/index.ts |
Modify | ~2 | Export new function and type |
src/ogc-api/csapi/formats/part2.spec.ts |
Modify | ~60 | Test all 6 naming conventions + null cases |
Proposed Solutions
Option A: Standalone utility function (Recommended)
Add a extractGeoLocation() function alongside the existing parsers in part2.ts:
/**
* Attempts to extract geographic coordinates from an observation result.
* Handles multiple naming conventions observed across real-world CSAPI publishers.
* Returns null if no recognized coordinate fields are found.
*/
export function extractGeoLocation(
result: unknown
): GeoLocation | null {
if (typeof result !== 'object' || result === null) return null;
const r = result as Record;
// Direct: lat/lon
if (typeof r.lat === 'number' && typeof r.lon === 'number')
return { lat: r.lat, lon: r.lon, ...(typeof r.alt === 'number' ? { alt: r.alt } : {}) };
// Nested: Location.lat / location.lat
for (const key of ['Location', 'location'] as const) {
const nested = r[key];
if (typeof nested === 'object' && nested !== null) {
const n = nested as Record;
if (typeof n.lat === 'number' && typeof n.lon === 'number')
return { lat: n.lat, lon: n.lon, ...(typeof n.alt === 'number' ? { alt: n.alt } : {}) };
}
}
// Full-word: latitude/longitude (both cases)
for (const [latKey, lonKey, altKey] of [
['latitude', 'longitude', 'altitude'],
['Latitude', 'Longitude', 'Altitude'],
] as const) {
if (typeof r[latKey] === 'number' && typeof r[lonKey] === 'number')
return { lat: r[latKey] as number, lon: r[lonKey] as number,
...(typeof r[altKey] === 'number' ? { alt: r[altKey] as number } : {}) };
}
// Suffixed: lat_deg/lon_deg
if (typeof r.lat_deg === 'number' && typeof r.lon_deg === 'number')
return { lat: r.lat_deg, lon: r.lon_deg,
...(typeof r.alt_km === 'number' ? { alt: r.alt_km } : {}) };
return null;
}Pros: Pure function; no coupling to parseObservation(); opt-in utility; preserves result: unknown design; directly replaces 30-line Explorer function
Cons: Heuristic-based β may false-positive on a result that happens to have lat/lon fields that aren't geographic; not schema-aware
Effort: Small | Risk: None
Option B: Schema-driven extraction via datastream metadata
Use the datastream's observedProperties definitions to determine which result fields contain coordinates, then extract only those fields.
export function extractGeoLocationFromSchema(
result: unknown,
observedProperties: string[]
): GeoLocation | null {
// Match property definitions to known geographic ontology URIs
// then extract the corresponding fields from result
}Pros: Schema-aware; no false positives; semantically correct
Cons: Requires datastream metadata at extraction time; much larger implementation; ontology URI matching is fragile across implementations; most publishers don't use standard ontology URIs
Effort: Large | Risk: Medium
Scope β What NOT to Touch
- β Do NOT modify
parseObservation()βresult: unknownis the correct design - β Do NOT add geographic extraction to the collection response parser
- β Do NOT modify the
Observationinterface to add typed coordinate fields - β Do NOT add mapping/rendering logic β this is a data extraction utility only
- β Do NOT add GeoJSON conversion β that's a separate higher-level concern
Acceptance Criteria
- New
extractGeoLocation(result: unknown): GeoLocation | nullfunction exported frompart2.ts - New
GeoLocationinterface ({ lat: number; lon: number; alt?: number }) exported frommodel.ts - Tests cover all 6 naming conventions:
lat/lon,Location.lat,location.lat,latitude/longitude,Latitude/Longitude,lat_deg/lon_deg - Tests cover null/undefined/non-object inputs β returns
null - Tests cover result objects with no recognized coordinate fields β returns
null - Existing tests still pass (
npm test) - No lint errors (
npm run lint) - All modified files pass
npx prettier --check
Dependencies
Blocked by: Nothing
Blocks: Nothing
Related: #166 β Part 2 parsers @link fallback (same Go server interop effort); #110 β @link/@id resolution utilities (different cross-resource concern)
Operational Constraints
β οΈ MANDATORY: Before starting work on this issue, reviewdocs/governance/AI_OPERATIONAL_CONSTRAINTS.md.
Key constraints:
- Precedence: OGC specifications β AI Collaboration Agreement β This issue description β Existing code β Conversational context
- No scope expansion: Fix the finding, nothing more
- Minimal diffs: Prefer the smallest change that satisfies the acceptance criteria
- Ask when unclear: If intent is ambiguous, stop and ask for clarification
- Respect ownership: This code is ours β fix on the current working branch
Ownership-Specific Constraints
If Ours:
- Fix on the current working branch (
phase-7) - Include in the next commit to
clean-prif the PR is still open - Add tests that cover the finding
References
| # | Document | What It Provides |
|---|---|---|
| 1 | src/ogc-api/csapi/formats/part2.ts L490β530 |
parseObservation() β current result pass-through |
| 2 | src/ogc-api/csapi/model.ts L585β605 |
Observation interface β result?: unknown |
| 3 | demo/src/pages/MapViewPage.vue L1263β1295 |
Explorer's extractLatLonFromResult() β 30-line reference implementation |
| 4 | OGC 23-002 Β§13.3 | Observation resources β result is schema-dependent |
| 5 | CSAPI Go Integration Report Β§12.4 | ISS pipeline verification showing all 6 naming conventions in use |
| 6 | OSHConnect-Python publisher fleet | Source of the 7 naming conventions across 10 publishers |
Activity
docs(phase-8): add 'Research Findings Not Adopted' section + Finding β¦
[-]Research: Observation result geographic coordinate extraction utility[/-][+]Closed (wontfix): heuristic coordinate extraction not adopted; architecturally correct path tracked at #171[/+]docs(phase-8): add P8-contribution-goal-and-definition.md (trio doc 1β¦
Merge pull request #169 from camptocamp/improve-apidoc