GeoServer
  1. GeoServer
  2. GEOS-937

DWithin filters should honour the units set in the distance element

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: WFS
    • Labels:
      None
    • Environment:
      All
    • Number of attachments :
      0

      Description

      Currently GeoServer only handles the distance of a DWithin filter in the unit the data is stored in, which is inconvenient and not in keeping with the filter specification which indicates you can set a units attribute in the distance element to specify how big the circle should be.

      While not in any way life threatening this is annoying and would be good to fix, however I've no idea how far under the hood it goes and if in fact this is really a geotools problem or not.

        Issue Links

          Activity

          Hide
          Andrea Aime added a comment -

          Unfortunately this goes deep down in Geotools, and it's not trivial

          Show
          Andrea Aime added a comment - Unfortunately this goes deep down in Geotools, and it's not trivial
          Hide
          Hans Stevens added a comment -

          Hi,

          Ran into the same issue here too, would really like this to be fixed.
          Another option would be that if it doesn't get fixed, it would show some logging information / throwing some kind of not implemented exception...

          Show
          Hans Stevens added a comment - Hi, Ran into the same issue here too, would really like this to be fixed. Another option would be that if it doesn't get fixed, it would show some logging information / throwing some kind of not implemented exception...
          Hide
          Andrea Aime added a comment - - edited

          An approximate version may be implementable given the existing tools. The idea is as follows:

          • take the original geometry, sample it over its boundaries and draw a point at the specified distance and using an orthogonal angle to the current line. Making the sampling distance significantly smaller than the to be dwithin distance should provide decent accuracy
          • connect all the generated dots and generate a polygon out of it. Mind that this requires the line not to be self intersecting, and there is no guarantee it will be. So some way has to be devised to remove the overlaps
          • turn the within distance check into a overlaps check

          So, doable it is, but it may not be trivial and there is no resourcing backing this. Are you able to provide it some way? (either your own work or by paying a commercial support provider?)

          Show
          Andrea Aime added a comment - - edited An approximate version may be implementable given the existing tools. The idea is as follows: take the original geometry, sample it over its boundaries and draw a point at the specified distance and using an orthogonal angle to the current line. Making the sampling distance significantly smaller than the to be dwithin distance should provide decent accuracy connect all the generated dots and generate a polygon out of it. Mind that this requires the line not to be self intersecting, and there is no guarantee it will be. So some way has to be devised to remove the overlaps turn the within distance check into a overlaps check So, doable it is, but it may not be trivial and there is no resourcing backing this. Are you able to provide it some way? (either your own work or by paying a commercial support provider?)
          Hide
          Andrea Aime added a comment -

          Ah, just noticed you were not watching the issue. I've added to the watchers list so that you're notified about comments and the like

          Show
          Andrea Aime added a comment - Ah, just noticed you were not watching the issue. I've added to the watchers list so that you're notified about comments and the like
          Hide
          Hans-Joachim Kliemeck added a comment -

          any progress on this issue?

          Show
          Hans-Joachim Kliemeck added a comment - any progress on this issue?
          Hide
          Andrea Aime added a comment -

          Hajo, nope, there are ideas on how to do this but the time to implement it is significant, it's not a spare time project

          Show
          Andrea Aime added a comment - Hajo, nope, there are ideas on how to do this but the time to implement it is significant, it's not a spare time project
          Hide
          Hans-Joachim Kliemeck added a comment -

          Hey Andrea, whats about JTS.orthodromicDistance as described on http://docs.geotools.org/latest/userguide/library/referencing/calculator.html ?

          Show
          Hans-Joachim Kliemeck added a comment - Hey Andrea, whats about JTS.orthodromicDistance as described on http://docs.geotools.org/latest/userguide/library/referencing/calculator.html ?
          Hide
          Andrea Aime added a comment -

          That is not JTS, GeodeticCalculator is a GeoTools class. Anyways, that computes point to point distance or a target point given a source point, distance and direction.
          It's not nearly enough to implement a dwithin or a buffer operation, we lack the concept of nearest points between two non point geometries (which requires the one of minimum point to line distance, which we also don't have).
          Regardless, going down this road (precise calculations) would require even more work than the approaches we have in mind and that we did not attempt because.. they are too much work to do in spare time. If skilled java developers at your premises you're welcomed to try and contribute back the changes, if you have funding there is the option of commercial support for GeoTools (http://docs.geotools.org/latest/userguide/welcome/support.html#commercial-support).

          Anyways, it's good even if we just discuss it further, whoever gets enough time to actually do this will benefit from reading the conversation logs in this jira.

          Show
          Andrea Aime added a comment - That is not JTS, GeodeticCalculator is a GeoTools class. Anyways, that computes point to point distance or a target point given a source point, distance and direction. It's not nearly enough to implement a dwithin or a buffer operation, we lack the concept of nearest points between two non point geometries (which requires the one of minimum point to line distance, which we also don't have). Regardless, going down this road (precise calculations) would require even more work than the approaches we have in mind and that we did not attempt because.. they are too much work to do in spare time. If skilled java developers at your premises you're welcomed to try and contribute back the changes, if you have funding there is the option of commercial support for GeoTools ( http://docs.geotools.org/latest/userguide/welcome/support.html#commercial-support ). Anyways, it's good even if we just discuss it further, whoever gets enough time to actually do this will benefit from reading the conversation logs in this jira.

            People

            • Assignee:
              Andrea Aime
              Reporter:
              Ian Turton
            • Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: