Can I sort a data query by location?

Hi there,
This might be a bit of an in depth problem, but I have a page intended to search for my business’s retailers by location and I would like to have the results display nearby locations.

The page consists of an Input, Button, Repeater and a Dataset. The repeater just displays matching data to what is searched such as the retailer’s City.

Would anyone know of a way I could sort the data into geographic locations and have the repeater display the nearest locations first? It sounds like a stretch to me but I thought I’d ask anyway.

If not, is there a way I can have the results ordered into similar area codes, as in the first few numbers are matching?


Hi Kurtis,

Check out Google Distance Matrix API.

Make sure to install the @google/maps NPM module for easier coding.