[Feature Request]: Improve /api/maps/search results for foreign-region queries #975
Unanswered
kjake
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Two small, backward-compatible additions to
POST /api/maps/searchthat improve results when callers know the rough geographic context of their query:locationBias(lat/lng/radius). Forwarded to Google Places Text Search aslocationBias.circle. Without it, foreign-coordinate queries get biased by the API key's billing region.types[]field in the response. Already returned by Google, currently dropped before reaching callers.Both fields are optional / additive — the default behavior is unchanged.
Motivation
I hit both of these while building an external photo-import pipeline against my self-hosted Trek instance. The pipeline takes EXIF GPS coordinates from old iPhone photos and asks Trek to name the nearest POIs, so it can auto-create places on trips that pre-date my use of Trek (in my case, a 2011 China/Thailand trip where most photos came from a Canon point-and-shoot but a handful had iPhone 4S GPS data).
Two pain points:
searchPlaces("park near 22.30,114.17")(Hong Kong) returned results from my home region (US Midwest) instead of Hong Kong. Google's Text Search needslocationBiasto know where the caller actually means; without it, it defaults to the billing region of the API key.tourist_attraction/park) over "Victoria Peak Cafe" (arestaurantnamed after it). Google returns this signal intypes[]per result, but it's not exposed by/api/maps/searchtoday, so my pipeline had to round-trip throughplace-detailsto filter.Proposed shape
Request body (additions):
Response (addition per result):
{ "places": [ { "name": "...", "address": "...", "lat": ..., "lng": ..., "types": ["park", "tourist_attraction"] // new } ] }Compatibility
types: string[]is purely additive — UI that ignores it is unaffected.locationBiastoday).Status
Draft PR up at #974 implementing both pieces (~35 lines across
routes/maps.ts+services/mapsService.ts). Leaving it as a draft until approval via this Discussion. Happy to add integration test coverage inserver/tests/integrationonce the direction is approved.There's a related but more invasive idea I have — a brand-new
/api/maps/nearbyendpoint for the same photo-import use case — that I'll open as a separate Discussion to keep the conversations focused.Beta Was this translation helpful? Give feedback.
All reactions