Conversation
Contributor
|
The disputed relation handling is still not completely correct. If a disputed relation has an admin_level tag, then you would only want to mark the boundary way as disputed if its own level is equal or higher. That means you need to save the level to which the dispute applies. |
49d3282 to
f021d2a
Compare
Contributor
Author
|
I have changed to commit to take admin_levels of relations tagged boundary=disputed into account. |
f021d2a to
47da67c
Compare
lonvia
approved these changes
Nov 28, 2024
lonvia
reviewed
Nov 29, 2024
| -- if either the relation doesn't have an admin_level tag or the | ||
| -- admin_level tag is <= the admin level the way got from the | ||
| -- boundary=administrative relation(s). | ||
| local admin_level = tonumber(object.tags.admin_level or 1) |
Contributor
There was a problem hiding this comment.
Still not right, because admin_level will now be nil when object.tags.admin_level is set but is not a number. Must be: local admin_level = tonumber(object.tags.admin_level or 1) or 1
Contributor
Author
There was a problem hiding this comment.
I have added an explicit function instead which makes it more explicit what's happening here.
-- Get numerical admin level from string, default to 1 if invalid
local function get_admin_level(value)
if not value or not string.match(value, '^[1-9][0-9]?$') then
return 1
end
return tonumber(value)
end
47da67c to
51c341d
Compare
Do not add the names from boundary ways to the output. Some ways have names but use is inconsistent and generally not useful in this context.
The way disputed boundaries are implemented was not correct. Generally boundaries should be processed as if disputed boundaries do not exists. But then boundary lines are flagged as disputed if they are created from ways * that have the tag disputed=yes, or * that are in a relation tagged boundary=disputed with no admin_level set or an admin_level smaller or equal to the admin_level that the boundary line has (which is the smallest of any boundary relation the way is a member of) Note that the relation that marks a way as disputed is not the same relation that marks a way as part of some specific admin boundary. The first is tagged boundary=disputed, the second is tagged boundary=administrative. This is based on the work in #10 but rewrites the code to be (hopefully) easier to understand. Note that this only fixes the version for shortbread_v1, the version for shortbread_v1_gen also needs updating which will come later.
51c341d to
fa2e3b1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First commit: Boundary lines in shortbread have no names
Do not add the names from boundary ways to the output. Some ways have names but use is inconsistent and generally not useful in this context.
Second commit: Fix shortbread boundary processing in regards to disputed boundaries
The way disputed boundaries are implemented was not correct. Generally boundaries should be processed as if disputed boundaries do not exists. But then all boundary lines created from ways that have the disputed flag set or that are in a relation tagged boundary=disputed will be marked as disputed.
Note that the relation that marks a way as disputed is not the same relation that marks a way as part of some specific admin boundary. The first is tagged boundary=disputed, the second is tagged boundary=administrative.
This is based on the work in #10 but rewrites the code to be (hopefully) easier to understand.
Note that this only fixes the version for shortbread_v1, the version for shortbread_v1_gen also needs updating which will come later.