def _callback_coord_each( coord, coord_index, feature_index, multi_feature_index, geometry_index ): nonlocal pivot, angle initial_angle = rhumb_bearing(GeoPoint(pivot), GeoPoint(coord)) final_angle = initial_angle + angle distance = rhumb_distance(GeoPoint(pivot), GeoPoint(coord)) new_coords = get_coord(rhumb_destination(GeoPoint(pivot), distance, final_angle)) coord[0] = new_coords[0] coord[1] = new_coords[1]
def _callback_coord_each( coord, coord_index, feature_index, multi_feature_index, geometry_index ): nonlocal factor, origin original_distance = rhumb_distance(GeoPoint(origin), GeoPoint(coord)) bearing = rhumb_bearing(GeoPoint(origin), GeoPoint(coord)) new_distance = original_distance * factor new_coord = get_coord(rhumb_destination(GeoPoint(origin), new_distance, bearing)) coord[0] = new_coord[0] coord[1] = new_coord[1] if len(coord) == 3: coord[2] = coord[2] * factor
def test_rhumb_distnace(): start = Feature(geometry=Point((-75.343, 39.984))) end = Feature(geometry=Point((-75.534, 39.123))) dis = rhumb_distance(start, end, "mi") assert round(dis, 4) == 60.3533