package cloud.hmml.mmw;

public class LivedoorArea {
    static String findIdByLocation(double lat, double lng) {
        int i;
        String id = null;
        double min_dist = 40000; // Limit to 200km
        double c_dist;
        for (i = 0; i < LivedoorAreaData.COUNT; i++) {
            c_dist = Math.pow((LivedoorAreaData.LATS[i]- lat) / 0.0111, 2) + Math.pow((LivedoorAreaData.LNGS[i] - lng) / 0.0091, 2);
            if (c_dist < min_dist) {
                min_dist = c_dist;
                id =  LivedoorAreaData.IDS[i];
            }
        }
        return id;
    }
}
