Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jens-andersson-2-wcar/a187a722882b333357ea147b3afbff35 to your computer and use it in GitHub Desktop.
Save jens-andersson-2-wcar/a187a722882b333357ea147b3afbff35 to your computer and use it in GitHub Desktop.
Manually drawing an arrow in code for a Folium map
arrow_tip_x = size_of_arrow_x * math.cos(bearing_rad) + center_lat
arrow_tip_y = size_of_arrow_y * math.sin(bearing_rad) + center_long
arrow_back_left_x = size_of_arrow_x * math.cos(bearing_rad + 2*math.pi * 135.0 / 360.0 ) + center_lat
arrow_back_left_y = size_of_arrow_y * math.sin(bearing_rad + 2*math.pi * 135.0 / 360.0 ) + center_long
arrow_back_x = size_of_arrow_x * 0.2 * math.cos(bearing_rad + 2*math.pi * 180.0 / 360.0 ) + center_lat
arrow_back_y = size_of_arrow_y * 0.2 * math.sin(bearing_rad + 2*math.pi * 180.0 / 360.0 ) + center_long
arrow_back_right_x = size_of_arrow_x * math.cos(bearing_rad + 2*math.pi * 225.0 / 360.0 ) + center_lat
arrow_back_right_y = size_of_arrow_y * math.sin(bearing_rad + 2*math.pi * 225.0 / 360.0 ) + center_long
coordinates = ( (arrow_tip_x, arrow_tip_y), (arrow_back_left_x, arrow_back_left_y), (arrow_back_x, arrow_back_y), (arrow_back_right_x, arrow_back_right_y), (arrow_tip_x, arrow_tip_y) )
geometry_for_row = { "type" : "Polygon", "coordinates": [ coordinates ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment