Skip to content

Using class vs non class scalebar option with the same input parameters produces two different sized scalebars where one must be incorrect #10

@hamilton-dylan

Description

@hamilton-dylan

I found that something gets distorted between scale_bar and ScaleBar. We had to transition from using scale_bar to ScaleBar because we needed to set zorder on the scale bar. All other code is running the same except for that difference. I will drop snippets of the code that we use for each case just to be a little more clear. I have also provided images showing how different the output is for these two cases. I think that the output of scale_bar is the accurate one, but I'm going to send some data to another machine with GIS software to try and confirm that later.

Do you have any idea what could be causing this issue?

scale_bar case -

        scale_bar(
            ax=self.ax,
            location=location,
            style=style,
            text={
                'textcolor': 'white',
                'stroke_color': 'black',
                'stroke_width': 1,
                'fontsize': 12,
            },
            bar={
                'projection': projection,
                'unit': unit,
                'minor_type': 'first',
                'major_div': 2,
                'minor_div': 4,
                'max': maxScalebar
            },
        )

ScaleBar case -

        # we have to initialize the class so that we can call set_zorder on it
        scalebar = ScaleBar(
            location=location,
            style=style,
            text={
                'textcolor': 'white',
                'stroke_color': 'black',
                'stroke_width': 1,
                'fontsize': 12,
            },
            bar={
                'projection': projection,
                'unit': unit,
                'minor_type': 'first',
                'major_div': 2,
                'minor_div': 4,
                'max': maxScalebar
            },
        )

        # we need to set the scalebar zorder to 200 to ensure that it is on top of all layers, including inlays
        scalebar.set_zorder(200)
        self.ax.add_artist(scalebar)

using scale_bar

Image

using the class, ScaleBar

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions