Skip to content

fix(geocoding): use PointGeometry for Feature and RetrieveFeature#10

Merged
backevik merged 1 commit into
mainfrom
fix/point-geometry-coordinates
Jul 2, 2026
Merged

fix(geocoding): use PointGeometry for Feature and RetrieveFeature#10
backevik merged 1 commit into
mainfrom
fix/point-geometry-coordinates

Conversation

@backevik

@backevik backevik commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • GeoJSONGeometry.Coordinates was typed as any but geocoding Feature and RetrieveFeature embed it and the JSON decoder failed to unmarshal Point coordinates ([lon, lat]) correctly in production
  • All reverse geocoding calls were failing with cannot unmarshal number into Go struct field GeoJSONGeometry
  • Add PointGeometry with Coordinates []float64 and use it for Feature (geocoding) and RetrieveFeature (searchbox); GeoJSONGeometry remains unchanged for map matching

Test plan

  • New regression test TestReverseGeocode_PointGeometry decodes a real Mapbox Point geometry response body
  • All existing tests pass

@backevik backevik force-pushed the fix/point-geometry-coordinates branch 2 times, most recently from a6d9d2a to 51481fc Compare July 2, 2026 09:44
GeoJSONGeometry.Coordinates was [][]float64 (LineString), but Geocoding v6
returns Point geometry with a flat [lon, lat] coordinate. JSON decode failed
with 'cannot unmarshal number into Go struct field GeoJSONGeometry'.

Add PointGeometry with []float64 coordinates and use it for Feature and
RetrieveFeature. GeoJSONGeometry (LineString) remains unchanged for map
matching.
@backevik backevik force-pushed the fix/point-geometry-coordinates branch from 51481fc to 7280ee5 Compare July 2, 2026 09:45
@backevik backevik merged commit ff62951 into main Jul 2, 2026
1 check passed
@backevik backevik deleted the fix/point-geometry-coordinates branch July 2, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant