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

[Maybe Bug] Not handling "--boundary-box" when "--input" is specified in tile generation mode. #99

Closed
edward17829991 opened this issue Dec 20, 2021 · 3 comments
Labels
bug Something that went wrong

Comments

@edward17829991
Copy link

edward17829991 commented Dec 20, 2021

osm_data.parse_osm_file(Path(options.input_file_name))

When I tried map-machine tile --input test.osm.xml --boundary-box 121.462,24.963,121.667,25.198 --zoom 16
The program complains about AttributeError: 'NoneType' object has no attribute 'get_left_top'

I looked at the source code a bit, noticed that when in "--input"-specified branch, --boundary-box was never been ingested.
The original code set the view_box only by the bound elements in the input XML files.
But as stated in Generate a set of tiles, the --boundary-box argument should override other sources.

I've temporary fixed the problem by setting the view_box from arguments prior then XMLs.

        boundary_box: Optional[BoundaryBox] = BoundaryBox.from_text(
            options.boundary_box
        )
        osm_data.view_box = boundary_box or osm_data.view_box

Edward Chen

@enzet enzet added the bug Something that went wrong label Dec 20, 2021
@enzet
Copy link
Owner

enzet commented Dec 20, 2021

Hello Edward! Thank you for reporting this!

You're right, in input mode, it deliberately ignores --boundary-box option, tries to read <bounds> tag from input XML, and obviously may fail. 🥲

Your fix seems quite reasonable. Do you want to make a pull request? Or I can fix it.

@edward17829991
Copy link
Author

Hi @enzet ,

Thanks for your fast response!
Since it's a quick fix, you can fix it directly.

Overall, this is a great project and tool, it's quite flexible and hustle-free with custom xml files.
I just stumbled upon this few days ago on the open-street-map wiki about rendering, and I got great result quite easily.
Thank you and the community.

Edward Chen

@enzet
Copy link
Owner

enzet commented Dec 20, 2021

@edward17829991

Yeah, and I definitely should review usage of other options as well. In some cases they are conflicting.

Thank you for your interest! It's nice to hear the project is useful. Please, feel free to tell me if you have any suggestions on how to improve it.

@enzet enzet mentioned this issue Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that went wrong
Projects
None yet
Development

No branches or pull requests

2 participants