Class NameSimilarityEdgeFilter

java.lang.Object
com.graphhopper.routing.util.NameSimilarityEdgeFilter
All Implemented Interfaces:
EdgeFilter

public class NameSimilarityEdgeFilter extends Object implements EdgeFilter
This class defines the basis for NameSimilarity matching using an EdgeFilter. It is not thread-safe. The typical use-case is to match not the nearest edge in LocationIndex.findClosest(double, double, EdgeFilter) but the edge with the name that is similar to the specified pointHint and still close.

Names that are similar to each other are (n1 name1, n2 name2):

  • n1 == n2
  • n1 is significant substring of n2, e.g: n1="Main Road", n2="Main Road, New York"
  • n1 and n2 contain a reasonable longest common substring, e.g.: n1="Cape Point / Cape of Good Hope", n2="Cape Point Rd, Cape Peninsula, Cape Town, 8001, Afrique du Sud"

The aim is to allow minor typos/differences of the substrings, without having too much false positives.

Author:
Robin Boldt, Peter Karich
  • Constructor Details

    • NameSimilarityEdgeFilter

      public NameSimilarityEdgeFilter(EdgeFilter edgeFilter, String pointHint, GHPoint point, double radius)
    • NameSimilarityEdgeFilter

      public NameSimilarityEdgeFilter(EdgeFilter edgeFilter, String pointHint, GHPoint point, double radius, Map<String,String> rewriteMap)
      Parameters:
      radius - the searchable region about the point in meters
      rewriteMap - maps abbreviations to its longer form
  • Method Details

    • accept

      public final boolean accept(EdgeIteratorState iter)
      Specified by:
      accept in interface EdgeFilter
      Returns:
      true if the current edge should be processed and false otherwise.