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

Support type=boundary relations as native multipolygons #508

Merged
merged 3 commits into from
Jul 23, 2023
Merged

Conversation

systemed
Copy link
Owner

@systemed systemed commented Jul 22, 2023

This enables boundary relations to benefit from multipolygon inner/outer processing.

You can now treat boundary relations in one of two ways:

  • as properties on a way, iterated through with NextRelation (this is good for administrative boundaries which are often coterminous)
  • as discrete geometries, processed with relation_function (this is good for nature reserves, forests and other polygons)

An example of the latter would be:

function relation_scan_function(relation)
  if relation:Find("type")=="boundary" then
    relation:Accept()
  end
end

function relation_function(relation)
  if relation:Find("type")=="boundary" and relation:Find("boundary")=="protected_area" then
    relation:Layer("park",true)
    relation:Attribute("class", "public_park")
    SetNameAttributes(relation)
  end
end

In essence, any relation with inner/outer roles will be processed as a multipolygon by relation_function, apart from type=multipolygon which is processed by way_function. To process relations other than type=multipolygon, writing a relation_scan_function is still required.

@systemed systemed merged commit 528aa25 into master Jul 23, 2023
8 checks passed
@systemed systemed deleted the boundary branch July 23, 2023 07:57
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

Successfully merging this pull request may close these issues.

1 participant