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

object:as_multipolygon() does not take object.members into account. #2098

Open
docentYT opened this issue Oct 19, 2023 · 2 comments
Open

object:as_multipolygon() does not take object.members into account. #2098

docentYT opened this issue Oct 19, 2023 · 2 comments

Comments

@docentYT
Copy link

The following code removes members from object.members that have a role other than 'inner' or 'outer'.

function osm2pgsql.process_relation(object)
    if object.tags.type == 'boundary' and object.tags.boundary == 'religious_administration' and object.tags.admin_level == '10' then
        for i = #object.members, 1, -1 do
            if object.members[i].role ~= "inner" and object.members[i].role ~= "outer" then
              table.remove(object.members, i)
            end
        end

        local mp = object:as_multipolygon()
        
        parishes:insert{
            name = object.tags.name,
            geom = mp
        }
    end
end

However, although object.members only contains objects from which a boundary should be created object:as_multipolygon() takes into account all members, even removed ones.

@joto
Copy link
Collaborator

joto commented Oct 19, 2023

Yes. Changing anything in the object doesn't affect the geometry generation. In this case the behaviour is generally the "right thing", because the roles inner and outer are not always tagged correctly. And the boundary relations shouldn't have any way member objects that are not part of the boundary, if they do, that tagging is wrong in my opinion. If you want to do more specialized processing, you have to do that in the database.

@docentYT
Copy link
Author

As a data consumer, I want to be sure that even if the tagging is not 100% correct, I will get the data I need, so I think that the option of doing my own data filtering could be helpful.

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