Disable snapping for certain highway tags

Related to Issue 322

Situation: Graphhopper snaps to the closest highway for start and end locations.
Question: Is there a setting for snapping only to certain types of highways?

Example 1: Never snap to the nearest highway of type primary.
Example 2: Only snap to highways of type secondary, tertiary and motorway.

Thank you so much already,

You can use an EdgeFilter which you feed the location index with and use the DataFlagEncoder to determine the highway type.

Could you point me a little more into a proper direction – maybe there is an example involving the DataFlagEncoder?
That would help a lot.

Search the unit test how to use the DataFlagEncoder.

Indeed the usage is not that straightforward:

// just out of my head without a compiler ...

stringDoubleMap.put("motorway", 100);
// put other tags that should be accepted

// now grab the speed for every highway tag as array. Here e.g. entry 0 of the speedArray means motorway
double[] speedArray = dataFlagEncoder.getHighwaySpeedMap(stringDoubleMap);
boolean[] acceptArray = new boolean[speedArray.length];

for(int i = 0; i < speedArray.length; i++) {
  double speedValue = speedArray[i];
  if(value > 0)
     acceptArray[i] = true;

edgeFilter = new EdgeFilter() {
   boolean accept(EdgeIteratorState edge) {
      return acceptArray[dataFlagEncoder.getHighway(edge)];