## User Tag List

Does anyone have a ZipCode Radius based on Lat and Long algorithm they can share?

The following i have is pretty complex I want to have to simplified and it shows all zipcodes in the radius but the one entered lol which is kind of silly.

Code:
`SELECT 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2)), SQRT(1 - POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2))) AS "miles", z.* FROM dir_gen z WHERE zip_code <> '33431' AND lat BETWEEN ROUND(26.371027 - (25 / 69.172), 4) AND ROUND(26.371027 + (25 / 69.172), 4) AND lon BETWEEN ROUND(-80.088766 - ABS(25 / COS(26.371027) * 69.172)) AND ROUND(-80.088766 + ABS(25 / COS(26.371027) * 69.172)) AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2)), SQRT(1 - POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2))) <= 5 AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2)), SQRT(1 - POW(SIN((RADIANS(26.371027) - RADIANS(z.lat)) / 2), 2) + COS(RADIANS(z.lat)) * COS(RADIANS(26.371027)) * POW(SIN((RADIANS(-80.088766) - RADIANS(z.lon)) / 2), 2))) >= 0 ORDER BY 1 ASC`

2. Which flavor of database server? Some have native GIS capabilities that can handle these sorts of tasks in a more succint manner.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•