flopp / GpxTrackPoster

Create a visually appealing poster from your GPX tracks
MIT License
411 stars 50 forks source link

Circular rings are scaled wrong if no max distance is provided #98

Closed laufhannes closed 1 year ago

laufhannes commented 2 years ago

I guess this issue exists since 3e297b811532c357d3a79e4480031470fd542384 / #82.

I'm not sure how the unit handling in python works, but in this part max_length is in km if provided as cli argument and in m otherwise. In my example, the division distance / max_length gives 0.00028... kilometer / meter, but it's 0.28... dimensionless when using distance.to_base_units() / max_length.to_base_units().

        min_length = length_range.lower()
        max_length = length_range.upper()
        if self._max_distance:
            max_length = self._max_distance
        assert min_length is not None
        assert max_length is not None
        ring_distance = self._determine_ring_distance(max_length)
        if ring_distance is None:
            return
        distance = ring_distance
        while distance < max_length:
            radius = radius_range.interpolate((distance / max_length).magnitude)

Not sure if there are more lines where this fails (or did I somehow misconfigured my units?).

lowtower commented 2 years ago

@laufhannes: should be fixed with #101