Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve certain range within a specific criteria

Status
Not open for further replies.

belea

Aerospace
Nov 26, 2002
4
If I have a database of users with their addresses. How do I find people within a certain radius of a zip code or city? Let's say I want to find all people within 15 miles radius of zip code 60659. Can someone help? Thanks a bunch
 
Replies continue below

Recommended for you

Easy way: Subscribe to GIS provider.

Hard way:

You need to condense each zip code to a point and get the latitude and longitude for that point. I would imagine that the US Postal Service uses the Post Office responsible for each zip code for this purpose.

For each address in your database, calculate the difference (in degrees)for latitude and longitude between the point value for that addresses zip code and the "center" of you search.

Convert the degrees to distance.

Apply Pathagorean therom to get radius.

If the radius is less than 15 miles you've got one.

This will get you people that live in a zip code with a center point less than 15 miles from the center point of the target. Not exactly what you asked for, but reasonably close.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor