Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-45

Performance improvement of queryByPointRadius

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Referencing
    • None

    Description

      If I didn't make a mistake a search with the normal distance method took ~2.4s and with this distance method it takes only about 0.7s:

        public static double getHaversineDistance(double fromLat, double fromLon, double toLat, double toLon) {
          double dLat = Math.toRadians(toLat - fromLat);
              double dLon = Math.toRadians(toLon - fromLon);
              double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
                      + Math.cos(Math.toRadians(fromLat)) * Math.cos(Math.toRadians(toLat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
              return EARTH_RADIUS * 2 * Math.asin(Math.sqrt(a));
        }
      

      Also one should think about normalizing the distance before the search so that one does not need the whole last line which should give further speed improvements.

      I'm still unsure why it takes roughly the same time in my example for 10km, 20km and 40kmm where at every step a lot more nodes are involved. Normally I would say the mode nodes - the more comparisons it'll take and the slower it should get. But it doesn't. Probably I'm measuring wrong?

      Attachments

        Activity

          People

            chrismattmann Chris A. Mattmann
            peathal Peter Karich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: