Lorixen.
EN

Geocoding addresses in your app: accuracy, caching, costs

Short answer: Geocoding turns an address into map coordinates, which your app needs for delivery zones, "nearest location" search, route planning or putting customers on a map. Pick a provider whose terms fit how you'll use the results, geocode once when an address is saved rather than on every page view, store the accuracy level alongside the coordinates, and flag partial or low-precision matches for a person to check. Read the caching and display rules carefully, because they differ a lot between providers.

What geocoding is used for in business apps

Common jobs:

  • Checking whether an address falls inside a delivery or service area.
  • Finding the nearest store, depot or technician.
  • Estimating travel time or distance for quotes.
  • Showing jobs, customers or properties on a map.
  • Planning routes for drivers or field staff.

Each relies on the coordinates being right. A geocode that lands on the wrong street, or the centre of a ZIP code instead of the house, quietly produces wrong prices, missed deliveries and confused drivers.

Choosing a provider: terms matter as much as accuracy

Several services offer geocoding, from large commercial map platforms to services built on open data. Beyond price and accuracy, check the terms on three things.

Storage and caching. Some providers restrict how long you can keep results. Google's Geocoding API policies say that pre-fetching, caching or storing content is generally restricted, with the exception of place IDs, which can be stored indefinitely, and point to its platform terms for details. That affects designs that save coordinates in your database.

Display. Google's policies also say Geocoding API results shown on a map must be displayed on a Google map, with attribution. If you plan to use another map library, check whether your geocoder allows it.

Volume and bulk use. The public Nominatim service run by the OpenStreetMap Foundation sets an absolute maximum of one request per second, requires an identifying User-Agent or Referer, says results must be cached on your side and discourages bulk geocoding. For regular or large-volume work, its policy points you to alternatives such as commercial providers or running your own instance.

Read the current terms for whichever provider you choose; these rules change.

Geocode at save time, not at view time

The most common inefficiency is calling the geocoding service every time a page loads. Instead:

  1. Geocode when an address is created or edited.
  2. Store the result, within what your provider's terms permit, along with when it was geocoded.
  3. Re-geocode only when the address changes, or when the provider's rules require refreshing.

This makes pages faster, keeps costs predictable and avoids hitting rate limits.

If your provider doesn't allow storing coordinates, store whatever identifier it permits, such as a place ID, and fetch details when needed.

Store the accuracy, not just the point

Geocoders tell you how confident they are. Google's request documentation, for example, returns a location_type such as ROOFTOP, the most precise level, and a partial_match flag meaning the geocoder couldn't match the full address and matched only part of it. Other providers have similar fields under different names.

Save these with the coordinates. Then you can:

  • Accept rooftop or street-level results automatically.
  • Flag partial matches and area-level results, like a city centre or postal-code centroid, for review.
  • Avoid calculating precise delivery charges from a vague point.

Help the geocoder get it right

Bad input produces bad output. Improve results by:

  • Using separate address fields, or an address autocomplete, rather than one free-text box.
  • Passing the country, and any region or postal code, explicitly.
  • Using the provider's component filters where available, for example restricting results to the United States.
  • Normalising obvious problems, like extra spaces, before sending.

For deliveries to apartments, business parks or rural addresses, consider letting customers drop a pin on a map to confirm the exact spot.

Handle failures and ambiguous results

Not every address geocodes cleanly. Plan for:

  • No result: keep the address, mark it as not geocoded, and ask the customer or staff to check.
  • Several results: show the options and let a person choose, rather than taking the first.
  • Service errors or timeouts: retry later in a background job, and don't block the customer's checkout on a geocode if you can avoid it.

Keep an eye on costs

Commercial geocoders usually charge per request above a free allowance. Geocoding at save time already cuts most waste, but also watch for loops that re-geocode the same addresses during imports, test scripts pointed at the live key, and keys that leak into public code. Restrict your API key to your servers or domains, set a budget alert in the provider's console, and check current pricing before large imports.

Keep personal data in mind

Coordinates of a customer's home are personal data. Store them with the same care as the address, don't expose them in public APIs or page source, and only send addresses to the geocoding provider when needed.

A worked example

Consider a hypothetical Atlanta lawn-care company whose quote tool calculated travel charges by geocoding the customer's address on every page view. Costs rose, some quotes used a ZIP-code centroid instead of the house, and rural customers were overcharged. The developer moved geocoding to save time in a background job, stored the provider's accuracy fields within its terms, flagged anything below street level for staff review and added a map pin for customers to confirm their property. Quotes became consistent, and staff reviewed only a handful of addresses a week.

FAQ

Is geocoding the same as address validation?

No. Validation checks that an address is deliverable and correctly formatted; geocoding turns it into coordinates. They're often used together.

Can I geocode in the browser?

Some providers offer browser libraries, but server-side geocoding gives you more control over keys, caching and rate limits.

How accurate is geocoding?

It varies by provider, country and address type. Store the accuracy level and test with your own customers' addresses.

What about reverse geocoding?

That's turning coordinates into an address, useful for "use my location". The same terms and accuracy questions apply.

If your app's maps, delivery zones or distance quotes aren't lining up, ask us to review how you geocode addresses.

Sources

WhatsAppBook a call