Skip to content

Commit

Permalink
fix: division bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 committed Jan 26, 2021
1 parent fb2d0ee commit f1229c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/gpxtrackposter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def project(
min_y = lat2y(bbox.lat_lo().degrees)
max_y = lat2y(bbox.lat_hi().degrees)
d_y = abs(max_y - min_y)

# the distance maybe zero
if d_x == 0 or d_y == 0:
return []
scale = size.x / d_x if size.x / size.y <= d_x / d_y else size.y / d_y
offset = offset + 0.5 * (size - scale * XY(d_x, -d_y)) - scale * XY(min_x, min_y)
lines = []
Expand Down

1 comment on commit f1229c0

@vercel
Copy link

@vercel vercel bot commented on f1229c0 Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.