-
Notifications
You must be signed in to change notification settings - Fork 403
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
fix(isochrones): correct and unify edge splitting #1708
Conversation
Could you please elaborate on how this change affects isolines across the globe? Using geo-coordinates means measuring in degrees. The distance between coordinates varies a lot depending on the location and the used coordinate system. Imagine you would invent a coordinate system having its north pole in Berlin. would the isolines still have the same shape? |
Thanks @sfendrich, that's a fair point! What this PR tries to achieve is to perform edge splitting in the same coordinate system in which the concave hull is also being computed. The concave hull algorithm is parameterized by the target maximum edge length. Edge splitting makes sure that edge segments which are input to the concave hull algorithm do not exceed this limit. This PR does not make any change to the concave hull part which actually computes the isochrone polygons. This part has alwas been done in the geocoordinate domain. Having said this, I agree that the generated shape is influenced by the location. |
So, if I build the same town two times, once in Alaska and once in Cameroon, the isochrones would differ in their shape? This sounds undesirable. |
While the above is true, this is also how it has always been like. Let me stress this again: this PR does not change how the isochrones are build in general. It just makes adjustments to the logic how the edges are split, and the splitting is there only to facilitate correct results from computing the concave hull. Having said this, I don't think this discussion should be continued here. If you are not satisfied with the current solution of generating isochrone geometries you are welcome to open an issue. Cheers! |
But I think this could have a very easy fix, just make the smoothing-factor depending an the latitude of the center. What do you think? |
@rtroilo thanks for chiming in. I've thought about this too, however, the further apart you move from the equator the higher the discrepancy between the length in meters of one latitudinal and one longitudinal degrees. The algorithm which computes the concave hull is parametrized only with one length and does not differentiate between XY directions. So effectively you still have the same issue, or do I miss something? 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two minor comments.
ors-engine/src/main/java/org/heigit/ors/isochrones/builders/AbstractIsochroneMapBuilder.java
Outdated
Show resolved
Hide resolved
ors-engine/src/main/java/org/heigit/ors/isochrones/builders/AbstractIsochroneMapBuilder.java
Show resolved
Hide resolved
So, to summarize the discussion: The issue solved by this PR is the following: If a long graph edge is used in an isochrone it should be contained in the concave hull. However, due to the length of the edge, the concave hull algorithm might inappropriately introduce a cave such that the edge is outside the hull. Therefore, we introduce additional nodes on this long edge to split it into multiple shorter ones, yielding more points to be fed into the concave hull algorithm. These additional points prevent the creation of the cave. Independent of this PR it seems there is something fundamentally wrong with isochrones being computed from geo-coordinates. At the scale of a single isochrone, this is probably not relevant. But when comparing isochrones at different latitudes, the length differences of a longitude degree might affect the shape and size of the isochrone's geometry. |
9a4bf9c
to
6edf66f
Compare
@aoles Can we merge this? |
Pull Request Checklist
have been resolved.
[Unreleased] heading.
along with a short description of what it is for, and documented this in the Pull Request (below).
(at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
importer etc.), I have generated longer distance routes for the affected profiles with different options
(avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end
points generated from the current live ORS.
If there are differences then the reasoning for these MUST be documented in the pull request.
and why the change was needed.
Information about the changes
In order to guarantee correct construction of the concave hull edge splitting operations need to be performed based on the differences computed on geocoordinates rather than on the actual distances in meters. In practice, this switch makes little difference to the produced geometries and has virtually no measurable impact on performance. Typical differences in geometries observed are as follows, where blue is the geometry produced with the previous approach, and red with the new one.
The reduction of the splitting length has more noticeable effects, see report. For regular isochrones going down by 1/3 from
0.012
to0.009
, which corresponds to 1333 and 999 meters in latitude, respectively, comes with a performance penalty of around 15%. However, it helps to increase isochrone accuracy and avoid false inclusion of unreachable areas, which is best illustrated by the following example.Location 10
Typically, the observed differences are more subtle, such as
Location 4
and
Location 7