Faster distance clalculation between multigeometries #15
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.
This so fare includes several successful experiments I did over the last week, with the overall goal of speeding up the distance calculation between very large multi-geometries (
MULTI*andCOLLECTION).1.) Store the current upper distance bound across multi geometry parts, which causes many candidates being already discarded via a simple bounding box distance calculation
2.) Improve the initial upper bound by storing, for each multigeometry, the rightmost point during parsing
3.) Make the padding for the meter distance distortion on the web mercator projected plane more tight by only considering the local distortion (e.g. if we know that both geometries are on the same "band" around the globe, it is necessary to consider the global distortion factor initially for computing the euclidean distance upper bound, but for the further sweep padding it is then enough to only consider the relative distortion between the geometries (which is nearly 1 if latitudes are close)
4.) Update
libspatialjointo a new experimental version which computes tighter initial upper distance bounds on start (by doing a simple probing of 4 points) and which also updates the sweeping padding dynamically during the sweep.5.) On the side, fix a very subtle bug in which the distortion for the candidate sweep padding was computed based on the original geometry, but it must be computed based on the padded geometry. This caused some lost candidates on very large distances.