🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Map Picker Premium Add-on Setup Guide

Updated 11 min read Gravity Forms Integrations A–Z
On this page
  1. Video walkthrough
  2. What You Get
  3. Requirements
  4. Install and Activate
  5. Field Settings
  6. For Visitors
  7. Search and Address Lookups: How They Follow the Usage Policy
  8. Map Tiles
  9. What Is Saved
  10. Merge Tags
  11. Conditional Logic
  12. Address Field Mapping
  13. Works With the Rest of Your Form
  14. Accessibility
  15. Privacy
  16. Developer Hooks
  17. Troubleshooting
  18. Frequently Asked Questions
  19. Do I need an API key?
  20. Can I use my own map style?
  21. Is it allowed to use the public OpenStreetMap servers?
  22. Does it send anything from my server?
  23. Can I switch off the address search?
  24. Let visitors show you where

Video walkthrough

Gravity Forms Map Picker: Drop a Pin, Search an Address, Save Coordinates
Watch: add an OpenStreetMap map picker to Gravity Forms, no API key needed. Watch on YouTube

Map Picker adds a Map (OpenStreetMap) field to Gravity Forms. The visitor sees a map, drops or drags a pin, searches for an address or uses their own location, and the form saves the latitude, the longitude and the address. The map is drawn with Leaflet, which is bundled with the add-on, from OpenStreetMap data. There is no Google account, no API key and no billing. This guide covers setup, every setting, how search and address lookups behave under the OpenStreetMap usage policies, merge tags, conditional logic, accessibility and developer hooks.

A Report a problem form on the site: the Problem location field shows a search box, the Use my location and Clear pin buttons, an OpenStreetMap map with a blue pin, and underneath the latitude, longitude and address boxes filled with the position of the pin and the address that was found
The map field on a form: search box, location button, a draggable pin, and the latitude, longitude and address that will be saved.

What You Get

  • A map field for any form, with a pin that visitors drop by clicking, drag with the mouse or a finger, or move with the keyboard.
  • Address search, a Use my location button and an optional lookup that fills in the address from the pin.
  • Latitude, longitude and address saved as three inputs of the field, ready for merge tags, conditional logic and notifications.
  • A small static map and a link to openstreetmap.org on the entry detail.
  • Optional: fill a Gravity Forms Address field from the pin.
  • Your choice of tile server: the standard OpenStreetMap tiles, or any tile URL template with its credit.
  • Works with AJAX forms, multi-page forms, conditional logic, Save and Continue and several maps on one page.

Requirements

  • WordPress 6.5 or newer, PHP 7.4 or newer, Gravity Forms 2.9 or newer (tested with 2.9 and 3.1).
  • A visitor browser with JavaScript. Without it the latitude and longitude boxes still work.
  • HTTPS on your site for the Use my location button, because browsers only share a location on secure pages.

Install and Activate

  1. Upload the add-on in Plugins → Add New → Upload Plugin and activate it.
  2. Open Forms → Settings → Map Picker, enter your license key and activate it.
  3. On the same page enter a contact e-mail for the address service and read the notes on tiles and address lookups below.
  4. In the form editor, add Map (OpenStreetMap) from Advanced Fields.

Field Settings

Select the map field in the form editor. Besides the usual label, description, required, CSS class and conditional logic settings you will find:

Setting What it does
Map start position Latitude and longitude of the centre, the zoom (1 shows the world, 12 a city, 17 a street) and the height in pixels. Empty values use the site defaults.
Tile server Site default, OpenStreetMap standard, or My own tile server with a URL template and the attribution.
Show a Use my location button The browser asks the visitor before it shares the position.
Show an address search box A search box with a Search button. Results appear as a short list.
Fill in the address from the pin After the pin stops moving, the address of the spot is looked up and written into the address box.
Show the latitude, longitude and address boxes On by default. When hidden they are still submitted; keep them if you want a keyboard and no-script fallback.
Also fill this Address field Choose a Gravity Forms Address field of the same form. Street, city, state, ZIP and country are filled in when a place is picked.

Required fields

When the field is required, the visitor must drop a pin or enter both coordinates. A single coordinate, or a number outside the range (latitude -90 to 90, longitude -180 to 180), is refused with a clear message. The address is optional.

For Visitors

  • Click the map, or focus it with Tab and press Enter, to drop a pin.
  • Drag the pin, or focus it and use the arrow keys. Shift moves it further, Alt moves it one pixel, Delete removes it.
  • Type a place in the search box and press Enter or the Search button, then choose one of the results.
  • Press Use my location and allow the browser to share it.
  • Type or correct the latitude, longitude and address by hand at any time. A comma is accepted as the decimal mark.
  • Clear pin removes the position.

Search and Address Lookups: How They Follow the Usage Policy

Search and the address lookup use Nominatim, the address service of OpenStreetMap. The visitor’s browser sends each request, so the visitor’s IP address reaches that service. The public Nominatim server is run by volunteers and has a usage policy. The add-on is built to follow it:

Rule of the policy What the add-on does
At most one request per second All maps on a page share one queue. Two requests are never sent less than 1.1 seconds apart.
No search while typing Search runs only when the visitor presses Search or Enter, and needs at least three characters. Pressing it twice quickly sends one request.
No repeated lookups while a pin moves The address is looked up once, about one second after the pin stops, not while it is dragged or moved by the arrow keys.
Identify your site The browser sends a referrer that names your site, and the add-on adds the contact e-mail you enter in the settings.
Light use only A page stops looking up addresses after 60 requests. The settings explain that busy sites need their own server.

In Forms → Settings → Map Picker you can switch search and lookups off (no request goes to any address service, and visitors type the address themselves), set a custom endpoint (the base address of your own Nominatim server or of a compatible service; the add-on adds /search and /reverse), limit the search to some countries, and enter the contact e-mail. Results come back in the language of your site.

Busy websites

The public Nominatim server and the public tile server are not meant for heavy traffic. If your forms are seen by many people, run your own Nominatim server or use a commercial geocoder with a compatible interface, and use your own or a commercial tile server. The add-on needs only a URL for each.

Map Tiles

The default is the standard OpenStreetMap tile server with the credit OpenStreetMap contributors shown on the map. Its policy allows light use only, forbids bulk downloading and requires the credit. For a busy site, choose My own tile server in the field, or set a site default in the settings, and enter a tile URL template that contains {z}, {x} and {y} (and optionally {s} and {r}), with the attribution your provider asks for. Links are allowed in the attribution; scripts and other markup are removed. The add-on checks the template and falls back to the standard tiles when it is not valid.

If the tiles cannot be loaded, the visitor sees a short message and can still type the coordinates and submit the form.

What Is Saved

The field stores three values with the entry: input 1 latitude, input 2 longitude and input 3 address. Coordinates are saved with up to six decimals (about 10 centimetres), the address as one line of plain text up to 500 characters. A position is saved only when both coordinates are valid. A map hidden by conditional logic saves nothing.

The Gravity Forms entry detail of a Report a problem entry showing the address and the coordinates of the pin, a small static map with the marker and the link Open in OpenStreetMap
On the entry: the address, the coordinates, a small map and a link to openstreetmap.org.

On the entry detail the add-on shows the address with the coordinates, a small static map and the link Open in OpenStreetMap. The entry list shows the address, or the coordinates when there is none. In e-mails, {all_fields} shows the text and the link.

Merge Tags

Use these in notifications, confirmations and other places that accept merge tags. Replace the label with the label of your field and 5 with its ID. The merge tag drop-down in the editor lists them under the field.

{Problem location:5.lat}      latitude, for example 47.6205
{Problem location:5.lng}      longitude, for example -122.3493
{Problem location:5.address}  the address text
{Problem location:5.coords}   47.6205, -122.3493
{Problem location:5.link}     link to the point on openstreetmap.org
{Problem location:5}          the address, with the coordinates in parentheses

The usual Gravity Forms form works too: {Problem location:5.1} is the latitude and {Problem location:5.2} the longitude. A link in a notification could be built as an anchor with the link tag as the address and the text View on the map.

Conditional Logic

  • Show or hide other fields with the map field itself: is empty and is not empty. The map counts as filled when a position is set, that is when both latitude and longitude have a value.
  • Use the latitude input (the field ID with .1) when you want to react only to a real position.
  • The map can itself be shown or hidden by conditional logic. When it appears it resizes and loads its tiles.

Address Field Mapping

Choose an Address field in the setting Also fill this Address field. When the visitor picks a place, the street (house number first for English sites), city, state or region, ZIP or postal code and country are filled in. Select lists such as the country are matched by name, so they work when the name of the country in the list is the name returned by the service. The visitor can still edit every box.

A Request a bench form with a map and a Street address field: after the pin was dropped the street, city, state, ZIP code and country boxes of the Address field were filled in automatically
The pin also fills a Gravity Forms Address field: street, city, state, ZIP and country.

Works With the Rest of Your Form

Situation What happens
AJAX forms The map starts again after each validation message and keeps the pin and the typed address. Each map starts once.
Multi-page forms A map on a later page has the right size and tiles when the page shows. The pin survives Next and Previous.
Conditional logic A hidden map starts small and resizes when it appears.
Save and Continue The saved pin comes back on the resume link with the map centred on it.
Several maps Each map has its own centre, zoom, height and pin. A form can have two maps, and a page several forms.
Phones The controls stack, buttons are touch-sized and the map takes a tap. One finger drags the map, so scroll the page with the margins.

Accessibility

  • The map region has a label, can be focused with Tab, and Enter drops a pin at the centre.
  • The pin is focusable with a visible outline and moves with the arrow keys; changes are announced in a polite status line.
  • The latitude, longitude and address boxes are real labelled inputs, so the whole field can be completed without the map.
  • Search results are buttons in a list, Escape closes the list.
  • Messages for blocked locations, missing results and lookup problems are plain text.

Privacy

The add-on does not call any service from your server. The visitor’s browser loads map pictures from the tile server (which receives the IP address and the area shown) and, when search or the lookup is on, sends the search text or the position of the pin to the address service. The location button only runs after the visitor allows it in the browser. The chosen position and address are saved with the entry, so they are personal data you hold: they are handled by the Gravity Forms export and erase tools like any other field. The add-on adds suggested wording to Settings → Privacy → Policy Guide.

Developer Hooks

gfxosm_tiles changes the tile server of a map, gfxosm_geocoder changes the address service settings (enabled, endpoint, email, countries, lang) and gfxosm_field_config changes what is printed for one map, such as the start position and zoom.

// Use a commercial tile provider for one form and show its credit.
add_filter( 'gfxosm_tiles', function ( $tiles, $field ) {
    if ( 12 === (int) $field->formId ) {
        $tiles['url']         = 'https://tiles.mapprovider.invalid/{z}/{x}/{y}.png';
        $tiles['attribution'] = 'Map data by <a href="https://mapprovider.invalid/credits">Map Provider</a>';
        $tiles['maxZoom']     = 20;
    }
    return $tiles;
}, 10, 2 );

// Point address search and lookup at your own server.
add_filter( 'gfxosm_geocoder', function ( $geo ) {
    $geo['endpoint'] = 'https://geo.mycompany.invalid';
    return $geo;
} );

// Start every map in one form on the same city, one zoom level closer.
add_filter( 'gfxosm_field_config', function ( $cfg, $field, $form ) {
    if ( 12 === (int) $form['id'] ) {
        $cfg['lat']  = 52.5200;
        $cfg['lng']  = 13.4050;
        $cfg['zoom'] = 13;
    }
    return $cfg;
}, 10, 3 );

If you show a hidden container yourself, for example a tab or an accordion, ask the maps to resize:

// After you show a hidden container yourself (a tab or an accordion), ask the maps to resize.
window.gfxosmRefresh();

Leaflet 1.9.4 is bundled in the add-on folder with its BSD 2-Clause licence file and is loaded from your site. No file comes from a CDN.

Troubleshooting

Problem Check
The map is grey or has no pictures The tile server could not be reached, or your tile URL is not valid. Check the URL template and that your site policy (CSP) allows images from the tile host.
The map is half drawn after switching a tab Call window.gfxosmRefresh() when you show the container. Gravity Forms pages and conditional logic do it for you.
Search finds nothing Nominatim needs a place name or an address. Add the town, or remove a country filter in the settings.
The address is not filled in Check that the lookup is on in the field and in the settings, and that the page has not reached the lookup limit.
The Use my location button does nothing The browser blocked the location or the page is not on HTTPS.
The field is missing in the editor The license key is not active. Forms already using the map keep working.

Frequently Asked Questions

Do I need an API key?

No. The map comes from OpenStreetMap data drawn with Leaflet, and address search uses the free Nominatim service or your own.

Can I use my own map style?

Yes. Enter any tile URL template and the attribution for it, for the whole site or one field.

Is it allowed to use the public OpenStreetMap servers?

For light use, yes, under their policies, which the add-on follows. For a busy site use your own or a commercial tile server and Nominatim server.

Does it send anything from my server?

No. Everything goes from the visitor’s browser. The add-on makes no request of its own.

Yes, in Forms → Settings → Map Picker. Visitors can still drop a pin and type the address.

Let visitors show you where

A map field with a draggable pin, address search and no API key, built on OpenStreetMap and Leaflet.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr