Web component · No API key · MIT

Pan the map.
Get the exact lat,lng.

A form field for one precise point. People move the map under a fixed pin, search, paste coordinates or tap “Use my location”, and your form receives "lat,lng". OpenStreetMap needs no API key; Google Maps and MapLibre are there when you choose them.

Latitude and longitude finder

Latitude–
Longitude–

Drag the map, search, or use your location.

Your form receiveslocation=

Build a no-code snippet
npm i location-picker
  • Submits with any form
  • No API key
  • No location prompt until asked

Get started

Copy, paste, done

One script tag defines <location-picker>. Keep the @3 in the URL: it pins the major version.

index.html
<script src="https://cdn.jsdelivr.net/npm/location-picker@3"></script>

<label for="where">Where is it?</label>
<location-picker id="where" search locate="button" style="height: 400px"></location-picker>
<p>Picked: <output id="out">nothing yet</output></p>
<script>
  document.getElementById('where').addEventListener('change', (e) => {
    document.getElementById('out').textContent = e.detail.value; // "48.85837,2.294481"
  });
</script>

e.detail also has lat, lng, source and, with reverse-geocode, the address.

Why it fits forms

One point, done properly

A real form control

Submits name=lat,lng, separate lat/lng fields or your own hidden inputs. required, reset and back/forward restore behave like an input.

No key, no prompt

OpenStreetMap tiles and Photon search by default. The location permission is asked only when someone taps “Use my location”.

Search or paste anything

Type an address, or paste 48.8584, 2.2945, DMS, a geo: URI or a Google, OpenStreetMap or Apple Maps link.

Keyboard and screen reader

Arrow keys pan, +/− zoom, Enter picks. Controls are 44 px targets and every pick is announced politely.

Any framework

Plain HTML, React 19, Vue 3, Angular, Svelte 5, Solid and Preact through standard events; Laravel, Django and Rails through bound inputs.

Ready for AI agents

llms.txt, an Agent Skill in the npm package, typed errors that name the fix, and opt-in WebMCP tools.

Documentation

Docs, AI files and test results