+
+ /* Figure out which point in the tile to
+ * measure to the site That's one of the edges
+ * or the site location depend on where the
+ * site is in relation to the tile
+ */
+
+ double check_lon;
+
+ if (west_of(site.longitude, upper_left.lon))
+ check_lon = upper_left.lon;
+ else if (west_of(lower_right.lon, site.longitude))
+ check_lon = lower_right.lon;
+ else
+ check_lon = site.longitude;
+
+ double check_lat;
+
+ if (site.latitude < lower_right.lat)
+ check_lat = lower_right.lat;
+ else if (upper_left.lat < site.latitude)
+ check_lat = upper_left.lat;
+ else
+ check_lat = site.latitude;
+