Ecommerce Checkout Demo — Auto Address Fill
This demo page showcases how to automatically fill address fields in an ecommerce checkout form using your current location. It demonstrates two methods for location encoding:
- Google Open Location Code (Plus Code)
- Uber H3 Code
How It Works:
- Select a location code type (Plus Code or H3) from the dropdown.
- Click the "Detect & Fill Address" button to get your current location using the browser's geolocation API.
- The app fetches your coordinates.
- It sends the coordinates to the Latlens reverse geocoding API to retrieve a human-readable address.
- The address fields are auto-filled, with the selected location code prefixed to the street address.
- Alternatively, enter a Plus Code or H3 code and click "Decode" to find and fill the address.
Example Output in Street Address field:
7F4VQX2V+G5 — 123 Main St
8a2a1072b59ffff — 123 Main St
Technologies Used:
- Latlens Geolocation API (browser)
- Latlens Geocoding API (reverse geocoding)
- Open Location Code JS (Plus Codes)
- H3 JS (Uber H3 hex codes)
Limitations:
- Requires user permission for location access.
- Address accuracy depends on geocoding service and device GPS.
Try either detecting your location or decoding a known location code!