locationtech / locationtech/geomesa

DWithin filters do not always calculate correct distance

Open
#10,281 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.5k
Forks
446
Avg merge
1d 8h
Merged PRs (30d)
31

Description

DWithin filters do not always calculate correct distance

example: Paris POINT (2.350987 48.856667) to Moscow POINT (37.630866 55.752256) has an orthometric distance of ~2495 km but returns false for dwithin 2500 kilometers.


Original JIRA Issue: https://geomesa.atlassian.net/browse/GEOMESA-3083

Key: GEOMESA-3083
Type: Bug
Priority: Major
Status: To Do
Resolution: Unresolved
Reporter: Emilio Lahr-Vivaz
Created: Tue, 25 May 2021 08:29:05 -0400
Updated: Tue, 25 May 2021 08:44:10 -0400


Comments:

557058:da7f6dfa-f0a1-468b-aec5-2cb61273feb5 (Tue, 25 May 2021 08:31:31 -0400):

unit test showing the issue:
val calc = new GeodeticCalculator() calc.setStartingGeographicPoint(2.350987, 48.856667) calc.setDestinationGeographicPoint(37.630866, 55.752256) calc.getOrthodromicDistance must beLessThan(2500000d) val sft = SimpleFeatureTypes.createType("test", "geom:Point:srid=4326") val feature = ScalaSimpleFeature.create(sft, "1", "POINT (37.630866 55.752256)") // moscow val ecql = "dwithin('POINT (2.350987 48.856667)', geom, 2500, kilometers)" // paris val fast = FastFilterFactory.toFilter(sft, ecql) fast.evaluate(feature) must beTrue

557058:da7f6dfa-f0a1-468b-aec5-2cb61273feb5 (Tue, 25 May 2021 08:44:10 -0400):

If we can’t come up with a good upper-limit, possibly we could have a query hint or sys prop or use the existing exact bbox flag to toggle the upper limit check on and off.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the inline unit test using GeodeticCalculator, SimpleFeatureTypes, ScalaSimpleFeature, and FastFilterFactory.toFilter. Trace the DWithin evaluation for the Paris and Moscow points, then verify that the 2,500-kilometer query returns true while preserving the existing filter behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.