ZIP_CODE ONGITUD ATITUD
00210 71.0132 43.00589
00211 71.0132 43.00589
00212 71.0132 43.00589
00213 71.0132 43.00589
00214 71.0132 43.00589
00215 71.0132 43.00589
...
####
00210,00210
00210,00211
00211,00210
00210,00212
00212,00210
00210,00213
...
##
##
#define EARTH_RADIUS 3956
static inline float deg_to_rad(float deg) {
return (deg * M_PI / 180.0);
}
/* Function to calculate Great Circle distance
between two points. */
static inline float great_circle_distance(float lat1,
float long1,
float lat2,
float long2) {
float delta_long, delta_lat, temp, distance;
/* Find the deltas */
delta_lat = lat2 - lat1;
delta_long = long2 - long1;
/* Find the GC distance */
temp = pow(sin(delta_lat / 2.0),
2) + cos(lat1) * cos(lat2)
* pow(sin(delta_long / 2.0), 2);
distance = EARTH_RADIUS * 2 * atan2(sqrt(temp),
sqrt(1 - temp));
return (distance);
}
##
##
my $distance = sqrt(($x1-$x2)**2+($y1-$y2)**2);