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

Returning None from filter_layer in translation throws error #31

Closed
kinimesi opened this issue Apr 14, 2023 · 1 comment
Closed

Returning None from filter_layer in translation throws error #31

kinimesi opened this issue Apr 14, 2023 · 1 comment

Comments

@kinimesi
Copy link

According to the docs, filter_layer can return a layer or None. However, returning None throws the following error:

ogr2osm/ogr2osm/ogr_datasource.py", line 101, in __get_source_reprojection_func
    layer_spatial_ref = layer.GetSpatialRef()
AttributeError: 'NoneType' object has no attribute 'GetSpatialRef'

Looking into the original library, seems like there was a check for None, but it got lost during refactoring.

@roelderickx
Copy link
Owner

roelderickx commented Apr 15, 2023

Good catch!
The original check is still in the refactored code:

if layer:

But that code is only executed after we tried to fetch the projection, which is of course impossible for a None layer.
I'll merge the pull request.

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