Where

Find nearest

Find nearest matches each place that reaches it to the nearest of your own points: ambulances, branches, depots, stores or field staff, from a CSV you upload or a table in My data. Each place comes out with the name of its nearest point, the distance in kilometres, the point’s position and its other columns, so the next blocks can sort, filter, route or send by it.

In the editor: For each place, finds the nearest of your own points from a CSV you upload, for example the nearest ambulance to each accident or the nearest branch to each new lead, and adds its name and the distance.

Settings

Your points

Pick one

Where your points come from: a CSV file you upload into the block, or a table you keep on the My data page.

  • A CSV I upload
  • A table in My data

Table

A setting

A table from My data with latitude and longitude columns. It is read when the flow runs on the server; the editor’s preview uses example points.

A table from the My data page with latitude and longitude columns.

Needed before the flow can run.

Your points (CSV)

A setting

Choose a CSV file, or press Use example points to try 8 ambulance stations around the Area of interest. The file is read in your browser and kept in the block.

A header row, then one row per point, with latitude and longitude columns (lat and lng). A name column (name, unit, id...) names each point; other columns, such as a phone number, come along too. Up to 2,000 points.

How many to find

Pick one

One match, or the nearest 2, 3 or 5 for each place, closest first.

  • The nearest one
  • The nearest 2
  • The nearest 3
  • The nearest 5

Only within (km)

A number

Leave empty for any distance. With a number, a point further away than this is not a match.

Name of what you match

Text

A short word for what your points are (ambulance, branch, depot, rep). It starts the name of every field the block adds.

Names the fields it adds: "ambulance" gives ambulance_name and ambulance_km. Distances are in a straight line.

Needed before the flow can run.

What comes out

Each item that leaves the block carries these fields, to use in the blocks after it as {{field}}.

For each place, its nearest point

With Name of what you match set to ambulance. A place keeps all its own fields and gets these.

  • ambulance_name: The name of the nearest point, from the CSV’s name column (name, unit, id, branch, store...). Without one: Point 1, Point 2...
  • ambulance_km: The straight-line distance to it, in kilometres, to one decimal.
  • ambulance_lat, ambulance_lng: The position of that point.
  • ambulance_phone: Every other column of your file comes along the same way (up to 8), named after its header.

The nearest 2, 3 or 5

How many to find is more than one. The first match is as above; the others add a name and a distance.

  • ambulance_2_name, ambulance_2_km: The second nearest point and its distance.
  • ambulance_3_name, ambulance_3_km: The third, and so on up to 5.

No point close enough

Only within is set and nothing is that close.

  • ambulance_name, ambulance_km: Left empty, so a Filter after it can keep or drop these places.

How to use it

Healthcare and emergency services

Nearest ambulance to each accident

Traffic incidents finds the accidents and closures; Find nearest adds the nearest ambulance and its distance to each one, and the map joins them with a dashed line.

Retail

What opens near my stores

Find nearest reads your stores from My data and tells each new place which store it is closest to, so each manager gets their own part of the list.

FMCG distribution

Each new shop to its nearest depot

A beverage distributor with six depots wants every new grocery in its cities sent to the depot that will deliver to it.

Before: A coordinator sorted new shops between depots by hand, by looking at a map.

With the flow: Each shop arrives with depot_name and depot_km, ready for the right van.

Banking and payments

Send each new lead to its nearest branch

A bank’s website sends new business leads with an address; each one should go to the branch manager closest to it.

The webhook’s lat and lng are the lead’s position; the branch name and phone go into the CRM with {{branch_name}} and {{branch_phone}}.

Real estate

The three nearest schools to a listing

With How many to find set to The nearest 3, each listing gets school_name, school_2_name and school_3_name with their distances, ready for the brochure.

Field service

Dispatch the closest technician

An elevator maintenance company logs breakdowns in a shared table and wants the technician based nearest to each one, if they are within 15 km.

The message names {{tech_name}} and {{tech_km}}; with Only within set, a breakdown with nobody close has them empty, so the dispatcher sees at once who needs help from further away.

Energy

Competitor stations next to ours

A fuel retailer wants every competitor station within 3 km of one of its own, to watch prices where it matters.

Before: The pricing team kept a list of rivals that went out of date every month.

With the flow: Every Monday they get each nearby rival with the name of the station it competes with and how far away it is.

Delivery apps

Which dark store serves each new restaurant

Sort on dark_store_km puts the restaurants nearest a store first, the easiest to sign and to serve.

Good to know

  • Distances are in a straight line, not by road. On a city scale, the driving distance is usually longer.
  • Up to 2,000 points and 12 columns per file. The CSV needs a header row and latitude and longitude columns (lat and lng, or latitude and longitude, or one column with "lat, lng"); commas, semicolons or tabs between columns, and decimal commas, all work.
  • The name of each point comes from a column called name, title, label, unit, id, code, vehicle, branch, store or site; without one, the first other column.
  • A CSV is kept inside the block, so it runs the same in the editor, in a test and on a schedule. To change the points, upload the file again, or use a table in My data and update it there.
  • Places that reach it without a position go on unchanged. Only the first match carries the point’s position and other columns; the 2nd to 5th carry a name and a distance.
  • Maps draw a dashed line from each place to its nearest point, shown as a square.
  • It is free, and nothing leaves xMap: the matching is done in the flow itself.

Works well with

  • Traffic incidents: Road closures, roadworks and other incidents on online maps right now, with where they are.
  • Map business scan: Finds businesses on online maps live: name, category, rating, address, phone, website and whether it is open.
  • My data: Brings in a table you uploaded or a list you saved on the My data page: your stores, customers, target accounts or sites.
  • Webhook / API: Starts the flow when another system sends a POST request with a JSON body to this flow’s webhook URL.
  • Sort and limit: Puts the items in order, and can keep only the first ones: the 10 best rated, the 20 nearest, the highest fit scores.
  • Filter: Keeps only the items that match a rule.
  • Show on a map: Shows the results as points on a map, with the area of interest.
  • Email: Sends one email per run with all the items, or one email per item.

Templates that use it

Stories with it

Help articles

Guides and terms

Industries that use it

Retail & franchise · FMCG & distribution · Logistics & delivery · Government & cities · Healthcare & pharma · Banking & lending · Telecom · Automotive & mobility · Agriculture & food supply · Fitness, beauty & wellness

Try it

Build a flow with Find nearest on the home page, no account needed, or book a call. Try it live