Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong size or aspect ratio in circuit_map and cairo_circuit_map #205

Open
victorlysak opened this issue Aug 11, 2024 · 1 comment
Open

Comments

@victorlysak
Copy link

victorlysak commented Aug 11, 2024

Hi.

I'm using gpx only and I use circuit_map because I need only path without anything else.

While testing the maps, I found that the aspect ratios or maybe sizing in general are wrong for circuit_map and cairo_circuit_map, but are correct for journey_map.

On the pic below, on the right, we have the route in Google Earth Pro imported from the same .gpx file as the gopro-dashboard-overlay uses.

On the left we have:
red line - journey_map - correct size/aspect ration (as in google)
yellow line - cairo_circuit_map - wrong aspect ratio
black line (90 off normal) - circuit_map - also wrong aspect (as you see).

Where in your code shall I look to correct these?

Here is the layout file:

<layout>
   <component type="circuit_map" size="1000" fill="0,0,0" outline_width="0" fill_width="4" />
   <component type="journey_map" size="1000" corner_radius="10" opacity="0.6" />
   <component type="cairo_circuit_map" size="1000" fill="255,255,0" outline="255,0,255" line-width="0.01" loc-size="0.01" rotate="-90" />
</layout>

thank you
git-wrong-aspect

@jaspervries
Copy link

For circuit_map the orientation issue is in /gopro_overlay/widgets/map.py. Specifically the function scale() on line 299.
Here, x and y need to be swapped. Furthermore the 'y' axis on a map (latitude) is from bottom to top, whereas the y-axis in an image is from top to bottom, so this needs to be corrected as well.

This can be fixed as follows:

    def scale(self, point):
        x = int(self.dimensions.x - (((point.lat - self.bbox.min.lat) / self.size.x) * self.dimensions.x) - self.dimensions.x / 20)
        y = int((((point.lon - self.bbox.min.lon) / self.size.y) * self.dimensions.y) + self.dimensions.y / 20)
        return y, x

What this does not fix is the aspect ratio. The gps trace is simply fitted to a square. Fixing that needs a whole bunch more code. One degree difference in latitude is not the same distance as one degree difference in longitude and there's no fixed ratio between them as that depends on where you are in the world. It might be easier to adapt the journey_map widget with the option to not actually have a map but just show the gps trace. I have not attempted that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants