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

function osm_fill_ref assigns wrong values #2

Open
juanfonsecaLS1 opened this issue Jan 19, 2024 · 2 comments
Open

function osm_fill_ref assigns wrong values #2

juanfonsecaLS1 opened this issue Jan 19, 2024 · 2 comments

Comments

@juanfonsecaLS1
Copy link
Contributor

juanfonsecaLS1 commented Jan 19, 2024

The current version of the osm_fill_function assigns the wrong values to some short links.
Here there is a small example from the network in Hull where the function assigns the ref A1033 to the links on the A1079.
image

The problem seems to happen when the values in the highway attribute are compared. In this particular case, the U-turn links have a different type than the main links of the A1079, so the refs of the nearest links are skipped in this part of the function

for(k in 1:2){
    for(i in 1:nrow(lines_major)){
      if(is.na(lines_major$ref[i])){ #find the item whose ref equals to NA
        for(j in 2:nearest_neighbour){ #starts from 2 because j=1 is the point itself
          idx <- nn$nn.idx[i,j] # allocate the row number of the nearest centroid
          if(lines_major$highway[idx] == lines_major$highway[i]){
            if(!is.na(lines_major$ref[idx])){
              lines_major$ref[i] <- lines_major$ref[idx]
              break
            }
          }
        }
      }
    }
  }

image

As the nearest trunk road is the A1033, it uses that ref to fill the missing value.

Nonetheless, it does not seem to affect the main links.

@mem48
Copy link
Contributor

mem48 commented Jan 20, 2024

Well spotted do you have a suggested fix?

@juanfonsecaLS1
Copy link
Contributor Author

juanfonsecaLS1 commented Jan 20, 2024 via email

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