Device location is an optional input with uncertain accuracy and a privacy cost. A browser may deny the request, return a cached position, time out, or provide a point too imprecise for the intended action. A map can show a neighborhood while the application still needs an exact facility selected by ID. Location permission must follow a clear user action, and a continuous watch must stop when its task ends. A text search and ordered facility list give people a route through the same workflow without granting location or using pointer gestures.
Location Consent, Precision, and Map Alternatives
Working case
A reviewer wants the nearest pump inspection while standing at station 47. The site asks for high-accuracy location on first load and silently stores every update. A reviewer on a shared tablet declines, and the page leaves only an empty map. The revised page begins with a district search and list of authorized facilities. A button requests location to suggest a starting area, explaining that accuracy may vary. If the reported accuracy radius is 1,900 meters, it does not auto-select a pump 47 meters away; it shows candidate facilities and asks the reviewer to choose by name and case ID. The location watch ends when the page closes or the reviewer stops using it.
Implementation boundary
function maySuggestExactFacility(position, facility) {
return position.accuracyMeters <= 47 && facility.distanceMeters <= 47 &&
facility.authorized;
}
console.log(maySuggestExactFacility({ accuracyMeters: 1900 }, { distanceMeters: 47, authorized: true }));
// Output: falseDo not request location until the user chooses a nearby task. Bound timeout and maximum accepted age. Inspect the returned accuracy value and show uncertainty in the interface; it is not proof that a named facility was visited. Store only the precision and duration needed for the product task, or avoid storage when the position only centers a map. Stop active watchers on route change, sign-out, and explicit stop. If permission is denied or unavailable, retain district search, address entry, and the authorized list. Give map pins meaningful labels and keep equivalent actions in list rows with keyboard focus and visible state. A result count and selected facility name belong outside the map canvas, where assistive technology can read them. Avoid autoplay-like repeated prompts after denial.
Cost and boundaries
A single location request costs device power and latency; high-accuracy continuous watching can cost much more over time. A location update that triggers a nearby query every second also costs network and database work, so debounce by time and meaningful movement. A list with N authorized results costs O(N) to render unless paginated or virtualized with an accessible strategy. The privacy cost of retaining exact coordinates grows with time and population even when byte storage is small. Measure permission denial, fallback completion, accuracy bands, watcher lifetime, query count per session, and keyboard/list completion. Do not use raw path histories as a routine success metric.
Failure trace
Deny location and complete the same facility-opening task with district search. Return a stale cached position, a timeout, and a 1,900-meter accuracy radius; none should silently select one pump. Start a watch, change routes, and verify it is cleared. Keep the browser page open but backgrounded and inspect unnecessary updates and queries. Use keyboard only to select a facility from the list and return from its detail page. Turn off tiles and complete through text. Revoke case permission between map render and list selection, then deny the record open. Inspect logs and storage for exact coordinates after the stated retention window.
Verification
- Location denial leaves a complete text workflow.
- Low accuracy cannot auto-select a facility.
- Active watches stop when the task ends.
Practice drill
Implement a nearby suggestion for case 47 with an optional location button. Use a 5-second timeout, a 60-second maximum cached age, and a 1,900-meter accuracy test that requires manual facility selection. Simulate denial, timeout, low accuracy, and a valid point. In each case, open an authorized facility from a keyboard-ready list. Start a watch for an active field session, then end the session and count remaining callbacks and server searches. Document what location data, if any, is retained.
Decision note
Location may narrow a search; the user and server still decide which facility record may be opened.
Common Mistakes
- Requesting precise location on initial page load.
- Treating a position estimate as proof of site presence.
- Making map pins the only action controls.
Related lessons
Geospatial Web Interfaces and Spatial Queries; Coordinate Validation, Projection, and the Antimeridian; Map Viewport Tiles and Request Lifecycle; Nearby Spatial Search and Tenant Filter; Geolocation Accuracy, Cancellation, and Retention; Project: accessible inspection map and export.
Connected practice
Build Project: authorized facility map and nearby search and review Web Development: geospatial decisions quiz.
