Using api/geolocation to look for items in a database within a certain radius/or zip/or city



I am trying to figure out what will be the easiest way to attach a location to items that will be an inventory list created by a user. I want to be able to have a search bar where you can input some sort of location, (set by phone) or just an inputted zip code, and return results that display those products within a certain mile range or a matching zip code. I am trying to build a very basic functionality of this but I’m nervous and trying to figure out if this is beyond my scope of time. I’m trying to find the simplest way to implement this functionality to start.

I am using react.js

Any tips would be helpful! I am pretty new to programming




I’ve found googles geolocation api which I feel might be the closest to what i’m looking for. A user inputs a zip code - google translates it into a lat/long. How would I then have a search that returns the items that are in that zip/ either by a distance range or matching zip code or city


Unfortunately I cannot offer any guidance since this is not something I am familiar with. Since Google is returning a geo-location, you should be able to write it to an object with user information and send a json object back to the database.

Check with UPS to see if they have a ZIP code API that may help with your needs, particularly the radius (what is the center point of the ZIP region?).

Measuring distance is another challenge to solve. Wikimapia has a distance measure tool but it has to be used manually by connecting points on the map.

Sorry I cannot help any further.