fix: preserve click coordinates for wilderness routing

When clicking on a labeled feature (e.g., "Monument Peak"), the code
was using the feature's canonical coordinates instead of the actual
click coordinates. This caused wilderness clicks to snap to named
places that might be on roads, bypassing wilderness routing.

Fix: Always use click coordinates (e.lngLat) for routing purposes.
Feature coordinates are only used for display/detail fetching.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-05-08 23:08:38 +00:00
commit a6942b35ea

View file

@ -2199,12 +2199,16 @@ const MapView = forwardRef(function MapView(_, ref) {
const props = labelFeature.properties
const geom = labelFeature.geometry
// Get feature coordinates (Point geometry)
let featureLat = lat
let featureLon = lng
// CRITICAL: Always use CLICK coordinates for routing (lat, lng from e.lngLat)
// Feature coordinates are only for display/fetching details
let featureLat = lat // Click coordinate - used for routing
let featureLon = lng // Click coordinate - used for routing
let displayLat = lat // May be updated to feature coords for display
let displayLon = lng
if (geom && geom.type === 'Point' && geom.coordinates) {
featureLon = geom.coordinates[0]
featureLat = geom.coordinates[1]
// Store feature's canonical coords separately - NOT for routing
displayLon = geom.coordinates[0]
displayLat = geom.coordinates[1]
}
// FIX A: For park-type features, also query polygon layers to get boundary geometry