Skip to content

Commit

Permalink
feat: reduce grid svg file size
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-29 committed Oct 28, 2023
1 parent 3f073b7 commit db30863
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion run_page/gpxtrackposter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def project(
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 = []
for latlngline in latlnglines:
# If len > $zoom_threshold, choose 1 point out of every $step to reduce size of the SVG file
zoom_threshold = 400
step = int(len(latlnglines) / zoom_threshold) + 1
for i in range(0, len(latlnglines), step):
latlngline = latlnglines[i]
line = []
for latlng in latlngline:
if bbox.contains(latlng):
Expand Down

0 comments on commit db30863

Please sign in to comment.