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

Adding boundary tag to nodes on ways that span boundaries #8

Merged
merged 5 commits into from
Sep 5, 2017

Conversation

matthieun
Copy link
Collaborator

When a way is not assigned any country code (it is not within a country boundary) but it is still connected to ways that are inside the boundary (long bridges, ferry routes for example), the end nodes of those ways were not assigned any synthetic_boundary_node tag. This PR adds the tag to those nodes.
It also refactors the function that decides when an OSM node becomes an Atlas Point. That allows to take the new tags into account, and to avoid building more Points than necessary.

Copy link
Contributor

@MikeGost MikeGost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean, thanks @matthieun! One question and minor nit.

@@ -694,11 +699,39 @@ private void keepOutsideWaysThatAreConnected()
{
if (!this.store.containsWay(way.getId()))
{
final List<WayNode> wayNodes = way.getWayNodes();
for (final WayNode wayNode : way.getWayNodes())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you use wayNodes in the for:each loop, since you extracted the variable out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

for (final WayNode wayNode : way.getWayNodes())
{
final long identifier = wayNode.getNodeId();
if (this.store.containsNodeAtEndOfEdges(identifier))
{
final Long startNodeIdentifier = wayNodes.get(0).getNodeId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any crazy chance that wayNodes are empty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is within the for loop that loops through all the wayNodes, so if it is empty, it would not reach the body of the for loop.

@@ -99,4 +112,22 @@ public void testNoFilter()
logger.info("{}", atlas);
Assert.assertEquals(3, atlas.numberOfLines());
}

@Test
public void testOutsideWayBoundaryNodes()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test!

|| containsNodeInRelations(node.getId());
if (containsNodeInRelations(node.getId()))
{
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if an OSM node is part of a relation and it is at the end of an edge, then it would be have one node counterpart in Atlas and one point counterpart. Is that intentional?

Copy link
Contributor

@mertemin mertemin Sep 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus, what is the reason we make an OSM node an Atlas point because it is part of a relation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why this was designed this way. I figured for this PR I would not touch that part of the logic, but you are correct this can be questionable... Created #10 to track it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. It can definitely be addressed later.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why we need this check, it doesn't seem correct. Agree to try to remove this later. Thanks!

return true;
}
// Tags from OSM are the tags that all the nodes will have
if (node.getTags().size() > AtlasTag.TAGS_FROM_OSM.size())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic behind needs some explanation and seems easy to break. I'd suggest adding some comments and explaining why it makes a node an Atlas point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #11 as well. Again for this PR I did not want to change the logic here, but that deserves a refactor.
I will add more comments as well in the mean time.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design was any OSM node with artificial tag will be promoted as an Atlas Point.
So here it is checking if the OSM node has artificial tag other than those default tags from OSM (like LastEditTimeTag etc.).

Copy link
Contributor

@mertemin mertemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have some comments about the logic converting OSM node to Atlas point/node

Copy link
Contributor

@mertemin mertemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the better explanation about point decision.

@MikeGost MikeGost merged commit cbeb2b5 into osmlab:dev Sep 5, 2017
@matthieun matthieun added this to the 5.0.1 milestone Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants