public static EncodingManager create ( FlagEncoderFactory factory , String ghLoc ) { Directory dir = new RAMDirectory ( ghLoc , true ) ; StorableProperties properties = new StorableProperties ( dir ) ; if ( ! properties . loadExisting ( ) ) throw new IllegalStateException ( "Cannot load properties to fetch EncodingManager configuration at: " + dir . getLocation ( ) ) ; // check encoding for compatibility properties . checkVersions ( false ) ; String acceptStr = properties . get ( "graph.flag_encoders" ) ; if ( acceptStr . isEmpty ( ) ) throw new IllegalStateException ( "EncodingManager was not configured. And no one was found in the graph: " + dir . getLocation ( ) ) ; int bytesForFlags = 4 ; try { bytesForFlags = Integer . parseInt ( properties . get ( "graph.bytes_for_flags" ) ) ; } catch ( NumberFormatException ex ) { } return createBuilder ( factory , acceptStr , bytesForFlags ) . build ( ) ; }
Create the EncodingManager from the provided GraphHopper location . Throws an IllegalStateException if it fails . Used if no EncodingManager specified on load .