Exemplo n.º 1
0
 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]
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
def test_rhumb_bearing():
    start = Feature(geometry=Point((-75.343, 39.984)))
    end = Feature(geometry=Point((-75.534, 39.123)))
    rhb = rhumb_bearing(start, end)
    assert round(rhb, 4) == -170.2942