We have added an interesting extension to our Zipcode API. This is for applications that have their own database of latitude and longitude positions, but need to calculate items within a certain radius of another latitude/longitude.
You can try it here – https://www.zipcodeapi.com/API#radiusSql. Hint – use the Zipcode to Location API to find your specific Lat/Long.
You specify the latitude and longitude of a center point, the distance/radius from this location, the field names used in your database for latitude and longitude, and a precision. The higher the precision, the more detailed the SQL string will be and the more accurate the results will be. A precision of 2 gives decent results for short distances. Larger distances might require a higher precision. To make your database queries efficient, you should create an index on the latitude/longitude pair in your database.
For example, a precision of 1 in the Zipcode API Live Documentation is done with this setup:
will yield an SQL clause like this:
While a precision of 4 would yield:
Obviously, the higher the precision, the more points on your polygon and the closer approximation to ta true circle and radius.