Skip to content

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

Closed
backevik wants to merge 2 commits into
mainfrom
backevik/geocoding-permanent-tier
Closed

fix(geocoding): use PointGeometry for Feature and RetrieveFeature#9
backevik wants to merge 2 commits into
mainfrom
backevik/geocoding-permanent-tier

Conversation

@backevik

@backevik backevik commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • GeoJSONGeometry.Coordinates was [][]float64 (LineString, used by map matching), but Geocoding v6 returns Point geometry with a flat [lon, lat] coordinate
  • JSON decode failed with cannot unmarshal number into Go struct field GeoJSONGeometry.features.g…, causing all reverse geocoding to fail in production
  • Add PointGeometry with []float64 coordinates and use it for Feature and RetrieveFeature; GeoJSONGeometry (LineString) remains unchanged for map matching

Test plan

  • New regression test TestReverseGeocode_PointGeometry exercises decode with real Point geometry in the response body
  • All existing tests pass

backevik added 2 commits July 1, 2026 17:32
Add Permanent bool to ReverseGeocodeRequest and BatchReverseGeocodeRequest.
When true, passes permanent=true to the Mapbox API, selecting the Permanent
tier which permits storing and caching geocoding results. Defaults to false
(Temporary tier) to preserve backward compatibility.
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 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of a clean PR off main.

@backevik backevik closed this Jul 2, 2026
@backevik backevik deleted the backevik/geocoding-permanent-tier branch July 2, 2026 09:43
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