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

Gravity Forms Nearest Location Premium Add-on Setup Guide

Updated 7 min read Gravity Forms Fields & Inputs
On this page
  1. Video walkthrough
  2. Step 1: Install and Activate Your License
  3. Step 2: Choose the Geocoding Service
  4. Step 3: Add Your Locations
  5. Step 4: Add the Nearest Location Field
  6. Step 5: Conditional Logic and Notifications
  7. Step 6: The Entry Map
  8. Troubleshooting & FAQ
  9. The “Use my current location” button says the location was blocked.
  10. An address is not found.
  11. The form says the map service is busy.
  12. Is the distance a driving distance?
  13. Which data leaves my site?
  14. Can I use several Nearest Location fields?

Video walkthrough

Gravity Forms Nearest Location: Closest Store + Distance from Any Address
Watch: find the nearest café to any address, show the distance and send the request to that location. Watch on YouTube

The Gravity Forms Nearest Location Premium Add-on adds a Nearest Location field to Gravity Forms. The visitor can share their position with one click (the browser asks them first), or the add-on looks up the address they type in the form’s Address field. The position is compared with your list of locations, and the nearest location and its distance are shown on the form, saved with the entry, usable in conditional logic and available as merge tags, so a notification can go straight to the right branch.

This guide covers installation, the geocoding service, your locations, the field, conditional logic and notifications, the entry map and troubleshooting.

System Requirements & Prerequisites

  • WordPress: Version 6.5 or higher
  • PHP: Version 7.4 or higher
  • Gravity Forms: Version 2.9 or higher, any licence
  • Site address: HTTPS, because browsers share a location only with secure pages
  • GravityExtra license: The add-on installed, activated and licensed with an active GravityExtra license key

Step 1: Install and Activate Your License

  1. In WordPress go to Plugins → Add New → Upload Plugin, upload the add-on ZIP file and click Activate.
  2. Go to Forms → Settings → Nearest Location, enter your key in the Gravity Extra License section and click Activate License.
  3. The page then shows the Address lookup (geocoding) and Distance, privacy and map sections, and the Forms → Nearest Location menu appears.

Step 2: Choose the Geocoding Service

Geocoding turns an address into latitude and longitude (and a shared position into a street address). Results are cached on your site for 30 days, so the same address is never looked up twice in that time.

  • OpenStreetMap Nominatim – free and without a key. The public server allows at most one lookup per second; the add-on waits its turn for the whole site and identifies your site in every request, as the Nominatim usage policy asks. Enter a Contact e-mail for Nominatim so OpenStreetMap can reach you instead of blocking your site. For many lookups a day, enter your own or a commercial Nominatim server under Own Nominatim server.
  • Google Geocoding API – uses your own Google Cloud key with the Geocoding API enabled. The key is used only by your server and is never sent to your forms or visitors. Google bills the lookups to your account.
  • Off – only positions shared by the browser are used; Address fields are not looked up.
  • Look up the street address of shared locations – saves a readable address for positions shared by the browser.

Under Distance, privacy and map, choose kilometres or miles, the Saved coordinate precision (exact, or rounded to about 10 m, 100 m or 1 km for privacy – the nearest location is always found with the exact position) and, if you like, another map tile server and its attribution.

Step 3: Add Your Locations

Open Forms → Nearest Location. The page shows your locations on a map, a form to add one and the list.

  • Name and Address – leave latitude and longitude empty and the add-on looks them up from the address. If an address cannot be found, enter the coordinates yourself (right-click the place in OpenStreetMap and choose “Show address” to copy them).
  • E-mail and Phone – used by the merge tags, for example to send each request to its branch. They are never shown on the form.
  • Group – optional, for example “Clinics” or “Depots”. A form can compare only the locations of one group. A location can be in several groups separated by commas.
  • Active – untick it to keep a location in the list without using it.
  • Add many locations – paste one location per line: Name; Address; Latitude; Longitude; E-mail; Phone; Group. Tabs or | also work. Up to 50 addresses are looked up per run.
Locations page of the add-on: a map with six locations around Chicago, the Add a location form with name, address, latitude, longitude, e-mail, phone and group, and the list of locations with coordinates and contact details
The Locations page: your branches on a map, the add form and the list with coordinates, contacts and groups.

Step 4: Add the Nearest Location Field

Open the form in the editor and add Nearest Location from Advanced Fields, usually below the Address field. Its settings:

  • Address field to look up – the Address field whose address is geocoded when the visitor does not share a location. The first Address field of the form is chosen for you.
  • Show a “Use my current location” button – nothing is asked before the visitor clicks it; then the browser asks for permission. You can change the Button text and the Privacy note under the button.
  • Show the nearest location and distance on the form – a card with the name, distance and address of the nearest location. Without it, the values are still saved.
  • Locations to compare – all locations or one group.
  • Service radius – optional. Farther away, the visitor sees the Message outside the radius; tick Do not accept requests outside the radius to refuse the request.
  • Required – the visitor must share a location or enter an address that can be found.

While the visitor types the address, it is looked up when they leave the field, and the nearest location appears. When the form is sent, the add-on looks the position up again on your server and recalculates the nearest location and the distance, so values changed in the browser are ignored.

Gravity Forms booking form with the Nearest Location field: a Use my current location button, a privacy note, Location shared with the accuracy, and the nearest clinic Lincoln Park Clinic 1.2 km away with its address
The form after the visitor shared their location: the nearest clinic and the distance appear right away.

Step 5: Conditional Logic and Notifications

The field has four inputs that conditional logic can use: Nearest location, Distance, Latitude and Longitude. For example, show a parking note when “Nearest location” is “Evanston Clinic”, or ask about a home visit when “Distance” is greater than 15. For the location name the rule offers your location names in a drop-down.

Notification conditions can also use the entry meta Nearest location, Distance to nearest location, Location source, latitude and longitude. To send a request to its branch, put {nearest_location_email} in the notification’s Send To Email.

Merge tag Value
{geo_lat} Latitude, for example 41.878876
{geo_lng} Longitude, for example -87.635915
{geo_map_link} Link to the position on openstreetmap.org
{geo_address} The address that was found (or the address of a shared location)
{geo_source} “Shared by the browser” or “Address field”
{nearest_location} Name of the nearest location
{nearest_distance} Distance, for example 2.4 km
{nearest_location_email} E-mail of the nearest location (use it in Send To)
{nearest_location_address} Address of the nearest location
{nearest_location_phone} Phone of the nearest location

The field merge tag (for example {Your nearest clinic:5}) gives “Lincoln Park Clinic (1.2 km)”; :5.1 to :5.4 give one input.

Step 6: The Entry Map

  • Each entry with a position gets a Location box: an OpenStreetMap map with the entry position and the nearest location joined by a line, the nearest location with its distance and address, the saved address, the coordinates, the source and, for shared positions, the accuracy.
  • Open in OpenStreetMap and Directions open the position and a route on openstreetmap.org.
  • Nearest location, distance, address, source, latitude and longitude can be added as columns in the entry list and used in entry filters.
  • The map uses Leaflet, which is included in the add-on, and OpenStreetMap tiles. No API key is needed.
Location box on a Gravity Forms entry: OpenStreetMap map with the entry location and the nearest clinic joined by a dashed line, the nearest location with distance and address, the street address, coordinates, source and accuracy, and Open in OpenStreetMap and Directions buttons
Every entry gets a map with the visitor and the nearest location, plus the saved address, coordinates and accuracy.

Troubleshooting & FAQ

The “Use my current location” button says the location was blocked.

The visitor refused, or blocked locations for the site earlier in the browser settings. They can type their address instead. Browsers share a location only on HTTPS pages.

An address is not found.

Check the spelling and the ZIP code. Nominatim works best with street, city and ZIP; very new streets may be missing in OpenStreetMap. Switch to Google Geocoding with your own key if many addresses fail.

The form says the map service is busy.

The public Nominatim server allows one lookup per second for your site. Results are cached, so this only happens at busy moments. For many lookups, use your own Nominatim server or Google.

Is the distance a driving distance?

No. It is the straight-line distance, which is the right measure to choose the closest location. Use the Directions link on the entry for the route.

Which data leaves my site?

The address or position is sent to the geocoding service you chose, and the entry map loads map tiles from OpenStreetMap or your tile server. Mention this in your privacy policy. Only the license check and update check contact gravityextra.com.

Can I use several Nearest Location fields?

Yes. Each field has its own settings and inputs. The entry meta, merge tags and the entry map use the first field that found a position.

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