Skip to content

Fix world envelope builder when crossing Greenwich meridian - #5731

Merged
leonardehrenfried merged 1 commit into
opentripplanner:dev-2.xfrom
leonardehrenfried:fix-envelope
Mar 12, 2024
Merged

leonardehrenfried merged 1 commit into
opentripplanner:dev-2.xfrom
leonardehrenfried:fix-envelope

Conversation

@leonardehrenfried

Copy link
Copy Markdown
Member

Summary

I was working with a UK data set today and noticed that half of the debug tiles were not displayed correctly.

Screenshot from 2024-03-07 12-44-35

The cut off went right through the middle of London near the Greenwich meridian.

It turns out that the lower left tile boundaries in the debug client, which are derived from the world envelope builder, are too far east.

The fix was a tiny change to the WorldEnvelopeBuilder: the problem was that when we have a data set crossing the meridian, we need to go as far west as possible but using the smallest (most negative) number, not the largest one, which would be around Greenwich.

Unit tests

Added.

Documentation

Added.

@leonardehrenfried leonardehrenfried added the !Bug Apply to issues describing a bug and PRs witch fixes it. label Mar 7, 2024
@leonardehrenfried
leonardehrenfried requested a review from a team as a code owner March 7, 2024 12:20
@codecov

codecov Bot commented Mar 7, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 67.78%. Comparing base (0532203) to head (747246e).

Files Patch % Lines
...vice/worldenvelope/model/WorldEnvelopeBuilder.java 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5731   +/-   ##
==========================================
  Coverage      67.77%   67.78%           
- Complexity     16474    16482    +8     
==========================================
  Files           1901     1901           
  Lines          72121    72135   +14     
  Branches        7430     7434    +4     
==========================================
+ Hits           48881    48894   +13     
  Misses         20727    20727           
- Partials        2513     2514    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@t2gran

t2gran commented Mar 8, 2024

Copy link
Copy Markdown
Member

Not sure if I was asleep or not when writing the test for this. I have clearly created a few test-cases, but not written test for them. There are not one bug here, but two - I fixed both in the following commit:

I think you can apply this commit 81d7466.

About the unit-test:

  • It should not use samples; hence using real data is not the best. It should be logically build up to cover all corner cases. I often find the pigeon-hole-principle useful - but not in this case. In this case it is simpler to just do the permutations I have added in the unit-test. Ideally test should be black box, but I usaually end up in between to save work - last 1% is hard. I do aim for at least 90% branch coverage on stuff like this.

@t2gran

t2gran commented Mar 8, 2024

Copy link
Copy Markdown
Member

Note! When writing module and integration tests we do use samples - because we are not covering ereything (imposible) and we want to be close the the use-cases.

 - The envelope calculation was wrong when envelope included0º (Greenwich)
 - The medianCenter was wrong when the envelope included 180º
@leonardehrenfried

Copy link
Copy Markdown
Member Author

Thanks for this, @t2gran . I've applied your commit and removed mine.

@leonardehrenfried

Copy link
Copy Markdown
Member Author

I have reviewed and tested it. It works.

@t2gran t2gran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving this on behalf of @leonardehrenfried and myself.

@t2gran t2gran added this to the 2.5 (next release) milestone Mar 12, 2024
@leonardehrenfried
leonardehrenfried merged commit f10bc04 into opentripplanner:dev-2.x Mar 12, 2024
t2gran pushed a commit that referenced this pull request Mar 12, 2024
@leonardehrenfried
leonardehrenfried deleted the fix-envelope branch March 12, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants